Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only request tiles which have out-of-date content #86

Merged
merged 1 commit into from Jul 17, 2014

Conversation

@mrobinson
Copy link
Member

mrobinson commented Jul 17, 2014

Instead of constantly requesting tiles and throttling requests, only
request tiles if the application signals that the layer contents have
changed.

layers.rs Outdated
let ContentAge(ref mut u) = *self;
*u += 1;
}
}

This comment has been minimized.

@zwarich

zwarich Jul 17, 2014

Contributor

Does it make sense for this to be a tuple struct where everything is public? That sort of takes away the benefits of the abstraction. As far as I can tell, other modules only ever create a new ContentAge starting at zero and then compare them. Maybe it should be a struct with a constructor that starts it out at zero.

This comment has been minimized.

@mrobinson

mrobinson Jul 17, 2014

Author Member

I'll give your suggestion a try. The implementation is currently just a copy-and-paste (obviously not ideal) of Epoch from Servo.

// a stale buffer at some point. We could handle this situation more gracefully if
// Servo and rust-layers shared Epoch/ContentAge values. That would make using rust-layers
// more complicated though.
match self.content_age_of_pending_buffer {

This comment has been minimized.

@zwarich

zwarich Jul 17, 2014

Contributor

Do you think that Servo and rust-layers should share Epoch/ContentAge values? In theory that makes more sense to me, since there are fewer possibilities for mismatched views of the flow of time where one is incremented yet the other is not.

This comment has been minimized.

@mrobinson

mrobinson Jul 17, 2014

Author Member

I went back and forth on this quite a bit. My original thought was that they could be shared, but that means that any application using rust-layers would need to manage Epochs itself (like servo). That kind of interface might be too complicated for every application.

Currently the contract is that the application/embedding library must call Layer::content_changed when the surface content changes. If it calls content_changed twice before adding buffers, it should call add_buffers once with the latest contents. Adding two sets of buffers will trigger this warning.

I believe we should think carefully about a way to keep the interface simple between the two layers, while still properly handling receiving old buffers.

This comment has been minimized.

@zwarich

zwarich Jul 17, 2014

Contributor

I think your concerns are reasonable, but in general we shouldn't favor a simpler interface for hypothetical secondary clients of rust-layers if it hurts the readability / enforced correctness of Servo code. Having the interface split is still very helpful even if we don't have any other clients, though.

I recommend we just discuss this at some point after this PR.

tiling.rs Outdated
}

// Don't resend a request, if we already have one pending.
return match self.content_age_of_pending_buffer {

This comment has been minimized.

@zwarich

zwarich Jul 17, 2014

Contributor

I think the return can be removed here.

layers.rs Outdated
}
}
pub fn next(&mut self) {
self.age = self.age + 1;

This comment has been minimized.

@zwarich

zwarich Jul 17, 2014

Contributor

I think you can use self.age += 1; here, or does that not work?

This comment has been minimized.

@mrobinson

mrobinson Jul 17, 2014

Author Member

Oh yeah. That's definitely better. I'll push an update.

Instead of constantly requesting tiles and throttling requests, only
request tiles if the application signals that the layer contents have
changed.
zwarich pushed a commit that referenced this pull request Jul 17, 2014
Only request tiles which have out-of-date content
@zwarich zwarich merged commit 6e4b3e4 into servo:master Jul 17, 2014
@mrobinson mrobinson deleted the mrobinson:tilegrid-efficiency branch Jul 18, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants
You can’t perform that action at this time.