diff options
Diffstat (limited to 'components/compositing/constellation.rs')
-rw-r--r-- | components/compositing/constellation.rs | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index a08687bb680..b7a57f7069e 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -63,6 +63,7 @@ use url::Url; use util::geometry::PagePx; use util::thread::spawn_named; use util::{opts, prefs}; +use webrender_traits; #[derive(Debug, PartialEq)] enum ReadyToSave { @@ -181,6 +182,9 @@ pub struct Constellation<LTF, STF> { /// Document states for loaded pipelines (used only when writing screenshots). document_states: HashMap<PipelineId, DocumentState>, + + // Webrender interface, if enabled. + webrender_api_sender: Option<webrender_traits::RenderApiSender>, } /// State needed to construct a constellation. @@ -203,6 +207,8 @@ pub struct InitialConstellationState { pub mem_profiler_chan: mem::ProfilerChan, /// Whether the constellation supports the clipboard. pub supports_clipboard: bool, + /// Optional webrender API reference (if enabled). + pub webrender_api_sender: Option<webrender_traits::RenderApiSender>, } /// Stores the navigation context for a single frame in the frame tree. @@ -347,6 +353,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF> scheduler_chan: TimerScheduler::start(), child_processes: Vec::new(), document_states: HashMap::new(), + webrender_api_sender: state.webrender_api_sender, }; let namespace_id = constellation.next_pipeline_namespace_id(); PipelineNamespace::install(namespace_id); @@ -399,6 +406,7 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF> load_data: load_data, device_pixel_ratio: self.window_size.device_pixel_ratio, pipeline_namespace_id: self.next_pipeline_namespace_id(), + webrender_api_sender: self.webrender_api_sender.clone(), }); if spawning_paint_only { @@ -1196,7 +1204,9 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF> size: &Size2D<i32>, response_sender: IpcSender<(IpcSender<CanvasMsg>, usize)>) { let id = self.canvas_paint_threads.len(); - let (out_of_process_sender, in_process_sender) = CanvasPaintThread::start(*size); + let webrender_api = self.webrender_api_sender.clone(); + let (out_of_process_sender, in_process_sender) = CanvasPaintThread::start(*size, + webrender_api); self.canvas_paint_threads.push(in_process_sender); response_sender.send((out_of_process_sender, id)).unwrap() } @@ -1206,13 +1216,14 @@ impl<LTF: LayoutThreadFactory, STF: ScriptThreadFactory> Constellation<LTF, STF> size: &Size2D<i32>, attributes: GLContextAttributes, response_sender: IpcSender<Result<(IpcSender<CanvasMsg>, usize), String>>) { - let response = match WebGLPaintThread::start(*size, attributes) { + let webrender_api = self.webrender_api_sender.clone(); + let response = match WebGLPaintThread::start(*size, attributes, webrender_api) { Ok((out_of_process_sender, in_process_sender)) => { let id = self.webgl_paint_threads.len(); self.webgl_paint_threads.push(in_process_sender); Ok((out_of_process_sender, id)) }, - Err(msg) => Err(msg.to_owned()), + Err(msg) => Err(msg), }; response_sender.send(response).unwrap() |