rename engine --> constellation

This commit is contained in:
Tim Kuehn 2013-06-27 17:14:56 -07:00
parent fba7ec423c
commit d17a1f2ad7
12 changed files with 66 additions and 74 deletions

View file

@ -9,7 +9,7 @@ use azure::azure_hl::{B8G8R8A8, DrawTarget};
use display_list::DisplayList;
use servo_msg::compositor::{RenderListener, IdleRenderState, RenderingRenderState, LayerBuffer};
use servo_msg::compositor::{CompositorToken, LayerBufferSet};
use servo_msg::engine::{EngineChan, TokenSurrenderMsg};
use servo_msg::constellation::{ConstellationChan, TokenSurrenderMsg};
use font_context::FontContext;
use geom::matrix2d::Matrix2D;
use geom::point::Point2D;
@ -68,8 +68,8 @@ priv struct RenderTask<C> {
/// The layer to be rendered
render_layer: Option<RenderLayer>,
/// A channel to the engine task for surrendering token
engine_chan: EngineChan,
/// A channel to the constellation for surrendering token
constellation_chan: ConstellationChan,
/// A token that grants permission to send paint messages to compositor
compositor_token: Option<~CompositorToken>,
/// Cached copy of last layers rendered
@ -80,12 +80,12 @@ impl<C: RenderListener + Owned> RenderTask<C> {
pub fn create(port: Port<Msg>,
compositor: C,
opts: Opts,
engine_chan: EngineChan,
constellation_chan: ConstellationChan,
profiler_chan: ProfilerChan) {
let compositor_cell = Cell::new(compositor);
let opts_cell = Cell::new(opts);
let port = Cell::new(port);
let engine_chan = Cell::new(engine_chan);
let constellation_chan = Cell::new(constellation_chan);
do spawn {
let compositor = compositor_cell.take();
@ -106,7 +106,7 @@ impl<C: RenderListener + Owned> RenderTask<C> {
share_gl_context: share_gl_context,
render_layer: None,
engine_chan: engine_chan.take(),
constellation_chan: constellation_chan.take(),
compositor_token: None,
next_paint_msg: None,
};
@ -140,7 +140,7 @@ impl<C: RenderListener + Owned> RenderTask<C> {
}
}
TokenProcureMsg => {
self.engine_chan.send(TokenSurrenderMsg(self.compositor_token.swap_unwrap()));
self.constellation_chan.send(TokenSurrenderMsg(self.compositor_token.swap_unwrap()));
}
ExitMsg(response_ch) => {
response_ch.send(());

View file

@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use compositing::{CompositorChan, SetLayoutChan, SetRenderChan};
use layout::layout_task;
use std::cell::Cell;
use std::comm;
@ -13,7 +12,8 @@ use gfx::opts::Opts;
use gfx::render_task::{TokenBestowMsg, TokenProcureMsg};
use pipeline::Pipeline;
use servo_msg::compositor::{CompositorToken};
use servo_msg::engine::{EngineChan, ExitMsg, LoadUrlMsg, Msg, RendererReadyMsg, TokenSurrenderMsg};
use servo_msg::constellation::{ConstellationChan, ExitMsg, LoadUrlMsg, Msg, RendererReadyMsg};
use servo_msg::constellation::TokenSurrenderMsg;
use script::script_task::{ExecuteMsg, LoadMsg};
use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
use servo_net::resource_task::ResourceTask;
@ -21,8 +21,8 @@ use servo_net::resource_task;
use servo_util::time::ProfilerChan;
use std::hashmap::HashMap;
pub struct Engine {
chan: EngineChan,
pub struct Constellation {
chan: ConstellationChan,
request_port: Port<Msg>,
compositor_chan: CompositorChan,
resource_task: ResourceTask,
@ -75,26 +75,27 @@ impl NavigationContext {
}
}
impl Engine {
impl Constellation {
pub fn start(compositor_chan: CompositorChan,
opts: &Opts,
resource_task: ResourceTask,
image_cache_task: ImageCacheTask,
profiler_chan: ProfilerChan)
-> EngineChan {
-> ConstellationChan {
let opts = Cell::new(copy *opts);
let (engine_port, engine_chan) = comm::stream();
let (engine_port, engine_chan) = (Cell::new(engine_port), EngineChan::new(engine_chan));
let (constellation_port, constellation_chan) = comm::stream();
let (constellation_port, constellation_chan) = (Cell::new(constellation_port),
ConstellationChan::new(constellation_chan));
let compositor_chan = Cell::new(compositor_chan);
let engine_chan_clone = Cell::new(engine_chan.clone());
let constellation_chan_clone = Cell::new(constellation_chan.clone());
{
do task::spawn {
let mut engine = Engine {
chan: engine_chan_clone.take(),
request_port: engine_port.take(),
let mut constellation = Constellation {
chan: constellation_chan_clone.take(),
request_port: constellation_port.take(),
compositor_chan: compositor_chan.take(),
resource_task: resource_task.clone(),
image_cache_task: image_cache_task.clone(),
@ -106,10 +107,10 @@ impl Engine {
profiler_chan: profiler_chan.clone(),
opts: opts.take(),
};
engine.run();
constellation.run();
}
}
engine_chan
constellation_chan
}
fn run(&mut self) {
@ -153,7 +154,7 @@ impl Engine {
if pipeline_id == id {
match self.current_token_holder {
Some(ref id) => {
let current_holder = self.pipelines.find(id).get();
let current_holder = self.pipelines.get(id);
current_holder.render_chan.send(TokenProcureMsg);
}
None => self.bestow_compositor_token(id, ~CompositorToken::new())
@ -164,8 +165,8 @@ impl Engine {
TokenSurrenderMsg(token) => {
self.remove_active_pipeline();
let loading = self.loading.clone();
let token = Cell::new(token);
let loading = self.loading;
do loading.map |&id| {
self.bestow_compositor_token(id, token.take());
};
@ -195,18 +196,13 @@ impl Engine {
}
fn bestow_compositor_token(&mut self, id: uint, compositor_token: ~CompositorToken) {
let pipeline = self.pipelines.find(&id);
match pipeline {
None => fail!("Id of pipeline that made token request does not have a \
corresponding struct in Engine's pipelines. This is a bug. :-("),
Some(pipeline) => {
let pipeline = self.pipelines.get(&id);
pipeline.render_chan.send(TokenBestowMsg(compositor_token));
self.compositor_chan.send(SetLayoutChan(pipeline.layout_chan.clone()));
self.compositor_chan.send(SetRenderChan(pipeline.render_chan.clone()));
self.current_token_holder = Some(id);
self.loading = None;
self.navigation_context.navigate(id);
}
}
}
}

View file

@ -6,7 +6,6 @@ use extra::net::url::Url;
use url_from_str = extra::net::url::from_str;
use std::cell::Cell;
use std::result;
use std::str;
use newcss::stylesheet::Stylesheet;
use newcss::select::SelectCtx;
use newcss::types::OriginUA;

View file

@ -6,7 +6,6 @@
/// Implementation of the callbacks that the CSS selector engine uses to query the DOM.
///
use std::str;
use std::str::eq_slice;
use newcss::select::SelectHandler;
use script::dom::node::{AbstractNode, LayoutView};

View file

@ -840,7 +840,7 @@ impl RenderBox {
pub fn dump_indent(&self, indent: uint) {
let mut string = ~"";
for uint::range(0u, indent) |_i| {
string += ~" ";
string += " ";
}
string += self.debug_str();

View file

@ -394,7 +394,7 @@ impl<'self> FlowContext {
pub fn dump_indent(&self, indent: uint) {
let mut s = ~"|";
for uint::range(0, indent) |_i| {
s += ~"---- ";
s += "---- ";
}
s += self.debug_str();
@ -412,7 +412,7 @@ impl<'self> FlowContext {
let mut s = inline.boxes.foldl(~"InlineFlow(children=", |s, box| {
fmt!("%s b%d", *s, box.id())
});
s += ~")";
s += ")";
s
},
BlockFlow(block) => {

View file

@ -16,7 +16,7 @@ use layout::flow::FlowContext;
use std::cast::transmute;
use std::cell::Cell;
use std::comm::{Chan, Port};
use std::comm::{Port};
use geom::point::Point2D;
use geom::rect::Rect;
use geom::size::Size2D;
@ -40,7 +40,7 @@ use script::script_task::{ReflowCompleteMsg, ScriptChan, ScriptMsg, SendEventMsg
use servo_net::image_cache_task::{ImageCacheTask, ImageResponseMsg};
use servo_net::local_image_cache::LocalImageCache;
use servo_util::tree::{TreeNodeRef, TreeUtils};
use servo_util::time::{ProfilerChan, profile, time};
use servo_util::time::{ProfilerChan, profile};
use servo_util::time;
use extra::net::url::Url;

View file

@ -9,7 +9,7 @@ use gfx::opts::Opts;
use layout::layout_task::LayoutTask;
use script::layout_interface::LayoutChan;
use script::layout_interface;
use servo_msg::engine::{EngineChan};
use servo_msg::constellation::{ConstellationChan};
use script::script_task::{ScriptTask, ScriptChan, ScriptMsg};
use script::script_task;
use servo_net::image_cache_task::ImageCacheTask;
@ -28,7 +28,7 @@ pub struct Pipeline {
impl Pipeline {
/// Starts a render task, layout task, and script task. Returns the channels wrapped in a struct.
pub fn create(id: uint,
engine_chan: EngineChan,
constellation_chan: ConstellationChan,
compositor_chan: CompositorChan,
image_cache_task: ImageCacheTask,
resource_task: ResourceTask,
@ -55,7 +55,7 @@ impl Pipeline {
RenderTask::create(render_port,
compositor_chan.clone(),
copy opts,
engine_chan.clone(),
constellation_chan.clone(),
profiler_chan.clone());
LayoutTask::create(layout_port,
@ -70,7 +70,7 @@ impl Pipeline {
layout_chan.clone(),
script_port,
script_chan.clone(),
engine_chan,
constellation_chan,
resource_task.clone(),
image_cache_task.clone());

View file

@ -35,8 +35,8 @@ extern mod core_graphics;
extern mod core_text;
use compositing::{CompositorChan, CompositorTask};
use engine::Engine;
use servo_msg::engine::{ExitMsg, LoadUrlMsg};
use constellation::Constellation;
use servo_msg::constellation::{ExitMsg, LoadUrlMsg};
use gfx::opts;
use servo_net::image_cache_task::ImageCacheTask;
@ -62,7 +62,7 @@ pub mod css {
pub mod node_style;
}
pub mod engine;
pub mod constellation;
pub mod pipeline;
pub mod layout {
@ -122,24 +122,24 @@ fn run(opts: &Opts) {
let resource_task = ResourceTask();
let image_cache_task = ImageCacheTask(resource_task.clone());
let engine_chan = Engine::start(compositor_chan.clone(),
let constellation_chan = Constellation::start(compositor_chan.clone(),
opts,
resource_task,
image_cache_task,
profiler_chan.clone());
// Send the URL command to the engine task.
// Send the URL command to the constellation.
for opts.urls.each |filename| {
engine_chan.send(LoadUrlMsg(make_url(copy *filename, None)))
constellation_chan.send(LoadUrlMsg(make_url(copy *filename, None)))
}
// Wait for the compositor to shut down.
shutdown_port.recv();
// Shut the engine down.
// Shut the constellation down.
debug!("master: Shut down");
let (exit_response_from_engine, exit_chan) = comm::stream();
engine_chan.send(ExitMsg(exit_chan));
exit_response_from_engine.recv();
let (exit_response_from_constellation, exit_chan) = comm::stream();
constellation_chan.send(ExitMsg(exit_chan));
exit_response_from_constellation.recv();
}

View file

@ -2,23 +2,21 @@
* 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/. */
//! The high-level interface from script to engine. Using this abstract interface helps reduce
//! The high-level interface from script to constellation. Using this abstract interface helps reduce
/// coupling between these two components
use std::comm::{Chan, SharedChan};
use extra::net::url::Url;
use compositor::CompositorToken;
pub use compositor;
#[deriving(Clone)]
pub struct EngineChan {
pub struct ConstellationChan {
chan: SharedChan<Msg>,
}
impl EngineChan {
pub fn new(chan: Chan<Msg>) -> EngineChan {
EngineChan {
impl ConstellationChan {
pub fn new(chan: Chan<Msg>) -> ConstellationChan {
ConstellationChan {
chan: SharedChan::new(chan),
}
}

View file

@ -15,4 +15,4 @@ extern mod geom;
extern mod extra;
pub mod compositor;
pub mod engine;
pub mod constellation;

View file

@ -19,7 +19,7 @@ use layout_interface::{LayoutChan, MatchSelectorsDocumentDamage, QueryMsg, Reflo
use layout_interface::{ReflowDocumentDamage, ReflowForDisplay, ReflowForScriptQuery, ReflowGoal};
use layout_interface::ReflowMsg;
use layout_interface;
use servo_msg::engine::{EngineChan, LoadUrlMsg, RendererReadyMsg};
use servo_msg::constellation::{ConstellationChan, LoadUrlMsg, RendererReadyMsg};
use std::cast::transmute;
use std::cell::Cell;
@ -59,7 +59,7 @@ pub enum ScriptMsg {
FireTimerMsg(~TimerData),
/// Notifies script that reflow is finished.
ReflowCompleteMsg,
/// Exits the engine.
/// Exits the constellation.
ExitMsg,
}
@ -112,8 +112,8 @@ pub struct ScriptTask {
/// messages.
script_chan: ScriptChan,
/// For communicating load url messages to the engine
engine_chan: EngineChan,
/// For communicating load url messages to the constellation
constellation_chan: ConstellationChan,
/// For permission to communicate ready state messages to the compositor
compositor: @ScriptListener,
@ -172,7 +172,7 @@ impl ScriptTask {
layout_chan: LayoutChan,
script_port: Port<ScriptMsg>,
script_chan: ScriptChan,
engine_chan: EngineChan,
constellation_chan: ConstellationChan,
resource_task: ResourceTask,
img_cache_task: ImageCacheTask)
-> @mut ScriptTask {
@ -199,7 +199,7 @@ impl ScriptTask {
script_port: script_port,
script_chan: script_chan,
engine_chan: engine_chan,
constellation_chan: constellation_chan,
js_runtime: js_runtime,
js_context: js_context,
@ -240,7 +240,7 @@ impl ScriptTask {
layout_chan: LayoutChan,
script_port: Port<ScriptMsg>,
script_chan: ScriptChan,
engine_chan: EngineChan,
constellation_chan: ConstellationChan,
resource_task: ResourceTask,
image_cache_task: ImageCacheTask) {
let compositor = Cell::new(compositor);
@ -254,7 +254,7 @@ impl ScriptTask {
layout_chan.clone(),
script_port.take(),
script_chan.clone(),
engine_chan.clone(),
constellation_chan.clone(),
resource_task.clone(),
image_cache_task.clone());
script_task.start();
@ -333,7 +333,7 @@ impl ScriptTask {
/// Handles a notification that reflow completed.
fn handle_reflow_complete_msg(&mut self) {
self.layout_join_port = None;
self.engine_chan.send(RendererReadyMsg(self.id));
self.constellation_chan.send(RendererReadyMsg(self.id));
self.compositor.set_ready_state(FinishedLoading);
}
@ -604,7 +604,7 @@ impl ScriptTask {
None => None
};
let url = make_url(attr.value.clone(), current_url);
self.engine_chan.send(LoadUrlMsg(url));
self.constellation_chan.send(LoadUrlMsg(url));
}
}
}