aboutsummaryrefslogtreecommitdiffstats
path: root/components/script_layout_interface/rpc.rs
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2016-11-21 18:13:40 -0500
committerJosh Matthews <josh@joshmatthews.net>2017-02-22 14:19:35 -0500
commitc890c9143cc1ae82e1116b8fb0c4e9eb478b8a03 (patch)
tree131dcf8dd5a2880562101497d958c02a31903183 /components/script_layout_interface/rpc.rs
parent78e8c31a4d1890260dda83f2db85672f693c1e97 (diff)
downloadservo-c890c9143cc1ae82e1116b8fb0c4e9eb478b8a03.tar.gz
servo-c890c9143cc1ae82e1116b8fb0c4e9eb478b8a03.zip
Make script thread initiate requests for images needed by layout.
In support of this goal, the layout thread collects information about CSS images that are missing image data and hands it off to the script thread after layout completes. The script thread stores a list of nodes that will need to be reflowed after the associated network request is complete. The script thread ensures that the nodes are not GCed while a request is ongoing, which the layout thread is incapable of guaranteeing. The image cache's API has also been redesigned in support of this work. No network requests are made by the new image cache, since it does not possess the document-specific information necessary to initiate them. Instead, there is now a single, synchronous query operation that optionally reserves a slot when a cache entry for a URL cannot be found. This reserved slot is then the responsibility of the queryer to populate with the contents of the network response for the URL once it is complete. Any subsequent queries for the same URL will be informed that the response is pending until that occurs. The changes to layout also remove the synchronous image loading code path, which means that reftests now test the same code that non-test binaries execute. The decision to take a screenshot now considers whether there are any outstanding image requests for layout in order to avoid intermittent failures in reftests that use CSS images.
Diffstat (limited to 'components/script_layout_interface/rpc.rs')
-rw-r--r--components/script_layout_interface/rpc.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/components/script_layout_interface/rpc.rs b/components/script_layout_interface/rpc.rs
index 2fb75f6b959..78e99571ee7 100644
--- a/components/script_layout_interface/rpc.rs
+++ b/components/script_layout_interface/rpc.rs
@@ -2,6 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+use PendingImage;
use app_units::Au;
use euclid::point::Point2D;
use euclid::rect::Rect;
@@ -37,7 +38,8 @@ pub trait LayoutRPC {
fn offset_parent(&self) -> OffsetParentResponse;
/// Query layout for the resolve values of the margin properties for an element.
fn margin_style(&self) -> MarginStyleResponse;
-
+ /// Requests the list of not-yet-loaded images that were encountered in the last reflow.
+ fn pending_images(&self) -> Vec<PendingImage>;
fn nodes_from_point(&self, page_point: Point2D<f32>, client_point: Point2D<f32>) -> Vec<UntrustedNodeAddress>;
fn text_index(&self) -> TextIndexResponse;