Rename constellation_msg::Msg variants.

This commit is contained in:
Ms2ger 2015-01-04 11:27:44 +01:00
parent d5cc791d31
commit de0caf8761
11 changed files with 85 additions and 82 deletions

View file

@ -31,10 +31,10 @@ use gleam::gl;
use script_traits::{ViewportMsg, ScriptControlChan};
use servo_msg::compositor_msg::{Blank, Epoch, FinishedLoading, IdlePaintState, LayerId};
use servo_msg::compositor_msg::{ReadyState, PaintState, PaintingPaintState, Scrollable};
use servo_msg::constellation_msg::{mod, ConstellationChan, ExitMsg};
use servo_msg::constellation_msg::{GetPipelineTitleMsg, Key, KeyModifiers, KeyState, LoadData};
use servo_msg::constellation_msg::{LoadUrlMsg, NavigateMsg, PipelineId, ResizedWindowMsg};
use servo_msg::constellation_msg::{WindowSizeData};
use servo_msg::constellation_msg::{mod, ConstellationChan};
use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_msg::constellation_msg::{Key, KeyModifiers, KeyState, LoadData};
use servo_msg::constellation_msg::{PipelineId, WindowSizeData};
use servo_util::geometry::{PagePx, ScreenPx, ViewportPx};
use servo_util::memory::MemoryProfilerChan;
use servo_util::opts;
@ -237,7 +237,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
(Msg::Exit(chan), _) => {
debug!("shutting down the constellation");
let ConstellationChan(ref con_chan) = self.constellation_chan;
con_chan.send(ExitMsg);
con_chan.send(ConstellationMsg::Exit);
chan.send(());
self.shutdown_state = ShutdownState::ShuttingDown;
}
@ -589,7 +589,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
let visible_viewport = initial_viewport / self.viewport_zoom;
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ResizedWindowMsg(WindowSizeData {
chan.send(ConstellationMsg::ResizedWindow(WindowSizeData {
device_pixel_ratio: dppx,
initial_viewport: initial_viewport,
visible_viewport: visible_viewport,
@ -754,7 +754,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
WindowEvent::Quit => {
debug!("shutting down the constellation for WindowEvent::Quit");
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ExitMsg);
chan.send(ConstellationMsg::Exit);
self.shutdown_state = ShutdownState::ShuttingDown;
}
}
@ -789,8 +789,8 @@ impl<Window: WindowMethods> IOCompositor<Window> {
layers"),
};
let msg = LoadUrlMsg(root_pipeline_id,
LoadData::new(Url::parse(url_string.as_slice()).unwrap()));
let msg = ConstellationMsg::LoadUrl(root_pipeline_id,
LoadData::new(Url::parse(url_string.as_slice()).unwrap()));
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(msg);
}
@ -911,7 +911,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
windowing::WindowNavigateMsg::Back => constellation_msg::Back,
};
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(NavigateMsg(direction))
chan.send(ConstellationMsg::Navigate(direction))
}
fn on_key_event(&self, key: Key, state: KeyState, modifiers: KeyModifiers) {
@ -1130,7 +1130,7 @@ impl<Window: WindowMethods> IOCompositor<Window> {
debug!("shutting down the constellation after generating an output file");
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(ExitMsg);
chan.send(ConstellationMsg::Exit);
self.shutdown_state = ShutdownState::ShuttingDown;
}
@ -1340,6 +1340,6 @@ impl<Window> CompositorEventListener for IOCompositor<Window> where Window: Wind
Some(ref root_pipeline) => root_pipeline.id,
};
let ConstellationChan(ref chan) = self.constellation_chan;
chan.send(GetPipelineTitleMsg(root_pipeline_id));
chan.send(ConstellationMsg::GetPipelineTitle(root_pipeline_id));
}
}

View file

