aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/display_list_builder.rs
diff options
context:
space:
mode:
authorYati Sagade <ysagade@fastmail.nl>2017-11-25 20:28:13 +0100
committerYati Sagade <ysagade@fastmail.nl>2017-12-22 10:47:23 +0100
commitaa48a2c2e3c7699a167d9ffe791f4bb17e9b9f1c (patch)
tree7e7e916f1202aeeb09fe417f589b7e0f8f9b0a21 /components/layout/display_list_builder.rs
parent2eb1512c22e7d79a4c6af70af7aec53f4b18cac2 (diff)
downloadservo-aa48a2c2e3c7699a167d9ffe791f4bb17e9b9f1c.tar.gz
servo-aa48a2c2e3c7699a167d9ffe791f4bb17e9b9f1c.zip
Paint worklets: Implement timeout for worklet painter threads
When a paint worklet thread takes too long, we would like to move on, since we have a ~16ms budget for rendering @60fps. At the moment, there is no provision in the paintworklet spec to signal such timeouts to the developer. ajeffrey opened an [issue][1] for this, but it got punted to v2 of the spec. Hence we are silently timing out unresponsive paint scripts. The timeout value is chosen to be 10ms by default, and can be overridden by setting the `dom.worklet.timeout_ms` pref. In the absence of such a timeout, the reftest in this commit would fail by timing out the testrunner itself, since the paint script never returns. From my discussions with ajeffrey, this should do until we spec out a way to signal timeouts to the script developer. Since we did not have a better way to trigger a timeout than a busy waiting loop (which would hog one core of the test machine until the timeout was reached), we decided to implement a test only blocking sleep, available to the PaintWorkletGlobalScope. Since `dom.worklet.enabled` enables worklets in general, we also decided to have another pref `dom.worklet.blockingsleep.enabled`, which, in addition to `dom.worklet.enabled`, would be required for the blocking sleep to be available. This fixes #17370. [1]: https://github.com/w3c/css-houdini-drafts/issues/507
Diffstat (limited to 'components/layout/display_list_builder.rs')
-rw-r--r--components/layout/display_list_builder.rs27
1 files changed, 15 insertions, 12 deletions
diff --git a/components/layout/display_list_builder.rs b/components/layout/display_list_builder.rs
index 28511b68569..171e56ab9ea 100644
--- a/components/layout/display_list_builder.rs
+++ b/components/layout/display_list_builder.rs
@@ -1382,7 +1382,7 @@ impl FragmentDisplayListBuilding for Fragment {
.map(|argument| argument.to_css_string())
.collect();
- let mut draw_result = match state.layout_context.registered_painters.get(&name) {
+ let draw_result = match state.layout_context.registered_painters.get(&name) {
Some(painter) => {
debug!("Drawing a paint image {}({},{}).", name, size_in_px.width, size_in_px.height);
let properties = painter.properties().iter()
@@ -1397,19 +1397,22 @@ impl FragmentDisplayListBuilding for Fragment {
},
};
- let webrender_image = WebRenderImageInfo {
- width: draw_result.width,
- height: draw_result.height,
- format: draw_result.format,
- key: draw_result.image_key,
- };
+ if let Ok(draw_result) = draw_result {
+ let webrender_image = WebRenderImageInfo {
+ width: draw_result.width,
+ height: draw_result.height,
+ format: draw_result.format,
+ key: draw_result.image_key,
+ };
- for url in draw_result.missing_image_urls.drain(..) {
- debug!("Requesting missing image URL {}.", url);
- state.layout_context.get_webrender_image_for_url(self.node, url, UsePlaceholder::No);
+ for url in draw_result.missing_image_urls.into_iter() {
+ debug!("Requesting missing image URL {}.", url);
+ state.layout_context.get_webrender_image_for_url(self.node, url, UsePlaceholder::No);
+ }
+ Some(webrender_image)
+ } else {
+ None
}
-
- Some(webrender_image)
}
fn build_display_list_for_background_gradient(&self,