diff options
Diffstat (limited to 'src/components/script/script_task.rs')
-rw-r--r-- | src/components/script/script_task.rs | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/components/script/script_task.rs b/src/components/script/script_task.rs index d97db4189b6..8ca1eb4a5bf 100644 --- a/src/components/script/script_task.rs +++ b/src/components/script/script_task.rs @@ -25,11 +25,12 @@ use servo_msg::constellation_msg::{PipelineId, SubpageId}; use servo_msg::constellation_msg::{LoadIframeUrlMsg, IFrameSandboxed, IFrameUnsandboxed}; use servo_msg::constellation_msg; +use std::cell::Cell; use std::comm; use std::comm::{Port, SharedChan}; use std::io::read_whole_file; use std::ptr; -use std::task::spawn_with; +use std::task::{spawn_sched, SingleThreaded}; use std::util::replace; use dom::window::TimerData; use geom::size::Size2D; @@ -449,10 +450,14 @@ impl ScriptTask { resource_task: ResourceTask, image_cache_task: ImageCacheTask, initial_size: Future<Size2D<uint>>) { - do spawn_with((compositor, layout_chan, port, chan, constellation_chan, - resource_task, image_cache_task, initial_size)) - |(compositor, layout_chan, port, chan, constellation_chan, - resource_task, image_cache_task, initial_size)| { + let parms = Cell::new((compositor, layout_chan, port, chan, constellation_chan, + resource_task, image_cache_task, initial_size)); + // Since SpiderMonkey is blocking it needs to run in its own thread. + // If we don't do this then we'll just end up with a bunch of SpiderMonkeys + // starving all the other tasks. + do spawn_sched(SingleThreaded) { + let (compositor, layout_chan, port, chan, constellation_chan, + resource_task, image_cache_task, initial_size) = parms.take(); let script_task = ScriptTask::new(id, @compositor as @ScriptListener, layout_chan, @@ -624,7 +629,9 @@ impl ScriptTask { } } - fn handle_exit_window_msg(&mut self, _id: PipelineId) -> bool { + fn handle_exit_window_msg(&mut self, id: PipelineId) -> bool { + self.handle_exit_pipeline_msg(id); + // TODO(tkuehn): currently there is only one window, // so this can afford to be naive and just shut down the // compositor. In the future it'll need to be smarter. |