aboutsummaryrefslogtreecommitdiffstats
path: root/components/layout/layout_thread.rs
diff options
context:
space:
mode:
authorPatrick Walton <pcwalton@mimiga.net>2016-03-09 18:25:12 -0800
committerPatrick Walton <pcwalton@mimiga.net>2016-03-22 14:49:47 -0700
commit0006c1923a87d7de6b568a645fb72be16900fabc (patch)
tree1ef8c26c54b2b39bce49ce881ae2f073cd0c3cb1 /components/layout/layout_thread.rs
parent9fcf9215d008c4d29482f866812866f7169e6d15 (diff)
downloadservo-0006c1923a87d7de6b568a645fb72be16900fabc.tar.gz
servo-0006c1923a87d7de6b568a645fb72be16900fabc.zip
gfx: Allow images to be shipped to the WebRender thread without shipping
over the data as well. WebRender doesn't need the data, as it acquires it separately. About a 50%-100% improvement in display list building time on browser.html.
Diffstat (limited to 'components/layout/layout_thread.rs')
-rw-r--r--components/layout/layout_thread.rs11
1 files changed, 10 insertions, 1 deletions
diff --git a/components/layout/layout_thread.rs b/components/layout/layout_thread.rs
index 603fa35472c..041eab87168 100644
--- a/components/layout/layout_thread.rs
+++ b/components/layout/layout_thread.rs
@@ -24,6 +24,7 @@ use flow_ref::{self, FlowRef};
use fnv::FnvHasher;
use gfx::display_list::{ClippingRegion, DisplayItemMetadata, DisplayList, LayerInfo};
use gfx::display_list::{OpaqueNode, StackingContext, StackingContextId, StackingContextType};
+use gfx::display_list::{WebRenderImageInfo};
use gfx::font;
use gfx::font_cache_thread::FontCacheThread;
use gfx::font_context;
@@ -39,6 +40,7 @@ use layout_traits::LayoutThreadFactory;
use log;
use msg::constellation_msg::{ConstellationChan, ConvertPipelineIdToWebRender, Failure, PipelineId};
use net_traits::image_cache_thread::{ImageCacheChan, ImageCacheResult, ImageCacheThread};
+use net_traits::image_cache_thread::{UsePlaceholder};
use parallel;
use profile_traits::mem::{self, Report, ReportKind, ReportsChan};
use profile_traits::time::{TimerMetadataFrameType, TimerMetadataReflowType};
@@ -84,7 +86,7 @@ use util::thread;
use util::thread_state;
use util::workqueue::WorkQueue;
use webrender_helpers::{WebRenderDisplayListConverter, WebRenderFrameBuilder};
-use webrender_traits::{self, AuxiliaryListsBuilder};
+use webrender_traits;
use wrapper::{LayoutNode, NonOpaqueStyleAndLayoutData, ServoLayoutNode, ThreadSafeLayoutNode};
/// The number of screens of data we're allowed to generate display lists for in each direction.
@@ -235,6 +237,10 @@ pub struct LayoutThread {
/// The CSS error reporter for all CSS loaded in this layout thread
error_reporter: CSSErrorReporter,
+ webrender_image_cache: Arc<RwLock<HashMap<(Url, UsePlaceholder),
+ WebRenderImageInfo,
+ BuildHasherDefault<FnvHasher>>>>,
+
// Webrender interface, if enabled.
webrender_api: Option<webrender_traits::RenderApi>,
}
@@ -475,6 +481,8 @@ impl LayoutThread {
pipelineid: id,
script_chan: Arc::new(Mutex::new(script_chan)),
},
+ webrender_image_cache:
+ Arc::new(RwLock::new(HashMap::with_hasher(Default::default()))),
}
}
@@ -516,6 +524,7 @@ impl LayoutThread {
canvas_layers_sender: Mutex::new(self.canvas_layers_sender.clone()),
url: (*url).clone(),
visible_rects: self.visible_rects.clone(),
+ webrender_image_cache: self.webrender_image_cache.clone(),
}
}