compositing: Use the pre-existing script channel in the same-domain

iframe case instead of creating a new one.

Fixes test timeouts.
This commit is contained in:
Patrick Walton 2015-07-14 15:27:36 -07:00
parent e5b1ec4078
commit c2195c490d

View file

@ -102,7 +102,8 @@ impl Pipeline {
} }
}); });
if let Some(ref script_chan) = script_chan { let (script_chan, script_port) = match script_chan {
Some(script_chan) => {
let (containing_pipeline_id, subpage_id) = let (containing_pipeline_id, subpage_id) =
parent_info.expect("script_pipeline != None but subpage_id == None"); parent_info.expect("script_pipeline != None but subpage_id == None");
let new_layout_info = NewLayoutInfo { let new_layout_info = NewLayoutInfo {
@ -116,13 +117,20 @@ impl Pipeline {
layout_shutdown_chan: layout_shutdown_chan.clone(), layout_shutdown_chan: layout_shutdown_chan.clone(),
}; };
script_chan.0.send(ConstellationControlMsg::AttachLayout(new_layout_info)).unwrap(); script_chan.0
.send(ConstellationControlMsg::AttachLayout(new_layout_info))
.unwrap();
(script_chan, None)
} }
None => {
let (script_chan, script_port) = channel(); let (script_chan, script_port) = channel();
(ScriptControlChan(script_chan), Some(script_port))
}
};
let pipeline = Pipeline::new(id, let pipeline = Pipeline::new(id,
parent_info, parent_info,
ScriptControlChan(script_chan.clone()), script_chan.clone(),
LayoutControlChan(pipeline_chan), LayoutControlChan(pipeline_chan),
paint_chan.clone(), paint_chan.clone(),
layout_shutdown_port, layout_shutdown_port,
@ -272,10 +280,10 @@ pub struct PipelineContent {
time_profiler_chan: time::ProfilerChan, time_profiler_chan: time::ProfilerChan,
mem_profiler_chan: profile_mem::ProfilerChan, mem_profiler_chan: profile_mem::ProfilerChan,
window_size: Option<WindowSizeData>, window_size: Option<WindowSizeData>,
script_chan: Sender<ConstellationControlMsg>, script_chan: ScriptControlChan,
load_data: LoadData, load_data: LoadData,
failure: Failure, failure: Failure,
script_port: Receiver<ConstellationControlMsg>, script_port: Option<Receiver<ConstellationControlMsg>>,
paint_chan: PaintChan, paint_chan: PaintChan,
paint_port: Option<Receiver<PaintMsg>>, paint_port: Option<Receiver<PaintMsg>>,
paint_shutdown_chan: Sender<()>, paint_shutdown_chan: Sender<()>,
@ -303,8 +311,8 @@ impl PipelineContent {
self.parent_info, self.parent_info,
ScriptListener::new(script_to_compositor_chan), ScriptListener::new(script_to_compositor_chan),
&layout_pair, &layout_pair,
ScriptControlChan(self.script_chan.clone()), self.script_chan.clone(),
self.script_port, mem::replace(&mut self.script_port, None).unwrap(),
self.constellation_chan.clone(), self.constellation_chan.clone(),
self.failure.clone(), self.failure.clone(),
self.resource_task, self.resource_task,
@ -322,7 +330,7 @@ impl PipelineContent {
self.pipeline_port.unwrap(), self.pipeline_port.unwrap(),
self.constellation_chan, self.constellation_chan,
self.failure, self.failure,
ScriptControlChan(self.script_chan.clone()), self.script_chan.clone(),
self.paint_chan.clone(), self.paint_chan.clone(),
self.image_cache_task, self.image_cache_task,
self.font_cache_task, self.font_cache_task,