aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/main
diff options
context:
space:
mode:
authorbors-servo <release+servo@mozilla.com>2013-12-13 11:28:10 -0800
committerbors-servo <release+servo@mozilla.com>2013-12-13 11:28:10 -0800
commitaa1ebbbdb0243f098921103f02bb9b7dbcc40441 (patch)
tree03204e5058c7b16f07a3718d240d3bacfd9a0021 /src/components/main
parent499aa97fa4424cad9585e57987665542003e2597 (diff)
parent21e8c72a7526a32733453221d4ed10ac070521dd (diff)
downloadservo-aa1ebbbdb0243f098921103f02bb9b7dbcc40441.tar.gz
servo-aa1ebbbdb0243f098921103f02bb9b7dbcc40441.zip
auto merge of #1405 : pcwalton/servo/defuture, r=larsbergstrom
This will allow us to stop going to the DOM in order to handle iframe sizing. Instead we can just store the pipeline and frame IDs of iframes inside the flow tree itself. r? @kmcallister
Diffstat (limited to 'src/components/main')
-rw-r--r--src/components/main/compositing/mod.rs3
-rw-r--r--src/components/main/compositing/run.rs55
-rw-r--r--src/components/main/compositing/run_headless.rs6
-rw-r--r--src/components/main/constellation.rs102
-rw-r--r--src/components/main/layout/layout_task.rs26
-rw-r--r--src/components/main/pipeline.rs46
-rwxr-xr-xsrc/components/main/servo.rc32
7 files changed, 155 insertions, 115 deletions
diff --git a/src/components/main/compositing/mod.rs b/src/components/main/compositing/mod.rs
index 56472b895d1..9cf6df5f2aa 100644
--- a/src/components/main/compositing/mod.rs
+++ b/src/components/main/compositing/mod.rs
@@ -148,6 +148,7 @@ pub enum Msg {
pub struct CompositorTask {
opts: Opts,
port: Port<Msg>,
+ constellation_chan: ConstellationChan,
profiler_chan: ProfilerChan,
shutdown_chan: SharedChan<()>,
}
@@ -155,12 +156,14 @@ pub struct CompositorTask {
impl CompositorTask {
pub fn new(opts: Opts,
port: Port<Msg>,
+ constellation_chan: ConstellationChan,
profiler_chan: ProfilerChan,
shutdown_chan: Chan<()>)
-> CompositorTask {
CompositorTask {
opts: opts,
port: port,
+ constellation_chan: constellation_chan,
profiler_chan: profiler_chan,
shutdown_chan: SharedChan::new(shutdown_chan),
}
diff --git a/src/components/main/compositing/run.rs b/src/components/main/compositing/run.rs
index a498b7fc9b6..b8125665543 100644
--- a/src/components/main/compositing/run.rs
+++ b/src/components/main/compositing/run.rs
@@ -2,41 +2,35 @@
* 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 compositing::compositor_layer::CompositorLayer;
+use compositing::*;
use platform::{Application, Window};
-
use windowing::{ApplicationMethods, WindowEvent, WindowMethods};
use windowing::{IdleWindowEvent, ResizeWindowEvent, LoadUrlWindowEvent, MouseWindowEventClass};
use windowing::{ScrollWindowEvent, ZoomWindowEvent, NavigationWindowEvent, FinishedWindowEvent};
use windowing::{QuitWindowEvent, MouseWindowClickEvent, MouseWindowMouseDownEvent, MouseWindowMouseUpEvent};
-use servo_msg::constellation_msg::{ConstellationChan, NavigateMsg, ResizedWindowMsg, LoadUrlMsg};
-use servo_msg::constellation_msg;
-
use azure::azure_hl::SourceSurfaceMethods;
use azure::azure_hl;
-use std::comm::Port;
-use std::num::Orderable;
-use std::vec;
-use std::path::Path;
-use std::rt::io::timer::Timer;
+use extra::time::precise_time_s;
use geom::matrix::identity;
use geom::point::Point2D;
-use geom::size::Size2D;
use geom::rect::Rect;
+use geom::size::Size2D;
use layers::layers::{ContainerLayer, ContainerLayerKind};
use layers::rendergl;
use layers::scene::Scene;
use opengles::gl2;
use png;
-use servo_util::{time, url};
+use servo_msg::constellation_msg::{ConstellationChan, NavigateMsg, ResizedWindowMsg, LoadUrlMsg};
+use servo_msg::constellation_msg;
use servo_util::time::profile;
-
-use extra::future::Future;
-use extra::time::precise_time_s;
-
-use compositing::compositor_layer::CompositorLayer;
-
-use compositing::*;
+use servo_util::{time, url};
+use std::comm::Port;
+use std::num::Orderable;
+use std::path::Path;
+use std::rt::io::timer::Timer;
+use std::vec;
/// Starts the compositor, which listens for messages on the specified port.
pub fn run_compositor(compositor: &CompositorTask) {
@@ -63,7 +57,7 @@ pub fn run_compositor(compositor: &CompositorTask) {
// The root CompositorLayer
let mut compositor_layer: Option<CompositorLayer> = None;
- let mut constellation_chan: Option<ConstellationChan> = None;
+ let mut constellation_chan: ConstellationChan = compositor.constellation_chan.clone();
// Get BufferRequests from each layer.
let ask_for_tiles = || {
@@ -128,7 +122,7 @@ pub fn run_compositor(compositor: &CompositorTask) {
window_size.height as uint);
new_constellation_chan.send(ResizedWindowMsg(window_size));
- constellation_chan = Some(new_constellation_chan);
+ constellation_chan = new_constellation_chan;
}
GetGraphicsMetadata(chan) => chan.send(Some(azure_hl::current_graphics_metadata())),
@@ -252,10 +246,7 @@ pub fn run_compositor(compositor: &CompositorTask) {
if window_size != new_size {
debug!("osmain: window resized to {:u}x{:u}", width, height);
window_size = new_size;
- match constellation_chan {
- Some(ref chan) => chan.send(ResizedWindowMsg(new_size)),
- None => error!("Compositor: Received resize event without initialized layout chan"),
- }
+ constellation_chan.send(ResizedWindowMsg(new_size))
} else {
debug!("osmain: dropping window resize since size is still {:u}x{:u}", width, height);
}
@@ -267,12 +258,8 @@ pub fn run_compositor(compositor: &CompositorTask) {
Some(ref layer) => layer.pipeline.id.clone(),
None => fail!("Compositor: Received LoadUrlWindowEvent without initialized compositor layers"),
};
- match constellation_chan {
- Some(ref chan) => chan.send(LoadUrlMsg(root_pipeline_id,
- url::make_url(url_string.to_str(), None),
- Future::from_value(window_size))),
- None => error!("Compositor: Received loadurl event without initialized layout chan"),
- }
+ constellation_chan.send(LoadUrlMsg(root_pipeline_id,
+ url::make_url(url_string.to_str(), None)))
}
MouseWindowEventClass(mouse_window_event) => {
@@ -327,10 +314,7 @@ pub fn run_compositor(compositor: &CompositorTask) {
windowing::Forward => constellation_msg::Forward,
windowing::Back => constellation_msg::Back,
};
- match constellation_chan {
- Some(ref chan) => chan.send(NavigateMsg(direction)),
- None => error!("Compositor: Received navigation event without initialized layout chan"),
- }
+ constellation_chan.send(NavigateMsg(direction))
}
FinishedWindowEvent => {
@@ -403,6 +387,9 @@ pub fn run_compositor(compositor: &CompositorTask) {
if exit { done = true; }
};
+ // Tell the constellation about the initial window size.
+ constellation_chan.send(ResizedWindowMsg(window_size));
+
// Enter the main event loop.
let mut tm = Timer::new().unwrap();
while !done {
diff --git a/src/components/main/compositing/run_headless.rs b/src/components/main/compositing/run_headless.rs
index 29a8e1db96c..9c7b8c3482d 100644
--- a/src/components/main/compositing/run_headless.rs
+++ b/src/components/main/compositing/run_headless.rs
@@ -4,11 +4,17 @@
use compositing::*;
+use geom::size::Size2D;
+use servo_msg::constellation_msg::ResizedWindowMsg;
+
/// Starts the compositor, which listens for messages on the specified port.
///
/// This is the null compositor which doesn't draw anything to the screen.
/// It's intended for headless testing.
pub fn run_compositor(compositor: &CompositorTask) {
+ // Tell the constellation about the initial fake size.
+ compositor.constellation_chan.send(ResizedWindowMsg(Size2D(640u, 480u)));
+
loop {
match compositor.port.recv() {
Exit => break,
diff --git a/src/components/main/constellation.rs b/src/components/main/constellation.rs
index 43ca99a62f6..bdd1b87c8d5 100644
--- a/src/components/main/constellation.rs
+++ b/src/components/main/constellation.rs
@@ -4,28 +4,27 @@
use compositing::{CompositorChan, SetIds, SetLayerClipRect};
-use std::comm;
-use std::comm::Port;
-use std::task::spawn_with;
-use geom::size::Size2D;
+use extra::url::Url;
use geom::rect::Rect;
+use geom::size::Size2D;
use gfx::opts::Opts;
use pipeline::Pipeline;
+use script::script_task::{ResizeMsg, ResizeInactiveMsg};
use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, FailureMsg, FrameRectMsg};
-use servo_msg::constellation_msg::{IFrameSandboxState, InitLoadUrlMsg, LoadIframeUrlMsg, LoadUrlMsg};
-use servo_msg::constellation_msg::{Msg, NavigateMsg, NavigationType, IFrameUnsandboxed};
+use servo_msg::constellation_msg::{IFrameSandboxState, IFrameUnsandboxed, InitLoadUrlMsg};
+use servo_msg::constellation_msg::{LoadIframeUrlMsg, LoadUrlMsg, Msg, NavigateMsg, NavigationType};
use servo_msg::constellation_msg::{PipelineId, RendererReadyMsg, ResizedWindowMsg, SubpageId};
use servo_msg::constellation_msg;
-use script::script_task::{ResizeMsg, ResizeInactiveMsg};
use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
use servo_net::resource_task::ResourceTask;
use servo_net::resource_task;
use servo_util::time::ProfilerChan;
use servo_util::url::make_url;
+use std::comm::Port;
+use std::comm;
use std::hashmap::{HashMap, HashSet};
+use std::task::spawn_with;
use std::util::replace;
-use extra::url::Url;
-use extra::future::Future;
/// Maintains the pipelines and navigation context and grants permission to composite
pub struct Constellation {
@@ -249,18 +248,27 @@ impl NavigationContext {
}
impl Constellation {
- pub fn start(compositor_chan: CompositorChan,
+ pub fn start(constellation_port: Port<Msg>,
+ constellation_chan: ConstellationChan,
+ compositor_chan: CompositorChan,
opts: &Opts,
resource_task: ResourceTask,
image_cache_task: ImageCacheTask,
- profiler_chan: ProfilerChan)
- -> ConstellationChan {
- let (constellation_port, constellation_chan) = special_stream!(ConstellationChan);
- do spawn_with((constellation_port, constellation_chan.clone(),
- compositor_chan, resource_task, image_cache_task,
- profiler_chan, opts.clone()))
- |(constellation_port, constellation_chan, compositor_chan, resource_task,
- image_cache_task, profiler_chan, opts)| {
+ profiler_chan: ProfilerChan) {
+ do spawn_with((constellation_port,
+ constellation_chan.clone(),
+ compositor_chan,
+ resource_task,
+ image_cache_task,
+ profiler_chan,
+ opts.clone()))
+ |(constellation_port,
+ constellation_chan,
+ compositor_chan,
+ resource_task,
+ image_cache_task,
+ profiler_chan,
+ opts)| {
let mut constellation = Constellation {
chan: constellation_chan,
request_port: constellation_port,
@@ -278,7 +286,6 @@ impl Constellation {
};
constellation.run();
}
- constellation_chan
}
fn run(&mut self) {
@@ -324,32 +331,38 @@ impl Constellation {
}
// This should only be called once per constellation, and only by the browser
InitLoadUrlMsg(url) => {
+ debug!("constellation got init load URL message");
self.handle_init_load(url);
}
- // A layout assigned a size and position to a subframe. This needs to be reflected by all
- // frame trees in the navigation context containing the subframe.
+ // A layout assigned a size and position to a subframe. This needs to be reflected by
+ // all frame trees in the navigation context containing the subframe.
FrameRectMsg(pipeline_id, subpage_id, rect) => {
+ debug!("constellation got frame rect message");
self.handle_frame_rect_msg(pipeline_id, subpage_id, rect);
}
- LoadIframeUrlMsg(url, source_pipeline_id, subpage_id, size_future, sandbox) => {
- self.handle_load_iframe_url_msg(url, source_pipeline_id, subpage_id, size_future, sandbox);
+ LoadIframeUrlMsg(url, source_pipeline_id, subpage_id, sandbox) => {
+ debug!("constellation got iframe URL load message");
+ self.handle_load_iframe_url_msg(url, source_pipeline_id, subpage_id, sandbox);
}
// Load a new page, usually -- but not always -- from a mouse click or typed url
// If there is already a pending page (self.pending_frames), it will not be overridden;
// However, if the id is not encompassed by another change, it will be.
- LoadUrlMsg(source_id, url, size_future) => {
- self.handle_load_url_msg(source_id, url, size_future);
+ LoadUrlMsg(source_id, url) => {
+ debug!("constellation got URL load message");
+ self.handle_load_url_msg(source_id, url);
}
// Handle a forward or back request
NavigateMsg(direction) => {
+ debug!("constellation got navigation message");
self.handle_navigate_msg(direction);
}
// Notification that rendering has finished and is requesting permission to paint.
RendererReadyMsg(pipeline_id) => {
+ debug!("constellation got renderer ready message");
self.handle_renderer_ready_msg(pipeline_id);
}
-
ResizedWindowMsg(new_size) => {
+ debug!("constellation got window resize message");
self.handle_resized_window_msg(new_size);
}
}
@@ -375,8 +388,7 @@ impl Constellation {
self.image_cache_task.clone(),
self.resource_task.clone(),
self.profiler_chan.clone(),
- self.opts.clone(),
- Future::from_value(self.window_size));
+ self.opts.clone());
let failure = ~"about:failure";
let url = make_url(failure, None);
pipeline.load(url);
@@ -397,11 +409,10 @@ impl Constellation {
self.image_cache_task.clone(),
self.resource_task.clone(),
self.profiler_chan.clone(),
- self.opts.clone(),
- Future::from_value(self.window_size));
+ self.opts.clone());
pipeline.load(url);
- self.pending_frames.push(FrameChange{
+ self.pending_frames.push(FrameChange {
before: None,
after: @mut FrameTree {
pipeline: pipeline,
@@ -476,7 +487,6 @@ impl Constellation {
url: Url,
source_pipeline_id: PipelineId,
subpage_id: SubpageId,
- size_future: Future<Size2D<uint>>,
sandbox: IFrameSandboxState) {
// A message from the script associated with pipeline_id that it has
// parsed an iframe during html parsing. This iframe will result in a
@@ -524,8 +534,7 @@ impl Constellation {
self.image_cache_task.clone(),
self.profiler_chan.clone(),
self.opts.clone(),
- source_pipeline,
- size_future)
+ source_pipeline)
} else {
debug!("Constellation: loading cross-origin iframe at {:?}", url);
// Create a new script task if not same-origin url's
@@ -536,8 +545,7 @@ impl Constellation {
self.image_cache_task.clone(),
self.resource_task.clone(),
self.profiler_chan.clone(),
- self.opts.clone(),
- size_future)
+ self.opts.clone())
};
debug!("Constellation: sending load msg to pipeline {:?}", pipeline.id);
@@ -556,7 +564,7 @@ impl Constellation {
self.pipelines.insert(pipeline.id, pipeline);
}
- fn handle_load_url_msg(&mut self, source_id: PipelineId, url: Url, size_future: Future<Size2D<uint>>) {
+ fn handle_load_url_msg(&mut self, source_id: PipelineId, url: Url) {
debug!("Constellation: received message to load {:s}", url.to_str());
// Make sure no pending page would be overridden.
let source_frame = self.current_frame().get_ref().find(source_id).expect(
@@ -590,8 +598,7 @@ impl Constellation {
self.image_cache_task.clone(),
self.resource_task.clone(),
self.profiler_chan.clone(),
- self.opts.clone(),
- size_future);
+ self.opts.clone());
pipeline.load(url);
@@ -723,13 +730,16 @@ impl Constellation {
}
}
}
- self.grant_paint_permission(next_frame_tree, frame_change.navigation_type);
+
+ self.grant_paint_permission(next_frame_tree, frame_change.navigation_type);
}
}
+ /// Called when the window is resized.
fn handle_resized_window_msg(&mut self, new_size: Size2D<uint>) {
let mut already_seen = HashSet::new();
for &@FrameTree { pipeline: pipeline, _ } in self.current_frame().iter() {
+ debug!("constellation sending resize message to active frame");
pipeline.script_chan.send(ResizeMsg(pipeline.id, new_size));
already_seen.insert(pipeline.id);
}
@@ -737,10 +747,22 @@ impl Constellation {
.chain(self.navigation_context.next.iter()) {
let pipeline = &frame_tree.pipeline;
if !already_seen.contains(&pipeline.id) {
+ debug!("constellation sending resize message to inactive frame");
pipeline.script_chan.send(ResizeInactiveMsg(pipeline.id, new_size));
already_seen.insert(pipeline.id);
}
}
+
+ // If there are any pending outermost frames, then tell them to resize. (This is how the
+ // initial window size gets sent to the first page loaded, giving it permission to reflow.)
+ for change in self.pending_frames.iter() {
+ let frame_tree = change.after;
+ if frame_tree.parent.is_none() {
+ debug!("constellation sending resize message to pending outer frame");
+ frame_tree.pipeline.script_chan.send(ResizeMsg(frame_tree.pipeline.id, new_size))
+ }
+ }
+
self.window_size = new_size;
}
diff --git a/src/components/main/layout/layout_task.rs b/src/components/main/layout/layout_task.rs
index 3519a782607..ec82722afa0 100644
--- a/src/components/main/layout/layout_task.rs
+++ b/src/components/main/layout/layout_task.rs
@@ -295,7 +295,9 @@ impl LayoutTask {
}
}
PrepareToExitMsg(response_chan) => {
- self.prepare_to_exit(response_chan)
+ debug!("layout: PrepareToExitMsg received");
+ self.prepare_to_exit(response_chan);
+ return false
}
ExitNowMsg => {
debug!("layout: ExitNowMsg received");
@@ -312,15 +314,21 @@ impl LayoutTask {
/// response channel.
fn prepare_to_exit(&mut self, response_chan: Chan<()>) {
response_chan.send(());
- match self.port.recv() {
- ReapLayoutDataMsg(dead_layout_data) => {
- unsafe {
- self.handle_reap_layout_data(dead_layout_data)
+ loop {
+ match self.port.recv() {
+ ReapLayoutDataMsg(dead_layout_data) => {
+ unsafe {
+ self.handle_reap_layout_data(dead_layout_data)
+ }
+ }
+ ExitNowMsg => {
+ self.exit_now();
+ break
+ }
+ _ => {
+ fail!("layout: message that wasn't `ExitNowMsg` received after \
+ `PrepareToExitMsg`")
}
- }
- ExitNowMsg => self.exit_now(),
- _ => {
- fail!("layout: message that wasn't `ExitNowMsg` received after `PrepareToExitMsg`")
}
}
}
diff --git a/src/components/main/pipeline.rs b/src/components/main/pipeline.rs
index 77ac8741787..e277beccbd9 100644
--- a/src/components/main/pipeline.rs
+++ b/src/components/main/pipeline.rs
@@ -2,23 +2,22 @@
* 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 extra::url::Url;
use compositing::CompositorChan;
-use gfx::render_task::{RenderChan, RenderTask};
-use gfx::render_task::{PaintPermissionGranted, PaintPermissionRevoked};
-use gfx::opts::Opts;
use layout::layout_task::LayoutTask;
+
+use extra::url::Url;
+use gfx::opts::Opts;
+use gfx::render_task::{PaintPermissionGranted, PaintPermissionRevoked};
+use gfx::render_task::{RenderChan, RenderTask};
+use script::dom::node::AbstractNode;
use script::layout_interface::LayoutChan;
use script::script_task::LoadMsg;
-use servo_msg::constellation_msg::{ConstellationChan, FailureMsg, PipelineId, SubpageId};
-use script::dom::node::AbstractNode;
use script::script_task::{AttachLayoutMsg, NewLayoutInfo, ScriptTask, ScriptChan};
use script::script_task;
+use servo_msg::constellation_msg::{ConstellationChan, FailureMsg, PipelineId, SubpageId};
use servo_net::image_cache_task::ImageCacheTask;
use servo_net::resource_task::ResourceTask;
use servo_util::time::ProfilerChan;
-use geom::size::Size2D;
-use extra::future::Future;
use std::task;
/// A uniquely-identifiable pipeline of script task, layout task, and render task.
@@ -34,7 +33,8 @@ pub struct Pipeline {
}
impl Pipeline {
- /// Starts a render task, layout task, and script task. Returns the channels wrapped in a struct.
+ /// Starts a render task, layout task, and script task. Returns the channels wrapped in a
+ /// struct.
pub fn with_script(id: PipelineId,
subpage_id: Option<SubpageId>,
constellation_chan: ConstellationChan,
@@ -42,8 +42,8 @@ impl Pipeline {
image_cache_task: ImageCacheTask,
profiler_chan: ProfilerChan,
opts: Opts,
- script_pipeline: &Pipeline,
- size_future: Future<Size2D<uint>>) -> Pipeline {
+ script_pipeline: &Pipeline)
+ -> Pipeline {
let (layout_port, layout_chan) = special_stream!(LayoutChan);
let (render_port, render_chan) = special_stream!(RenderChan);
@@ -67,7 +67,6 @@ impl Pipeline {
old_id: script_pipeline.id.clone(),
new_id: id,
layout_chan: layout_chan.clone(),
- size_future: size_future,
};
script_pipeline.script_chan.send(AttachLayoutMsg(new_layout_info));
@@ -86,9 +85,8 @@ impl Pipeline {
image_cache_task: ImageCacheTask,
resource_task: ResourceTask,
profiler_chan: ProfilerChan,
- opts: Opts,
- size: Future<Size2D<uint>>) -> Pipeline {
-
+ opts: Opts)
+ -> Pipeline {
let (script_port, script_chan) = special_stream!(ScriptChan);
let (layout_port, layout_chan) = special_stream!(LayoutChan);
let (render_port, render_chan) = special_stream!(RenderChan);
@@ -106,9 +104,15 @@ impl Pipeline {
let task_port = supervised_task.future_result();
supervised_task.supervised();
- spawn_with!(supervised_task, [script_port, resource_task, size, render_port,
- layout_port, constellation_chan, image_cache_task,
- profiler_chan], {
+ spawn_with!(supervised_task, [
+ script_port,
+ resource_task,
+ render_port,
+ layout_port,
+ constellation_chan,
+ image_cache_task,
+ profiler_chan
+ ], {
ScriptTask::create(id,
compositor_chan.clone(),
layout_chan.clone(),
@@ -116,8 +120,7 @@ impl Pipeline {
script_chan.clone(),
constellation_chan.clone(),
resource_task,
- image_cache_task.clone(),
- size);
+ image_cache_task.clone());
RenderTask::create(id,
render_port,
@@ -187,8 +190,7 @@ impl Pipeline {
}
pub fn exit(&self) {
- // Script task handles shutting down layout,
- // and layout handles shutting down the renderer.
+ // Script task handles shutting down layout, and layout handles shutting down the renderer.
self.script_chan.try_send(script_task::ExitPipelineMsg(self.id));
}
}
diff --git a/src/components/main/servo.rc b/src/components/main/servo.rc
index f286368b332..a19c0ba6dcb 100755
--- a/src/components/main/servo.rc
+++ b/src/components/main/servo.rc
@@ -41,7 +41,7 @@ extern mod core_text = "rust-core-text";
use compositing::{CompositorChan, CompositorTask};
use constellation::Constellation;
-use servo_msg::constellation_msg::{ExitMsg, InitLoadUrlMsg};
+use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, InitLoadUrlMsg};
#[cfg(not(test))]
use gfx::opts;
@@ -127,21 +127,32 @@ fn run(opts: Opts) {
let (shutdown_port, shutdown_chan) = comm::stream();
let (profiler_port, profiler_chan) = special_stream!(ProfilerChan);
let (compositor_port, compositor_chan) = special_stream!(CompositorChan);
+ let (constellation_port, constellation_chan) = special_stream!(ConstellationChan);
Profiler::create(profiler_port, profiler_chan.clone(), opts.profiler_period);
- do spawn_with((profiler_chan.clone(), compositor_chan, opts.clone()))
- |(profiler_chan, compositor_chan, opts)| {
-
+ do spawn_with((constellation_port,
+ constellation_chan.clone(),
+ profiler_chan.clone(),
+ compositor_chan,
+ opts.clone()))
+ |(constellation_port,
+ constellation_chan,
+ profiler_chan,
+ compositor_chan,
+ opts)| {
let opts = &opts;
+
// Create a Servo instance.
let resource_task = ResourceTask();
let image_cache_task = ImageCacheTask(resource_task.clone());
- let constellation_chan = Constellation::start(compositor_chan,
- opts,
- resource_task,
- image_cache_task,
- profiler_chan.clone());
+ Constellation::start(constellation_port,
+ constellation_chan.clone(),
+ compositor_chan,
+ opts,
+ resource_task,
+ image_cache_task,
+ profiler_chan.clone());
// Send the URL command to the constellation.
for filename in opts.urls.iter() {
@@ -158,11 +169,12 @@ fn run(opts: Opts) {
exit_response_from_constellation.recv();
}
-
let compositor_task = CompositorTask::new(opts,
compositor_port,
+ constellation_chan,
profiler_chan,
shutdown_chan);
+
debug!("preparing to enter main loop");
compositor_task.run();
}