diff options
author | Yati Sagade <ysagade@fastmail.nl> | 2017-11-25 20:28:13 +0100 |
---|---|---|
committer | Yati Sagade <ysagade@fastmail.nl> | 2017-12-22 10:47:23 +0100 |
commit | aa48a2c2e3c7699a167d9ffe791f4bb17e9b9f1c (patch) | |
tree | 7e7e916f1202aeeb09fe417f589b7e0f8f9b0a21 /components/layout_thread/lib.rs | |
parent | 2eb1512c22e7d79a4c6af70af7aec53f4b18cac2 (diff) | |
download | servo-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_thread/lib.rs')
-rw-r--r-- | components/layout_thread/lib.rs | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/components/layout_thread/lib.rs b/components/layout_thread/lib.rs index 8401305036f..b89df5f6fa7 100644 --- a/components/layout_thread/lib.rs +++ b/components/layout_thread/lib.rs @@ -100,8 +100,8 @@ use script_layout_interface::rpc::{LayoutRPC, MarginStyleResponse, NodeOverflowR use script_layout_interface::rpc::TextIndexResponse; use script_layout_interface::wrapper_traits::LayoutNode; use script_traits::{ConstellationControlMsg, LayoutControlMsg, LayoutMsg as ConstellationMsg}; +use script_traits::{DrawAPaintImageResult, PaintWorkletError}; use script_traits::{ScrollState, UntrustedNodeAddress}; -use script_traits::DrawAPaintImageResult; use script_traits::Painter; use selectors::Element; use servo_arc::Arc as ServoArc; @@ -1787,7 +1787,7 @@ impl Painter for RegisteredPainterImpl { device_pixel_ratio: TypedScale<f32, CSSPixel, DevicePixel>, properties: Vec<(Atom, String)>, arguments: Vec<String>) - -> DrawAPaintImageResult + -> Result<DrawAPaintImageResult, PaintWorkletError> { self.painter.draw_a_paint_image(size, device_pixel_ratio, properties, arguments) } |