@ -17,14 +17,12 @@ use libc;
use script_traits::{mod, GetTitleMsg, ResizeMsg, ResizeInactiveMsg, SendEventMsg};
use script_traits::{ScriptControlChan, ScriptTaskFactory};
use servo_msg::compositor_msg::LayerId;
use servo_msg::constellation_msg::{mod, ConstellationChan, ExitMsg, FailureMsg, Failure};
use servo_msg::constellation_msg::{FrameRectMsg, GetPipelineTitleMsg};
use servo_msg::constellation_msg::{IFrameSandboxState, IFrameUnsandboxed, InitLoadUrlMsg};
use servo_msg::constellation_msg::{KeyEvent, Key, KeyState, KeyModifiers, LoadCompleteMsg};
use servo_msg::constellation_msg::{LoadData, LoadUrlMsg, NavigateMsg, NavigationType};
use servo_msg::constellation_msg::{PainterReadyMsg, PipelineExitType, PipelineId, ResizedWindowMsg};
use servo_msg::constellation_msg::{ScriptLoadedURLInIFrameMsg, SetCursorMsg, SubpageId};
use servo_msg::constellation_msg::{WindowSizeData};
use servo_msg::constellation_msg::{mod, ConstellationChan, Failure};
use servo_msg::constellation_msg::{IFrameSandboxState, IFrameUnsandboxed};
use servo_msg::constellation_msg::{KeyEvent, Key, KeyState, KeyModifiers};
use servo_msg::constellation_msg::{LoadData, NavigationType};
use servo_msg::constellation_msg::{PipelineExitType, PipelineId};
use servo_msg::constellation_msg::{SubpageId, WindowSizeData};
use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_net::image_cache_task::{ImageCacheTask, ImageCacheTaskClient};
use servo_net::resource_task::ResourceTask;
@ -446,65 +444,65 @@ 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 {
match request {
ExitMsg => {
ConstellationMsg::Exit => {
debug!("constellation exiting");
self.handle_exit();
return false;
}
FailureMsg(Failure { pipeline_id, subpage_id }) => {
ConstellationMsg::Failure(Failure { pipeline_id, subpage_id }) => {
self.handle_failure_msg(pipeline_id, subpage_id);
}
// This should only be called once per constellation, and only by the browser
InitLoadUrlMsg(url) => {
ConstellationMsg::InitLoadUrl(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.
FrameRectMsg(pipeline_id, subpage_id, rect) => {
ConstellationMsg::FrameRect(pipeline_id, subpage_id, rect) => {
debug!("constellation got frame rect message");
self.handle_frame_rect_msg(pipeline_id, subpage_id, Rect::from_untyped(&rect));
}
ScriptLoadedURLInIFrameMsg(url, source_pipeline_id, subpage_id, sandbox) => {
ConstellationMsg::ScriptLoadedURLInIFrame(url, source_pipeline_id, subpage_id, sandbox) => {
debug!("constellation got iframe URL load message");
self.handle_script_loaded_url_in_iframe_msg(url,
source_pipeline_id,
subpage_id,
sandbox);
}
SetCursorMsg(cursor) => self.handle_set_cursor_msg(cursor),
ConstellationMsg::SetCursor(cursor) => self.handle_set_cursor_msg(cursor),
// 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, load_data) => {
ConstellationMsg::LoadUrl(source_id, load_data) => {
debug!("constellation got URL load message");
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.
LoadCompleteMsg => {
ConstellationMsg::LoadComplete => {
debug!("constellation got load complete message");
self.compositor_proxy.send(CompositorMsg::LoadComplete);
}
// Handle a forward or back request
NavigateMsg(direction) => {
ConstellationMsg::Navigate(direction) => {
debug!("constellation got navigation message");
self.handle_navigate_msg(direction);
}
// Notification that painting has finished and is requesting permission to paint.
PainterReadyMsg(pipeline_id) => {
ConstellationMsg::PainterReady(pipeline_id) => {
debug!("constellation got painter ready message");
self.handle_painter_ready_msg(pipeline_id);
}
ResizedWindowMsg(new_size) => {
ConstellationMsg::ResizedWindow(new_size) => {
debug!("constellation got window resize message");
self.handle_resized_window_msg(new_size);
}
KeyEvent(key, state, modifiers) => {
ConstellationMsg::KeyEvent(key, state, modifiers) => {
debug!("constellation got key event message");
self.handle_key_msg(key, state, modifiers);
}
GetPipelineTitleMsg(pipeline_id) => {
ConstellationMsg::GetPipelineTitle(pipeline_id) => {
debug!("constellation got get-pipeline-title message");
self.handle_get_pipeline_title_msg(pipeline_id);
}
@ -704,7 +702,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// and add the new pipeline to their sub frames.
let frame_trees = self.find_all(source_pipeline_id);
if frame_trees.is_empty() {
panic!("Constellation: source pipeline id of ScriptLoadedURLInIFrameMsg is not in
panic!("Constellation: source pipeline id of ScriptLoadedURLInIFrame is not in
navigation context, nor is it in a pending frame. This should be
impossible.");
}
@ -714,7 +712,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// Compare the pipeline's url to the new url. If the origin is the same,
// then reuse the script task in creating the new pipeline
let source_pipeline = self.pipelines.get(&source_pipeline_id).expect("Constellation:
source Id of ScriptLoadedURLInIFrameMsg does have an associated pipeline in
source Id of ScriptLoadedURLInIFrame does have an associated pipeline in
constellation. This should be impossible.").clone();
let source_url = source_pipeline.load_data.url.clone();
@ -759,7 +757,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
debug!("Constellation: received message to load {}", url);
// Make sure no pending page would be overridden.
let source_frame = self.current_frame().as_ref().unwrap().find(source_id).expect(
"Constellation: received a LoadUrlMsg from a pipeline_id associated
"Constellation: received a LoadUrl message from a pipeline_id associated
with a pipeline not in the active frame tree. This should be
impossible.");

View file

@ -7,7 +7,8 @@ use windowing::WindowEvent;
use geom::scale_factor::ScaleFactor;
use geom::size::TypedSize2D;
use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, ResizedWindowMsg, WindowSizeData};
use servo_msg::constellation_msg::Msg as ConstellationMsg;
use servo_msg::constellation_msg::{ConstellationChan, WindowSizeData};
use servo_util::memory::MemoryProfilerChan;
use servo_util::memory;
use servo_util::time::TimeProfilerChan;
@ -55,7 +56,7 @@ impl NullCompositor {
// Tell the constellation about the initial fake size.
{
let ConstellationChan(ref chan) = compositor.constellation_chan;
chan.send(ResizedWindowMsg(WindowSizeData {
chan.send(ConstellationMsg::ResizedWindow(WindowSizeData {
initial_viewport: TypedSize2D(640_f32, 480_f32),
visible_viewport: TypedSize2D(640_f32, 480_f32),
device_pixel_ratio: ScaleFactor(1.0),
@ -72,7 +73,7 @@ impl CompositorEventListener for NullCompositor {
Msg::Exit(chan) => {
debug!("shutting down the constellation");
let ConstellationChan(ref con_chan) = self.constellation_chan;
con_chan.send(ExitMsg);
con_chan.send(ConstellationMsg::Exit);
chan.send(());
}

View file

@ -11,7 +11,7 @@ use devtools_traits::DevtoolsControlChan;
use gfx::paint_task::Msg as PaintMsg;
use gfx::paint_task::{PaintPermissionGranted, PaintPermissionRevoked};
use gfx::paint_task::{PaintChan, PaintTask};
use servo_msg::constellation_msg::{ConstellationChan, ExitMsg, Failure, PipelineId, SubpageId};
use servo_msg::constellation_msg::{ConstellationChan, Failure, PipelineId, SubpageId};
use servo_msg::constellation_msg::{LoadData, WindowSizeData, PipelineExitType};
use servo_net::image_cache_task::ImageCacheTask;
use gfx::font_cache_task::FontCacheTask;