aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKeith Yeung <kungfukeith11@gmail.com>2015-11-14 16:01:34 -0800
committerKeith Yeung <kungfukeith11@gmail.com>2015-11-16 23:10:53 -0800
commit19294db6e5ffc9e85b4b628ef8dc6c72636c70a7 (patch)
tree60c26784064e9fecc12f8bd7b44686ceb7b8472a
parentafe03870ce1a5a65b4c22f2e64155259da8b4609 (diff)
downloadservo-19294db6e5ffc9e85b4b628ef8dc6c72636c70a7.tar.gz
servo-19294db6e5ffc9e85b4b628ef8dc6c72636c70a7.zip
Split ConstellationMsg into ScriptMsg and CompositorMsg
-rw-r--r--components/compositing/compositor.rs6
-rw-r--r--components/compositing/compositor_task.rs5
-rw-r--r--components/compositing/constellation.rs243
-rw-r--r--components/compositing/headless.rs4
-rw-r--r--components/compositing/pipeline.rs5
-rw-r--r--components/gfx/paint_task.rs7
-rw-r--r--components/layout/animation.rs7
-rw-r--r--components/layout/layout_task.rs10
-rw-r--r--components/layout/query.rs2
-rw-r--r--components/layout_traits/lib.rs3
-rw-r--r--components/msg/constellation_msg.rs102
-rw-r--r--components/script/clipboard_provider.rs4
-rw-r--r--components/script/dom/bindings/global.rs3
-rw-r--r--components/script/dom/bindings/trace.rs3
-rw-r--r--components/script/dom/canvasrenderingcontext2d.rs2
-rw-r--r--components/script/dom/document.rs2
-rw-r--r--components/script/dom/htmlbodyelement.rs2
-rw-r--r--components/script/dom/htmliframeelement.rs2
-rw-r--r--components/script/dom/htmlinputelement.rs3
-rw-r--r--components/script/dom/htmllinkelement.rs2
-rw-r--r--components/script/dom/htmltextareaelement.rs3
-rw-r--r--components/script/dom/webglrenderingcontext.rs2
-rw-r--r--components/script/dom/window.rs7
-rw-r--r--components/script/dom/workerglobalscope.rs7
-rw-r--r--components/script/layout_interface.rs3
-rw-r--r--components/script/script_task.rs4
-rw-r--r--components/script_traits/lib.rs3
-rw-r--r--components/servo/lib.rs8
-rw-r--r--components/webdriver_server/lib.rs9
29 files changed, 256 insertions, 207 deletions
diff --git a/components/compositing/compositor.rs b/components/compositing/compositor.rs
index 100967799fd..c251426dc48 100644
--- a/components/compositing/compositor.rs
+++ b/components/compositing/compositor.rs
@@ -28,7 +28,7 @@ use layers::scene::Scene;
use layout_traits::LayoutControlChan;
use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerKind};
use msg::compositor_msg::{LayerProperties, ScrollPolicy};
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::CompositorMsg as ConstellationMsg;
use msg::constellation_msg::{AnimationState, Image, PixelFormat};
use msg::constellation_msg::{ConstellationChan, Key, KeyModifiers, KeyState, LoadData};
use msg::constellation_msg::{NavigationDirection, PipelineId, WindowSizeData};
@@ -168,7 +168,7 @@ pub struct IOCompositor<Window: WindowMethods> {
frame_tree_id: FrameTreeId,
/// The channel on which messages can be sent to the constellation.
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
/// The channel on which messages can be sent to the time profiler.
time_profiler_chan: time::ProfilerChan,
@@ -703,7 +703,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
fn set_frame_tree(&mut self,
frame_tree: &SendableFrameTree,
response_chan: Sender<()>,
- new_constellation_chan: ConstellationChan) {
+ new_constellation_chan: ConstellationChan<ConstellationMsg>) {
response_chan.send(()).unwrap();
// There are now no more pending iframes.
diff --git a/components/compositing/compositor_task.rs b/components/compositing/compositor_task.rs
index fe8d82e26aa..70c59132b6d 100644
--- a/components/compositing/compositor_task.rs
+++ b/components/compositing/compositor_task.rs
@@ -12,6 +12,7 @@ use layers::layers::{BufferRequest, LayerBufferSet};
use layers::platform::surface::{NativeDisplay, NativeSurface};
use msg::compositor_msg::{Epoch, EventResult, FrameTreeId, LayerId, LayerProperties};
use msg::compositor_msg::{PaintListener, ScriptToCompositorMsg};
+use msg::constellation_msg::CompositorMsg as ConstellationMsg;
use msg::constellation_msg::{AnimationState, ConstellationChan, PipelineId};
use msg::constellation_msg::{Image, Key, KeyModifiers, KeyState};
use profile_traits::mem;
@@ -179,7 +180,7 @@ pub enum Msg {
/// Alerts the compositor that the given pipeline has changed whether it is running animations.
ChangeRunningAnimationsState(PipelineId, AnimationState),
/// Replaces the current frame tree, typically called during main frame navigation.
- SetFrameTree(SendableFrameTree, Sender<()>, ConstellationChan),
+ SetFrameTree(SendableFrameTree, Sender<()>, ConstellationChan<ConstellationMsg>),
/// The load of a page has begun: (can go back, can go forward).
LoadStart(bool, bool),
/// The load of a page has completed: (can go back, can go forward).
@@ -295,7 +296,7 @@ pub struct InitialCompositorState {
/// A port on which messages inbound to the compositor can be received.
pub receiver: Box<CompositorReceiver>,
/// A channel to the constellation.
- pub constellation_chan: ConstellationChan,
+ pub constellation_chan: ConstellationChan<ConstellationMsg>,
/// A channel to the time profiler thread.
pub time_profiler_chan: time::ProfilerChan,
/// A channel to the memory profiler thread.
diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs
index 92e6d768bdd..8d8d24d050a 100644
--- a/components/compositing/constellation.rs
+++ b/components/compositing/constellation.rs
@@ -14,7 +14,7 @@ use canvas::webgl_paint_task::WebGLPaintTask;
use canvas_traits::CanvasMsg;
use clipboard::ClipboardContext;
use compositor_task::CompositorProxy;
-use compositor_task::Msg as CompositorMsg;
+use compositor_task::Msg as ToCompositorMsg;
use devtools_traits::{ChromeToDevtoolsControlMsg, DevtoolsControlMsg};
use euclid::scale_factor::ScaleFactor;
use euclid::size::{Size2D, TypedSize2D};
@@ -23,7 +23,8 @@ use ipc_channel::ipc::{self, IpcSender};
use layout_traits::{LayoutControlChan, LayoutTaskFactory};
use msg::compositor_msg::Epoch;
use msg::constellation_msg::AnimationState;
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::CompositorMsg as FromCompositorMsg;
+use msg::constellation_msg::ScriptMsg as FromScriptMsg;
use msg::constellation_msg::WebDriverCommandMsg;
use msg::constellation_msg::{FrameId, PipelineId};
use msg::constellation_msg::{IframeLoadInfo, IFrameSandboxState, MozBrowserEvent, NavigationDirection};
@@ -75,16 +76,16 @@ enum ReadyToSave {
/// the `script` crate).
pub struct Constellation<LTF, STF> {
/// A channel through which script messages can be sent to this object.
- pub script_sender: ConstellationChan,
+ pub script_sender: ConstellationChan<FromScriptMsg>,
/// A channel through which compositor messages can be sent to this object.
- pub compositor_sender: ConstellationChan,
+ pub compositor_sender: ConstellationChan<FromCompositorMsg>,
/// Receives messages from scripts.
- pub script_receiver: Receiver<ConstellationMsg>,
+ pub script_receiver: Receiver<FromScriptMsg>,
/// Receives messages from the compositor
- pub compositor_receiver: Receiver<ConstellationMsg>,
+ pub compositor_receiver: Receiver<FromCompositorMsg>,
/// A channel (the implementation of which is port-specific) through which messages can be sent
/// to the compositor.
@@ -259,14 +260,13 @@ enum ExitPipelineMode {
}
impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
- pub fn start(state: InitialConstellationState) -> ConstellationChan {
- let (script_receiver, script_sender) = ConstellationChan::new();
- let (compositor_receiver, compositor_sender) = ConstellationChan::new();
- let script_sender_clone = script_sender.clone();
+ pub fn start(state: InitialConstellationState) -> ConstellationChan<FromCompositorMsg> {
+ let (script_receiver, script_sender) = ConstellationChan::<FromScriptMsg>::new();
+ let (compositor_receiver, compositor_sender) = ConstellationChan::<FromCompositorMsg>::new();
let compositor_sender_clone = compositor_sender.clone();
spawn_named("Constellation".to_owned(), move || {
let mut constellation: Constellation<LTF, STF> = Constellation {
- script_sender: script_sender_clone,
+ script_sender: script_sender,
compositor_sender: compositor_sender_clone,
script_receiver: script_receiver,
compositor_receiver: compositor_receiver,
@@ -313,18 +313,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
compositor_sender
}
-#[allow(unsafe_code)]
fn run(&mut self) {
loop {
- let request = {
- let receiver_from_script = &self.script_receiver;
- let receiver_from_compositor = &self.compositor_receiver;
- select! {
- msg = receiver_from_script.recv() => msg.unwrap(),
- msg = receiver_from_compositor.recv() => msg.unwrap()
- }
- };
- if !self.handle_request(request) {
+ if !self.handle_request() {
break;
}
}
@@ -420,104 +411,155 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
/// Handles loading pages, navigation, and granting access to the compositor
- fn handle_request(&mut self, request: ConstellationMsg) -> bool {
+ #[allow(unsafe_code)]
+ fn handle_request(&mut self) -> bool {
+ enum Request {
+ Script(FromScriptMsg),
+ Compositor(FromCompositorMsg)
+ }
+
+ let request = {
+ let receiver_from_script = &self.script_receiver;
+ let receiver_from_compositor = &self.compositor_receiver;
+ select! {
+ msg = receiver_from_script.recv() =>
+ Request::Script(msg.unwrap()),
+ msg = receiver_from_compositor.recv() =>
+ Request::Compositor(msg.unwrap())
+ }
+ };
+
match request {
- ConstellationMsg::Exit => {
+ // Messages from compositor
+
+
+ Request::Compositor(FromCompositorMsg::Exit) => {
debug!("constellation exiting");
self.handle_exit();
return false;
}
- ConstellationMsg::Failure(Failure { pipeline_id, parent_info }) => {
- self.handle_failure_msg(pipeline_id, parent_info);
+ // The compositor discovered the size of a subframe. This needs to be reflected by all
+ // frame trees in the navigation context containing the subframe.
+ Request::Compositor(FromCompositorMsg::FrameSize(pipeline_id, size)) => {
+ debug!("constellation got frame size message");
+ self.handle_frame_size_msg(pipeline_id, &Size2D::from_untyped(&size));
+ }
+ Request::Compositor(FromCompositorMsg::GetFrame(pipeline_id, resp_chan)) => {
+ debug!("constellation got get root pipeline message");
+ self.handle_get_frame(pipeline_id, resp_chan);
+ }
+ Request::Compositor(FromCompositorMsg::GetPipeline(frame_id, resp_chan)) => {
+ debug!("constellation got get root pipeline message");
+ self.handle_get_pipeline(frame_id, resp_chan);
+ }
+ Request::Compositor(FromCompositorMsg::GetPipelineTitle(pipeline_id)) => {
+ debug!("constellation got get-pipeline-title message");
+ self.handle_get_pipeline_title_msg(pipeline_id);
+ }
+ Request::Compositor(FromCompositorMsg::KeyEvent(key, state, modifiers)) => {
+ debug!("constellation got key event message");
+ self.handle_key_msg(key, state, modifiers);
+ }
+ // Load a new page from a 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.
+ Request::Compositor(FromCompositorMsg::LoadUrl(source_id, load_data)) => {
+ debug!("constellation got URL load message from compositor");
+ self.handle_load_url_msg(source_id, load_data);
+ }
+ Request::Compositor(FromCompositorMsg::IsReadyToSaveImage(pipeline_states)) => {
+ let is_ready = self.handle_is_ready_to_save_image(pipeline_states);
+ if opts::get().is_running_problem_test {
+ println!("got ready to save image query, result is {:?}", is_ready);
+ }
+ let is_ready = is_ready == ReadyToSave::Ready;
+ self.compositor_proxy.send(ToCompositorMsg::IsReadyToSaveImageReply(is_ready));
+ if opts::get().is_running_problem_test {
+ println!("sent response");
+ }
}
// This should only be called once per constellation, and only by the browser
- ConstellationMsg::InitLoadUrl(url) => {
+ Request::Compositor(FromCompositorMsg::InitLoadUrl(url)) => {
debug!("constellation got init load URL message");
self.handle_init_load(url);
}
- // The compositor discovered the size of a subframe. This needs to be reflected by all
- // frame trees in the navigation context containing the subframe.
- ConstellationMsg::FrameSize(pipeline_id, size) => {
- debug!("constellation got frame size message");
- self.handle_frame_size_msg(pipeline_id, &Size2D::from_untyped(&size));
+ // Handle a forward or back request
+ Request::Compositor(FromCompositorMsg::Navigate(pipeline_info, direction)) => {
+ debug!("constellation got navigation message from compositor");
+ self.handle_navigate_msg(pipeline_info, direction);
+ }
+ Request::Compositor(FromCompositorMsg::ResizedWindow(new_size)) => {
+ debug!("constellation got window resize message");
+ self.handle_resized_window_msg(new_size);
+ }
+ Request::Compositor(FromCompositorMsg::TickAnimation(pipeline_id)) => {
+ self.handle_tick_animation(pipeline_id)
+ }
+ Request::Compositor(FromCompositorMsg::WebDriverCommand(command)) => {
+ debug!("constellation got webdriver command message");
+ self.handle_webdriver_msg(command);
+ }
+
+
+ // Messages from script
+
+
+ Request::Script(FromScriptMsg::Failure(Failure { pipeline_id, parent_info })) => {
+ self.handle_failure_msg(pipeline_id, parent_info);
}
- ConstellationMsg::ScriptLoadedURLInIFrame(load_info) => {
+ Request::Script(FromScriptMsg::ScriptLoadedURLInIFrame(load_info)) => {
debug!("constellation got iframe URL load message {:?} {:?} {:?}",
load_info.containing_pipeline_id,
load_info.old_subpage_id,
load_info.new_subpage_id);
self.handle_script_loaded_url_in_iframe_msg(load_info);
}
- ConstellationMsg::SetCursor(cursor) => {
+ Request::Script(FromScriptMsg::SetCursor(cursor)) => {
self.handle_set_cursor_msg(cursor)
}
- ConstellationMsg::ChangeRunningAnimationsState(pipeline_id, animation_state) => {
+ Request::Script(FromScriptMsg::ChangeRunningAnimationsState(pipeline_id, animation_state)) => {
self.handle_change_running_animations_state(pipeline_id, animation_state)
}
- ConstellationMsg::TickAnimation(pipeline_id) => {
- self.handle_tick_animation(pipeline_id)
- }
- // Load a new page, usually -- but not always -- from a mouse click or typed url
+ // Load a new page from a mouse click
// 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.
- ConstellationMsg::LoadUrl(source_id, load_data) => {
- debug!("constellation got URL load message");
+ Request::Script(FromScriptMsg::LoadUrl(source_id, load_data)) => {
+ debug!("constellation got URL load message from script");
self.handle_load_url_msg(source_id, load_data);
}
- // A page loaded through one of several methods above has completed all parsing,
- // script, and reflow messages have been sent.
- ConstellationMsg::LoadComplete(pipeline_id) => {
+ // A page loaded has completed all parsing, script, and reflow messages have been sent.
+ Request::Script(FromScriptMsg::LoadComplete(pipeline_id)) => {
debug!("constellation got load complete message");
self.handle_load_complete_msg(&pipeline_id)
}
// The DOM load event fired on a document
- ConstellationMsg::DOMLoad(pipeline_id) => {
+ Request::Script(FromScriptMsg::DOMLoad(pipeline_id)) => {
debug!("constellation got dom load message");
self.handle_dom_load(pipeline_id)
}
// Handle a forward or back request
- ConstellationMsg::Navigate(pipeline_info, direction) => {
- debug!("constellation got navigation message");
+ Request::Script(FromScriptMsg::Navigate(pipeline_info, direction)) => {
+ debug!("constellation got navigation message from script");
self.handle_navigate_msg(pipeline_info, direction);
}
// Notification that painting has finished and is requesting permission to paint.
- ConstellationMsg::PainterReady(pipeline_id) => {
+ Request::Script(FromScriptMsg::PainterReady(pipeline_id)) => {
debug!("constellation got painter ready message");
self.handle_painter_ready_msg(pipeline_id);
}
- ConstellationMsg::ResizedWindow(new_size) => {
- debug!("constellation got window resize message");
- self.handle_resized_window_msg(new_size);
- }
- ConstellationMsg::KeyEvent(key, state, modifiers) => {
- debug!("constellation got key event message");
- self.handle_key_msg(key, state, modifiers);
- }
- ConstellationMsg::GetPipelineTitle(pipeline_id) => {
- debug!("constellation got get-pipeline-title message");
- self.handle_get_pipeline_title_msg(pipeline_id);
- }
- ConstellationMsg::MozBrowserEvent(pipeline_id,
+ Request::Script(FromScriptMsg::MozBrowserEvent(pipeline_id,
subpage_id,
- event) => {
+ event)) => {
debug!("constellation got mozbrowser event message");
self.handle_mozbrowser_event_msg(pipeline_id,
subpage_id,
event);
}
- ConstellationMsg::GetPipeline(frame_id, resp_chan) => {
- debug!("constellation got get root pipeline message");
- self.handle_get_pipeline(frame_id, resp_chan);
- }
- ConstellationMsg::GetFrame(pipeline_id, resp_chan) => {
- debug!("constellation got get root pipeline message");
- self.handle_get_frame(pipeline_id, resp_chan);
- }
- ConstellationMsg::Focus(pipeline_id) => {
+ Request::Script(FromScriptMsg::Focus(pipeline_id)) => {
debug!("constellation got focus message");
self.handle_focus_msg(pipeline_id);
}
- ConstellationMsg::GetClipboardContents(sender) => {
+ Request::Script(FromScriptMsg::GetClipboardContents(sender)) => {
let result = self.clipboard_ctx.as_ref().map_or(
"".to_owned(),
|ctx| ctx.get_contents().unwrap_or_else(|e| {
@@ -527,55 +569,40 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
);
sender.send(result).unwrap();
}
- ConstellationMsg::SetClipboardContents(s) => {
+ Request::Script(FromScriptMsg::SetClipboardContents(s)) => {
if let Some(ref mut ctx) = self.clipboard_ctx {
if let Err(e) = ctx.set_contents(s) {
debug!("Error setting clipboard contents ({})", e);
}
}
}
- ConstellationMsg::WebDriverCommand(command) => {
- debug!("constellation got webdriver command message");
- self.handle_webdriver_msg(command);
- }
- ConstellationMsg::ViewportConstrained(pipeline_id, constraints) => {
+ Request::Script(FromScriptMsg::ViewportConstrained(pipeline_id, constraints)) => {
debug!("constellation got viewport-constrained event message");
self.handle_viewport_constrained_msg(pipeline_id, constraints);
}
- ConstellationMsg::IsReadyToSaveImage(pipeline_states) => {
- let is_ready = self.handle_is_ready_to_save_image(pipeline_states);
- if opts::get().is_running_problem_test {
- println!("got ready to save image query, result is {:?}", is_ready);
- }
- let is_ready = is_ready == ReadyToSave::Ready;
- self.compositor_proxy.send(CompositorMsg::IsReadyToSaveImageReply(is_ready));
- if opts::get().is_running_problem_test {
- println!("sent response");
- }
- }
- ConstellationMsg::RemoveIFrame(pipeline_id) => {
+ Request::Script(FromScriptMsg::RemoveIFrame(pipeline_id)) => {
debug!("constellation got remove iframe message");
self.handle_remove_iframe_msg(pipeline_id);
}
- ConstellationMsg::NewFavicon(url) => {
+ Request::Script(FromScriptMsg::NewFavicon(url)) => {
debug!("constellation got new favicon message");
- self.compositor_proxy.send(CompositorMsg::NewFavicon(url));
+ self.compositor_proxy.send(ToCompositorMsg::NewFavicon(url));
}
- ConstellationMsg::HeadParsed => {
+ Request::Script(FromScriptMsg::HeadParsed) => {
debug!("constellation got head parsed message");
- self.compositor_proxy.send(CompositorMsg::HeadParsed);
+ self.compositor_proxy.send(ToCompositorMsg::HeadParsed);
}
- ConstellationMsg::CreateCanvasPaintTask(size, sender) => {
+ Request::Script(FromScriptMsg::CreateCanvasPaintTask(size, sender)) => {
debug!("constellation got create-canvas-paint-task message");
self.handle_create_canvas_paint_task_msg(&size, sender)
}
- ConstellationMsg::CreateWebGLPaintTask(size, attributes, sender) => {
+ Request::Script(FromScriptMsg::CreateWebGLPaintTask(size, attributes, sender)) => {
debug!("constellation got create-WebGL-paint-task message");
self.handle_create_webgl_paint_task_msg(&size, attributes, sender)
}
- ConstellationMsg::NodeStatus(message) => {
+ Request::Script(FromScriptMsg::NodeStatus(message)) => {
debug!("constellation got NodeStatus message");
- self.compositor_proxy.send(CompositorMsg::Status(message));
+ self.compositor_proxy.send(ToCompositorMsg::Status(message));
}
}
true
@@ -593,7 +620,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
});
self.storage_task.send(StorageTaskMsg::Exit).unwrap();
self.font_cache_task.exit();
- self.compositor_proxy.send(CompositorMsg::ShutdownComplete);
+ self.compositor_proxy.send(ToCompositorMsg::ShutdownComplete);
}
fn handle_failure_msg(&mut self,
@@ -643,7 +670,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.new_pipeline(root_pipeline_id, None, Some(window_size), None, LoadData::new(url.clone()));
self.handle_load_start_msg(&root_pipeline_id);
self.push_pending_frame(root_pipeline_id, None);
- self.compositor_proxy.send(CompositorMsg::ChangePageUrl(root_pipeline_id, url));
+ self.compositor_proxy.send(ToCompositorMsg::ChangePageUrl(root_pipeline_id, url));
}
fn handle_frame_size_msg(&mut self,
@@ -719,13 +746,13 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
}
fn handle_set_cursor_msg(&mut self, cursor: Cursor) {
- self.compositor_proxy.send(CompositorMsg::SetCursor(cursor))
+ self.compositor_proxy.send(ToCompositorMsg::SetCursor(cursor))
}
fn handle_change_running_animations_state(&mut self,
pipeline_id: PipelineId,
animation_state: AnimationState) {
- self.compositor_proxy.send(CompositorMsg::ChangeRunningAnimationsState(pipeline_id,
+ self.compositor_proxy.send(ToCompositorMsg::ChangeRunningAnimationsState(pipeline_id,
animation_state))
}
@@ -789,7 +816,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
if let Some(id) = self.pipeline_to_frame_map.get(pipeline_id) {
let forward = !self.frame(*id).next.is_empty();
let back = !self.frame(*id).prev.is_empty();
- self.compositor_proxy.send(CompositorMsg::LoadStart(back, forward));
+ self.compositor_proxy.send(ToCompositorMsg::LoadStart(back, forward));
}
}
@@ -804,7 +831,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let forward = !self.frame(frame_id).next.is_empty();
let back = !self.frame(frame_id).prev.is_empty();
- self.compositor_proxy.send(CompositorMsg::LoadComplete(back, forward));
+ self.compositor_proxy.send(ToCompositorMsg::LoadComplete(back, forward));
}
fn handle_dom_load(&mut self,
@@ -920,7 +947,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
ConstellationControlMsg::SendEvent(pipeline.id, event)).unwrap();
}
None => {
- let event = CompositorMsg::KeyEvent(key, state, mods);
+ let event = ToCompositorMsg::KeyEvent(key, state, mods);
self.compositor_proxy.clone_compositor_proxy().send(event);
}
}
@@ -928,7 +955,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
fn handle_get_pipeline_title_msg(&mut self, pipeline_id: PipelineId) {
match self.pipelines.get(&pipeline_id) {
- None => self.compositor_proxy.send(CompositorMsg::ChangePageTitle(pipeline_id, None)),
+ None => self.compositor_proxy.send(ToCompositorMsg::ChangePageTitle(pipeline_id, None)),
Some(pipeline) => {
pipeline.script_chan.send(ConstellationControlMsg::GetTitle(pipeline_id)).unwrap();
}
@@ -1062,7 +1089,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
frame.current
});
if Some(pipeline_id) == current_pipeline_id {
- self.compositor_proxy.send(CompositorMsg::CreatePng(reply));
+ self.compositor_proxy.send(ToCompositorMsg::CreatePng(reply));
} else {
reply.send(None).unwrap();
}
@@ -1223,7 +1250,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
fn handle_viewport_constrained_msg(&mut self,
pipeline_id: PipelineId,
constraints: ViewportConstraints) {
- self.compositor_proxy.send(CompositorMsg::ViewportConstrained(pipeline_id, constraints));
+ self.compositor_proxy.send(ToCompositorMsg::ViewportConstrained(pipeline_id, constraints));
}
/// Checks the state of all script and layout pipelines to see if they are idle
@@ -1419,7 +1446,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
let frame_tree = self.frame_to_sendable(root_frame_id);
let (chan, port) = channel();
- self.compositor_proxy.send(CompositorMsg::SetFrameTree(frame_tree,
+ self.compositor_proxy.send(ToCompositorMsg::SetFrameTree(frame_tree,
chan,
self.compositor_sender.clone()));
if port.recv().is_err() {
diff --git a/components/compositing/headless.rs b/components/compositing/headless.rs
index 1db4d7b7ad5..52435af0cd7 100644
--- a/components/compositing/headless.rs
+++ b/components/compositing/headless.rs
@@ -7,7 +7,7 @@ use compositor_task::{InitialCompositorState, Msg};
use euclid::scale_factor::ScaleFactor;
use euclid::{Point2D, Size2D};
use msg::constellation_msg::AnimationState;
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::CompositorMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, WindowSizeData};
use profile_traits::mem;
use profile_traits::time;
@@ -22,7 +22,7 @@ pub struct NullCompositor {
/// The port on which we receive messages.
pub port: Box<CompositorReceiver>,
/// A channel to the constellation.
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
/// A channel to the time profiler.
time_profiler_chan: time::ProfilerChan,
/// A channel to the memory profiler.
diff --git a/components/compositing/pipeline.rs b/components/compositing/pipeline.rs
index febd879768e..8742898eaa4 100644
--- a/components/compositing/pipeline.rs
+++ b/components/compositing/pipeline.rs
@@ -14,6 +14,7 @@ use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use ipc_channel::router::ROUTER;
use layers::geometry::DevicePixel;
use layout_traits::{LayoutControlChan, LayoutTaskFactory};
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, Failure, FrameId, PipelineId, SubpageId};
use msg::constellation_msg::{LoadData, MozBrowserEvent, WindowSizeData};
use msg::constellation_msg::{PipelineNamespaceId};
@@ -78,7 +79,7 @@ pub struct InitialPipelineState {
/// If `None`, this is the root.
pub parent_info: Option<(PipelineId, SubpageId)>,
/// A channel to the associated constellation.
- pub constellation_chan: ConstellationChan,
+ pub constellation_chan: ConstellationChan<ConstellationMsg>,
/// A channel to schedule timer events.
pub scheduler_chan: IpcSender<TimerEventRequest>,
/// A channel to the compositor.
@@ -317,7 +318,7 @@ impl Pipeline {
pub struct PipelineContent {
id: PipelineId,
parent_info: Option<(PipelineId, SubpageId)>,
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
scheduler_chan: IpcSender<TimerEventRequest>,
compositor_proxy: Box<CompositorProxy + Send + 'static>,
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs
index a44e1bd4d54..82b0e75d284 100644
--- a/components/gfx/paint_task.rs
+++ b/components/gfx/paint_task.rs
@@ -21,7 +21,7 @@ use layers::layers::{BufferRequest, LayerBuffer, LayerBufferSet};
use layers::platform::surface::{NativeDisplay, NativeSurface};
use msg::compositor_msg::{Epoch, FrameTreeId, LayerId, LayerKind, LayerProperties};
use msg::compositor_msg::{PaintListener, ScrollPolicy};
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use paint_context::PaintContext;
use profile_traits::mem::{self, ReportsChan};
@@ -214,7 +214,7 @@ pub struct PaintTask<C> {
layout_to_paint_port: Receiver<LayoutToPaintMsg>,
chrome_to_paint_port: Receiver<ChromeToPaintMsg>,
compositor: C,
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
/// A channel to the time profiler.
time_profiler_chan: time::ProfilerChan,
@@ -250,7 +250,7 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
layout_to_paint_port: Receiver<LayoutToPaintMsg>,
chrome_to_paint_port: Receiver<ChromeToPaintMsg>,
compositor: C,
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
font_cache_task: FontCacheTask,
failure_msg: Failure,
time_profiler_chan: time::ProfilerChan,
@@ -268,7 +268,6 @@ impl<C> PaintTask<C> where C: PaintListener + Send + 'static {
font_cache_task,
time_profiler_chan.clone());
- // FIXME: rust/#5967
let mut paint_task = PaintTask {
id: id,
_url: url,
diff --git a/components/layout/animation.rs b/components/layout/animation.rs
index 84b7a30479f..f3e01c20b8c 100644
--- a/components/layout/animation.rs
+++ b/components/layout/animation.rs
@@ -8,7 +8,8 @@ use clock_ticks;
use flow::{self, Flow};
use gfx::display_list::OpaqueNode;
use incremental::{self, RestyleDamage};
-use msg::constellation_msg::{AnimationState, ConstellationChan, Msg, PipelineId};
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
+use msg::constellation_msg::{AnimationState, ConstellationChan, PipelineId};
use script::layout_interface::Animation;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
@@ -48,7 +49,7 @@ pub fn start_transitions_if_applicable(new_animations_sender: &Mutex<Sender<Anim
/// Processes any new animations that were discovered after style recalculation.
/// Also expire any old animations that have completed.
-pub fn update_animation_state(constellation_chan: &ConstellationChan,
+pub fn update_animation_state(constellation_chan: &ConstellationChan<ConstellationMsg>,
running_animations: &mut Arc<HashMap<OpaqueNode, Vec<Animation>>>,
new_animations_receiver: &Receiver<Animation>,
pipeline_id: PipelineId) {
@@ -100,7 +101,7 @@ pub fn update_animation_state(constellation_chan: &ConstellationChan,
}
constellation_chan.0
- .send(Msg::ChangeRunningAnimationsState(pipeline_id, animation_state))
+ .send(ConstellationMsg::ChangeRunningAnimationsState(pipeline_id, animation_state))
.unwrap();
}
diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs
index 7975dd08685..0aed4e6c9c0 100644
--- a/components/layout/layout_task.rs
+++ b/components/layout/layout_task.rs
@@ -37,7 +37,7 @@ use layout_debug;
use layout_traits::LayoutTaskFactory;
use log;
use msg::compositor_msg::{Epoch, LayerId, ScrollPolicy};
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use net_traits::image_cache_task::{ImageCacheChan, ImageCacheResult, ImageCacheTask};
use opaque_node::OpaqueNodeMethods;
@@ -95,7 +95,7 @@ const DISPLAY_PORT_THRESHOLD_SIZE_FACTOR: i32 = 4;
/// This needs to be protected by a mutex so we can do fast RPCs.
pub struct LayoutTaskData {
/// The channel on which messages can be sent to the constellation.
- pub constellation_chan: ConstellationChan,
+ pub constellation_chan: ConstellationChan<ConstellationMsg>,
/// The root stacking context.
pub stacking_context: Option<Arc<StackingContext>>,
@@ -149,7 +149,7 @@ pub struct LayoutTask {
font_cache_sender: Sender<()>,
/// The channel on which messages can be sent to the constellation.
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
/// The channel on which messages can be sent to the script task.
script_chan: Sender<ConstellationControlMsg>,
@@ -226,7 +226,7 @@ impl LayoutTaskFactory for LayoutTask {
is_iframe: bool,
chan: OpaqueScriptLayoutChannel,
pipeline_port: IpcReceiver<LayoutControlMsg>,
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
failure_msg: Failure,
script_chan: Sender<ConstellationControlMsg>,
paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
@@ -354,7 +354,7 @@ impl LayoutTask {
is_iframe: bool,
port: Receiver<Msg>,
pipeline_port: IpcReceiver<LayoutControlMsg>,
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
script_chan: Sender<ConstellationControlMsg>,
paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
image_cache_task: ImageCacheTask,
diff --git a/components/layout/query.rs b/components/layout/query.rs
index 9057ac91967..c1aa95859c9 100644
--- a/components/layout/query.rs
+++ b/components/layout/query.rs
@@ -12,7 +12,7 @@ use fragment::{Fragment, FragmentBorderBoxIterator};
use gfx::display_list::{DisplayItemMetadata, OpaqueNode};
use layout_task::LayoutTaskData;
use msg::constellation_msg::ConstellationChan;
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use opaque_node::OpaqueNodeMethods;
use script::layout_interface::{ContentBoxResponse, ContentBoxesResponse, NodeGeometryResponse};
use script::layout_interface::{HitTestResponse, LayoutRPC, MouseOverResponse, OffsetParentResponse};
diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs
index 025713894e2..9205d420583 100644
--- a/components/layout_traits/lib.rs
+++ b/components/layout_traits/lib.rs
@@ -24,6 +24,7 @@ extern crate util;
use gfx::font_cache_task::FontCacheTask;
use gfx::paint_task::LayoutToPaintMsg;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use net_traits::image_cache_task::ImageCacheTask;
use profile_traits::{mem, time};
@@ -46,7 +47,7 @@ pub trait LayoutTaskFactory {
is_iframe: bool,
chan: OpaqueScriptLayoutChannel,
pipeline_port: IpcReceiver<LayoutControlMsg>,
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
failure_msg: Failure,
script_chan: Sender<ConstellationControlMsg>,
layout_to_paint_chan: OptionalIpcSender<LayoutToPaintMsg>,
diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs
index 7487fede8c2..59da1f175db 100644
--- a/components/msg/constellation_msg.rs
+++ b/components/msg/constellation_msg.rs
@@ -25,16 +25,21 @@ use util::geometry::{PagePx, ViewportPx};
use util::mem::HeapSizeOf;
use webdriver_msg::{LoadStatus, WebDriverScriptCommand};
-#[derive(Clone)]
-pub struct ConstellationChan(pub Sender<Msg>);
+pub struct ConstellationChan<T>(pub Sender<T>);
-impl ConstellationChan {
- pub fn new() -> (Receiver<Msg>, ConstellationChan) {
+impl<T> ConstellationChan<T> {
+ pub fn new() -> (Receiver<T>, ConstellationChan<T>) {
let (chan, port) = channel();
(port, ConstellationChan(chan))
}
}
+impl<T> Clone for ConstellationChan<T> {
+ fn clone(&self) -> ConstellationChan<T> {
+ ConstellationChan(self.0.clone())
+ }
+}
+
#[derive(PartialEq, Eq, Copy, Clone, Debug, Deserialize, Serialize)]
pub enum IFrameSandboxState {
IFrameSandboxed,
@@ -229,57 +234,38 @@ pub struct IframeLoadInfo {
pub sandbox: IFrameSandboxState,
}
-/// Messages from the compositor and script to the constellation.
+/// Messages from the compositor to the constellation.
#[derive(Deserialize, Serialize)]
-pub enum Msg {
+pub enum CompositorMsg {
Exit,
- Failure(Failure),
- InitLoadUrl(Url),
- LoadComplete(PipelineId),
- /// Dispatched after the DOM load event has fired on a document
- DOMLoad(PipelineId),
FrameSize(PipelineId, Size2D<f32>),
- LoadUrl(PipelineId, LoadData),
- ScriptLoadedURLInIFrame(IframeLoadInfo),
- Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection),
- PainterReady(PipelineId),
- ResizedWindow(WindowSizeData),
- KeyEvent(Key, KeyState, KeyModifiers),
+ /// Request that the constellation send the FrameId corresponding to the document
+ /// with the provided pipeline id
+ GetFrame(PipelineId, IpcSender<Option<FrameId>>),
+ /// Request that the constellation send the current pipeline id for the provided frame
+ /// id, or for the root frame if this is None, over a provided channel
+ GetPipeline(Option<FrameId>, IpcSender<Option<PipelineId>>),
/// Requests that the constellation inform the compositor of the title of the pipeline
/// immediately.
GetPipelineTitle(PipelineId),
- /// Requests that the constellation inform the compositor of the a cursor change.
- SetCursor(Cursor),
- /// Dispatch a mozbrowser event to a given iframe. Only available in experimental mode.
- MozBrowserEvent(PipelineId, SubpageId, MozBrowserEvent),
- /// Indicates whether this pipeline is currently running animations.
- ChangeRunningAnimationsState(PipelineId, AnimationState),
+ InitLoadUrl(Url),
+ /// Query the constellation to see if the current compositor output is stable
+ IsReadyToSaveImage(HashMap<PipelineId, Epoch>),
+ KeyEvent(Key, KeyState, KeyModifiers),
+ LoadUrl(PipelineId, LoadData),
+ Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection),
+ ResizedWindow(WindowSizeData),
/// Requests that the constellation instruct layout to begin a new tick of the animation.
TickAnimation(PipelineId),
- /// Request that the constellation send the current pipeline id for the provided frame
- /// id, or for the root frame if this is None, over a provided channel
- GetPipeline(Option<FrameId>, IpcSender<Option<PipelineId>>),
- /// Request that the constellation send the FrameId corresponding to the document
- /// with the provided pipeline id
- GetFrame(PipelineId, IpcSender<Option<FrameId>>),
- /// Notifies the constellation that this frame has received focus.
- Focus(PipelineId),
- /// Requests that the constellation retrieve the current contents of the clipboard
- GetClipboardContents(IpcSender<String>),
- /// Requests that the constellation set the contents of the clipboard
- SetClipboardContents(String),
/// Dispatch a webdriver command
WebDriverCommand(WebDriverCommandMsg),
- /// Notifies the constellation that the viewport has been constrained in some manner
- ViewportConstrained(PipelineId, ViewportConstraints),
- /// Query the constellation to see if the current compositor output is stable
- IsReadyToSaveImage(HashMap<PipelineId, Epoch>),
- /// Notification that this iframe should be removed.
- RemoveIFrame(PipelineId),
- /// Favicon detected
- NewFavicon(Url),
- /// <head> tag finished parsing
- HeadParsed,
+}
+
+/// Messages from the script to the constellation.
+#[derive(Deserialize, Serialize)]
+pub enum ScriptMsg {
+ /// Indicates whether this pipeline is currently running animations.
+ ChangeRunningAnimationsState(PipelineId, AnimationState),
/// Requests that a new 2D canvas thread be created. (This is done in the constellation because
/// 2D canvases may use the GPU and we don't want to give untrusted content access to the GPU.)
CreateCanvasPaintTask(Size2D<i32>, IpcSender<(IpcSender<CanvasMsg>, usize)>),
@@ -288,8 +274,34 @@ pub enum Msg {
CreateWebGLPaintTask(Size2D<i32>,
GLContextAttributes,
IpcSender<Result<(IpcSender<CanvasMsg>, usize), String>>),
+ /// Dispatched after the DOM load event has fired on a document
+ DOMLoad(PipelineId),
+ Failure(Failure),
+ /// Notifies the constellation that this frame has received focus.
+ Focus(PipelineId),
+ /// Requests that the constellation retrieve the current contents of the clipboard
+ GetClipboardContents(IpcSender<String>),
+ /// <head> tag finished parsing
+ HeadParsed,
+ LoadComplete(PipelineId),
+ LoadUrl(PipelineId, LoadData),
+ /// Dispatch a mozbrowser event to a given iframe. Only available in experimental mode.
+ MozBrowserEvent(PipelineId, SubpageId, MozBrowserEvent),
+ Navigate(Option<(PipelineId, SubpageId)>, NavigationDirection),
+ /// Favicon detected
+ NewFavicon(Url),
/// Status message to be displayed in the chrome, eg. a link URL on mouseover.
NodeStatus(Option<String>),
+ PainterReady(PipelineId),
+ /// Notification that this iframe should be removed.
+ RemoveIFrame(PipelineId),
+ ScriptLoadedURLInIFrame(IframeLoadInfo),
+ /// Requests that the constellation set the contents of the clipboard
+ SetClipboardContents(String),
+ /// Requests that the constellation inform the compositor of the a cursor change.
+ SetCursor(Cursor),
+ /// Notifies the constellation that the viewport has been constrained in some manner
+ ViewportConstrained(PipelineId, ViewportConstraints),
}
#[derive(Clone, Eq, PartialEq, Deserialize, Serialize, Debug)]
diff --git a/components/script/clipboard_provider.rs b/components/script/clipboard_provider.rs
index 81860f59eef..9038f0ed393 100644
--- a/components/script/clipboard_provider.rs
+++ b/components/script/clipboard_provider.rs
@@ -4,7 +4,7 @@
use ipc_channel::ipc;
use msg::constellation_msg::ConstellationChan;
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use std::borrow::ToOwned;
use std::sync::mpsc::channel;
@@ -15,7 +15,7 @@ pub trait ClipboardProvider {
fn set_clipboard_contents(&mut self, String);
}
-impl ClipboardProvider for ConstellationChan {
+impl ClipboardProvider for ConstellationChan<ConstellationMsg> {
fn clipboard_contents(&mut self) -> String {
let (tx, rx) = ipc::channel().unwrap();
self.0.send(ConstellationMsg::GetClipboardContents(tx)).unwrap();
diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs
index f3ae21e3212..da8d3dce87a 100644
--- a/components/script/dom/bindings/global.rs
+++ b/components/script/dom/bindings/global.rs
@@ -18,6 +18,7 @@ use ipc_channel::ipc::IpcSender;
use js::jsapi::{GetGlobalForObjectCrossCompartment};
use js::jsapi::{JSContext, JSObject, JS_GetClass, MutableHandleValue};
use js::{JSCLASS_IS_DOMJSCLASS, JSCLASS_IS_GLOBAL};
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, PipelineId, WorkerId};
use net_traits::ResourceTask;
use profile_traits::mem;
@@ -91,7 +92,7 @@ impl<'a> GlobalRef<'a> {
}
/// Get a `ConstellationChan` to send messages to the constellation channel when available.
- pub fn constellation_chan(&self) -> ConstellationChan {
+ pub fn constellation_chan(&self) -> ConstellationChan<ConstellationMsg> {
match *self {
GlobalRef::Window(window) => window.constellation_chan(),
GlobalRef::Worker(worker) => worker.constellation_chan(),
diff --git a/components/script/dom/bindings/trace.rs b/components/script/dom/bindings/trace.rs
index e05670b9a6d..9218919720f 100644
--- a/components/script/dom/bindings/trace.rs
+++ b/components/script/dom/bindings/trace.rs
@@ -54,6 +54,7 @@ use js::rust::Runtime;
use layout_interface::{LayoutChan, LayoutRPC};
use libc;
use msg::constellation_msg::ConstellationChan;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{PipelineId, SubpageId, WindowSizeData, WorkerId};
use net_traits::Metadata;
use net_traits::image::base::Image;
@@ -271,7 +272,7 @@ no_jsmanaged_fields!(WorkerId);
no_jsmanaged_fields!(QuirksMode);
no_jsmanaged_fields!(Runtime);
no_jsmanaged_fields!(Headers, Method);
-no_jsmanaged_fields!(ConstellationChan);
+no_jsmanaged_fields!(ConstellationChan<ConstellationMsg>);
no_jsmanaged_fields!(LayoutChan);
no_jsmanaged_fields!(WindowProxyHandler);
no_jsmanaged_fields!(UntrustedNodeAddress);
diff --git a/components/script/dom/canvasrenderingcontext2d.rs b/components/script/dom/canvasrenderingcontext2d.rs
index 757f7e19cad..3cffea0f8c3 100644
--- a/components/script/dom/canvasrenderingcontext2d.rs
+++ b/components/script/dom/canvasrenderingcontext2d.rs
@@ -33,7 +33,7 @@ use euclid::point::Point2D;
use euclid::rect::Rect;
use euclid::size::Size2D;
use ipc_channel::ipc::{self, IpcSender};
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use net_traits::image::base::PixelFormat;
use net_traits::image_cache_task::ImageResponse;
use num::{Float, ToPrimitive};
diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs
index 1b8b99d90ec..108b68d9722 100644
--- a/components/script/dom/document.rs
+++ b/components/script/dom/document.rs
@@ -80,7 +80,7 @@ use layout_interface::{LayoutChan, Msg};
use layout_interface::{ReflowGoal, ReflowQueryType};
use msg::compositor_msg::ScriptToCompositorMsg;
use msg::constellation_msg::AnimationState;
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ALT, CONTROL, SHIFT, SUPER};
use msg::constellation_msg::{ConstellationChan, FocusType, Key, KeyModifiers, KeyState, MozBrowserEvent, SubpageId};
use net_traits::ControlMsg::{GetCookiesForUrl, SetCookiesForUrl};
diff --git a/components/script/dom/htmlbodyelement.rs b/components/script/dom/htmlbodyelement.rs
index b7af752fdfc..32efe1bd53b 100644
--- a/components/script/dom/htmlbodyelement.rs
+++ b/components/script/dom/htmlbodyelement.rs
@@ -18,7 +18,7 @@ use dom::htmlelement::HTMLElement;
use dom::node::{Node, document_from_node, window_from_node};
use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan;
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use std::rc::Rc;
use string_cache::Atom;
use time;
diff --git a/components/script/dom/htmliframeelement.rs b/components/script/dom/htmliframeelement.rs
index edb45fbb14b..b3e62ef434b 100644
--- a/components/script/dom/htmliframeelement.rs
+++ b/components/script/dom/htmliframeelement.rs
@@ -25,7 +25,7 @@ use dom::window::Window;
use js::jsapi::{JSAutoCompartment, JSAutoRequest, RootedValue, JSContext, MutableHandleValue};
use js::jsval::{UndefinedValue, NullValue};
use msg::constellation_msg::IFrameSandboxState::{IFrameSandboxed, IFrameUnsandboxed};
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, IframeLoadInfo, MozBrowserEvent};
use msg::constellation_msg::{NavigationDirection, PipelineId, SubpageId};
use page::IterablePage;
diff --git a/components/script/dom/htmlinputelement.rs b/components/script/dom/htmlinputelement.rs
index 8b638236818..35b9d3cd4e7 100644
--- a/components/script/dom/htmlinputelement.rs
+++ b/components/script/dom/htmlinputelement.rs
@@ -28,6 +28,7 @@ use dom::node::{document_from_node, window_from_node};
use dom::nodelist::NodeList;
use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use selectors::states::*;
use std::borrow::ToOwned;
use std::cell::Cell;
@@ -64,7 +65,7 @@ pub struct HTMLInputElement {
value_changed: Cell<bool>,
size: Cell<u32>,
#[ignore_heap_size_of = "#7193"]
- textinput: DOMRefCell<TextInput<ConstellationChan>>,
+ textinput: DOMRefCell<TextInput<ConstellationChan<ConstellationMsg>>>,
activation_state: DOMRefCell<InputActivationState>,
}
diff --git a/components/script/dom/htmllinkelement.rs b/components/script/dom/htmllinkelement.rs
index a7365c38a69..bb470bf8d45 100644
--- a/components/script/dom/htmllinkelement.rs
+++ b/components/script/dom/htmllinkelement.rs
@@ -24,7 +24,7 @@ use encoding::all::UTF_8;
use ipc_channel::ipc;
use ipc_channel::router::ROUTER;
use layout_interface::{LayoutChan, Msg};
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, MozBrowserEvent};
use net_traits::{AsyncResponseListener, AsyncResponseTarget, Metadata};
use network_listener::{NetworkListener, PreInvoke};
diff --git a/components/script/dom/htmltextareaelement.rs b/components/script/dom/htmltextareaelement.rs
index 76194a2044e..f84b38ca55c 100644
--- a/components/script/dom/htmltextareaelement.rs
+++ b/components/script/dom/htmltextareaelement.rs
@@ -25,6 +25,7 @@ use dom::node::{document_from_node, window_from_node};
use dom::nodelist::NodeList;
use dom::virtualmethods::VirtualMethods;
use msg::constellation_msg::ConstellationChan;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use script_task::ScriptTaskEventCategory::InputEvent;
use script_task::{CommonScriptMsg, Runnable};
use selectors::states::*;
@@ -37,7 +38,7 @@ use util::str::DOMString;
pub struct HTMLTextAreaElement {
htmlelement: HTMLElement,
#[ignore_heap_size_of = "#7193"]
- textinput: DOMRefCell<TextInput<ConstellationChan>>,
+ textinput: DOMRefCell<TextInput<ConstellationChan<ConstellationMsg>>>,
cols: Cell<u32>,
rows: Cell<u32>,
// https://html.spec.whatwg.org/multipage/#concept-textarea-dirty
diff --git a/components/script/dom/webglrenderingcontext.rs b/components/script/dom/webglrenderingcontext.rs
index a6da1d0d2ea..d21691f14af 100644
--- a/components/script/dom/webglrenderingcontext.rs
+++ b/components/script/dom/webglrenderingcontext.rs
@@ -31,7 +31,7 @@ use ipc_channel::ipc::{self, IpcSender};
use js::jsapi::{JSContext, JSObject, RootedValue};
use js::jsapi::{JS_GetFloat32ArrayData, JS_GetObjectAsArrayBufferView};
use js::jsval::{BooleanValue, Int32Value, JSVal, NullValue, UndefinedValue};
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use net_traits::image::base::PixelFormat;
use net_traits::image_cache_task::ImageResponse;
use offscreen_gl_context::GLContextAttributes;
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index cf7c85a160f..4cf2bbe881f 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -43,6 +43,7 @@ use layout_interface::{ContentBoxResponse, ContentBoxesResponse, ResolvedStyleRe
use layout_interface::{LayoutChan, LayoutRPC, Msg, Reflow, ReflowGoal, ReflowQueryType};
use libc;
use msg::compositor_msg::{LayerId, ScriptToCompositorMsg};
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, LoadData, PipelineId, SubpageId, WindowSizeData, WorkerId};
use msg::webdriver_msg::{WebDriverJSError, WebDriverJSResult};
use net_traits::ResourceTask;
@@ -191,7 +192,7 @@ pub struct Window {
/// A handle for communicating messages to the constellation task.
#[ignore_heap_size_of = "channels are hard"]
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
/// Pending scroll to fragment event, if any
fragment_name: DOMRefCell<Option<String>>,
@@ -1071,7 +1072,7 @@ impl Window {
self.layout_chan.clone()
}
- pub fn constellation_chan(&self) -> ConstellationChan {
+ pub fn constellation_chan(&self) -> ConstellationChan<ConstellationMsg> {
self.constellation_chan.clone()
}
@@ -1224,7 +1225,7 @@ impl Window {
storage_task: StorageTask,
mem_profiler_chan: mem::ProfilerChan,
devtools_chan: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
scheduler_chan: IpcSender<TimerEventRequest>,
timer_event_chan: IpcSender<TimerEvent>,
layout_chan: LayoutChan,
diff --git a/components/script/dom/workerglobalscope.rs b/components/script/dom/workerglobalscope.rs
index 3e49836e970..96a1786ff3c 100644
--- a/components/script/dom/workerglobalscope.rs
+++ b/components/script/dom/workerglobalscope.rs
@@ -20,6 +20,7 @@ use dom::workernavigator::WorkerNavigator;
use ipc_channel::ipc::IpcSender;
use js::jsapi::{HandleValue, JSAutoRequest, JSContext};
use js::rust::Runtime;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, PipelineId, WorkerId};
use net_traits::{ResourceTask, load_whole_resource};
use profile_traits::mem;
@@ -43,7 +44,7 @@ pub struct WorkerGlobalScopeInit {
pub mem_profiler_chan: mem::ProfilerChan,
pub to_devtools_sender: Option<IpcSender<ScriptToDevtoolsControlMsg>>,
pub from_devtools_sender: Option<IpcSender<DevtoolScriptControlMsg>>,
- pub constellation_chan: ConstellationChan,
+ pub constellation_chan: ConstellationChan<ConstellationMsg>,
pub scheduler_chan: IpcSender<TimerEventRequest>,
pub worker_id: WorkerId,
}
@@ -84,7 +85,7 @@ pub struct WorkerGlobalScope {
devtools_wants_updates: Cell<bool>,
#[ignore_heap_size_of = "Defined in std"]
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
#[ignore_heap_size_of = "Defined in std"]
scheduler_chan: IpcSender<TimerEventRequest>,
@@ -135,7 +136,7 @@ impl WorkerGlobalScope {
&self.from_devtools_receiver
}
- pub fn constellation_chan(&self) -> ConstellationChan {
+ pub fn constellation_chan(&self) -> ConstellationChan<ConstellationMsg> {
self.constellation_chan.clone()
}
diff --git a/components/script/layout_interface.rs b/components/script/layout_interface.rs
index 7c85d9c681e..cf9bae13e3b 100644
--- a/components/script/layout_interface.rs
+++ b/components/script/layout_interface.rs
@@ -14,6 +14,7 @@ use ipc_channel::ipc::{IpcReceiver, IpcSender};
use libc::uintptr_t;
use msg::compositor_msg::Epoch;
use msg::compositor_msg::LayerId;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId};
use msg::constellation_msg::{WindowSizeData};
use net_traits::image_cache_task::ImageCacheTask;
@@ -251,7 +252,7 @@ pub struct NewLayoutTaskInfo {
pub is_parent: bool,
pub layout_pair: OpaqueScriptLayoutChannel,
pub pipeline_port: IpcReceiver<LayoutControlMsg>,
- pub constellation_chan: ConstellationChan,
+ pub constellation_chan: ConstellationChan<ConstellationMsg>,
pub failure: Failure,
pub script_chan: Sender<ConstellationControlMsg>,
pub image_cache_task: ImageCacheTask,
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index d2fc0a93917..5a12d9e004f 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -62,7 +62,7 @@ use layout_interface::{self, LayoutChan, NewLayoutTaskInfo, ReflowGoal, ScriptLa
use libc;
use mem::heap_size_of_self_and_children;
use msg::compositor_msg::{EventResult, LayerId, ScriptToCompositorMsg};
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, FocusType, LoadData};
use msg::constellation_msg::{MozBrowserEvent, PipelineId};
use msg::constellation_msg::{PipelineNamespace};
@@ -403,7 +403,7 @@ pub struct ScriptTask {
control_port: Receiver<ConstellationControlMsg>,
/// For communicating load url messages to the constellation
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
/// A handle to the compositor for communicating ready state messages.
compositor: DOMRefCell<IpcSender<ScriptToCompositorMsg>>,
diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs
index 12ed3776bb5..337f07fda05 100644
--- a/components/script_traits/lib.rs
+++ b/components/script_traits/lib.rs
@@ -31,6 +31,7 @@ use euclid::rect::Rect;
use ipc_channel::ipc::{IpcReceiver, IpcSender};
use libc::c_void;
use msg::compositor_msg::{Epoch, LayerId, ScriptToCompositorMsg};
+use msg::constellation_msg::ScriptMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, Failure, PipelineId, WindowSizeData};
use msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData, SubpageId};
use msg::constellation_msg::{MozBrowserEvent, PipelineNamespaceId};
@@ -253,7 +254,7 @@ pub struct InitialScriptState {
/// A port on which messages sent by the constellation to script can be received.
pub control_port: Receiver<ConstellationControlMsg>,
/// A channel on which messages can be sent to the constellation from script.
- pub constellation_chan: ConstellationChan,
+ pub constellation_chan: ConstellationChan<ConstellationMsg>,
/// A channel to schedule timer events.
pub scheduler_chan: IpcSender<TimerEventRequest>,
/// Information that script sends out when it panics.
diff --git a/components/servo/lib.rs b/components/servo/lib.rs
index 359fc6a82ec..c43a22f2b21 100644
--- a/components/servo/lib.rs
+++ b/components/servo/lib.rs
@@ -48,12 +48,12 @@ extern crate libc;
extern crate webdriver_server;
#[cfg(feature = "webdriver")]
-fn webdriver(port: u16, constellation: msg::constellation_msg::ConstellationChan) {
+fn webdriver(port: u16, constellation: msg::constellation_msg::ConstellationChan<ConstellationMsg>) {
webdriver_server::start_server(port, constellation.clone());
}
#[cfg(not(feature = "webdriver"))]
-fn webdriver(_port: u16, _constellation: msg::constellation_msg::ConstellationChan) { }
+fn webdriver(_port: u16, _constellation: msg::constellation_msg::ConstellationChan<ConstellationMsg>) { }
use compositing::CompositorEventListener;
use compositing::compositor_task::InitialCompositorState;
@@ -62,8 +62,8 @@ use compositing::windowing::WindowEvent;
use compositing::windowing::WindowMethods;
use compositing::{CompositorProxy, CompositorTask, Constellation};
use gfx::font_cache_task::FontCacheTask;
+use msg::constellation_msg::CompositorMsg as ConstellationMsg;
use msg::constellation_msg::ConstellationChan;
-use msg::constellation_msg::Msg as ConstellationMsg;
use net::image_cache_task::new_image_cache_task;
use net::resource_task::new_resource_task;
use net::storage_task::StorageTaskFactory;
@@ -193,7 +193,7 @@ fn create_constellation(opts: opts::Opts,
time_profiler_chan: time::ProfilerChan,
mem_profiler_chan: mem::ProfilerChan,
devtools_chan: Option<Sender<devtools_traits::DevtoolsControlMsg>>,
- supports_clipboard: bool) -> ConstellationChan {
+ supports_clipboard: bool) -> ConstellationChan<ConstellationMsg> {
let resource_task = new_resource_task(opts.user_agent.clone(), devtools_chan.clone());
let image_cache_task = new_image_cache_task(resource_task.clone());
diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs
index 497e543b28d..71c6dea5f84 100644
--- a/components/webdriver_server/lib.rs
+++ b/components/webdriver_server/lib.rs
@@ -27,7 +27,7 @@ use hyper::method::Method::{self, Post};
use image::{DynamicImage, ImageFormat, RgbImage};
use ipc_channel::ipc::{self, IpcReceiver, IpcSender};
use keys::keycodes_to_keys;
-use msg::constellation_msg::Msg as ConstellationMsg;
+use msg::constellation_msg::CompositorMsg as ConstellationMsg;
use msg::constellation_msg::{ConstellationChan, FrameId, LoadData, PipelineId};
use msg::constellation_msg::{NavigationDirection, PixelFormat, WebDriverCommandMsg};
use msg::webdriver_msg::{LoadStatus, WebDriverFrameId, WebDriverJSError, WebDriverJSResult, WebDriverScriptCommand};
@@ -57,7 +57,7 @@ fn extension_routes() -> Vec<(Method, &'static str, ServoExtensionRoute)> {
(Post, "/session/{sessionId}/servo/prefs/reset", ServoExtensionRoute::ResetPrefs)]
}
-pub fn start_server(port: u16, constellation_chan: ConstellationChan) {
+pub fn start_server(port: u16, constellation_chan: ConstellationChan<ConstellationMsg>) {
let handler = Handler::new(constellation_chan);
spawn_named("WebdriverHttpServer".to_owned(), move || {
server::start(SocketAddr::new("0.0.0.0".parse().unwrap(), port), handler,
@@ -72,7 +72,7 @@ struct WebDriverSession {
struct Handler {
session: Option<WebDriverSession>,
- constellation_chan: ConstellationChan,
+ constellation_chan: ConstellationChan<ConstellationMsg>,
script_timeout: u32,
load_timeout: u32,
implicit_wait_timeout: u32
@@ -207,9 +207,8 @@ impl WebDriverSession {
}
}
-
impl Handler {
- pub fn new(constellation_chan: ConstellationChan) -> Handler {
+ pub fn new(constellation_chan: ConstellationChan<ConstellationMsg>) -> Handler {
Handler {
session: None,
constellation_chan: constellation_chan,