Skip to content

Commit

Permalink
Uniformise the various Msg types [#5882]
Browse files Browse the repository at this point in the history
  • Loading branch information
psdh committed Apr 29, 2015
1 parent 5b0c6c9 commit b980278
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 37 deletions.
18 changes: 9 additions & 9 deletions components/compositing/constellation.rs
Expand Up @@ -385,9 +385,9 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
debug!("constellation got get-pipeline-title message");
self.handle_get_pipeline_title_msg(pipeline_id);
}
ConstellationMsg::MozBrowserEventMsg(pipeline_id,
subpage_id,
event) => {
ConstellationMsg::MozBrowserEvent(pipeline_id,
subpage_id,
event) => {
debug!("constellation got mozbrowser event message");
self.handle_mozbrowser_event_msg(pipeline_id,
subpage_id,
Expand All @@ -397,7 +397,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
debug!("constellation got get root pipeline message");
self.handle_get_root_pipeline(resp_chan);
}
ConstellationMsg::FocusMsg(pipeline_id) => {
ConstellationMsg::Focus(pipeline_id) => {
debug!("constellation got focus message");
self.handle_focus_msg(pipeline_id);
}
Expand All @@ -411,8 +411,8 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
};
sender.send(result).unwrap();
}
ConstellationMsg::WebDriverCommandMsg(pipeline_id,
command) => {
ConstellationMsg::WebDriverCommand(pipeline_id,
command) => {
debug!("constellation got webdriver command message");
self.handle_webdriver_command_msg(pipeline_id,
command);
Expand Down Expand Up @@ -569,7 +569,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
self.pipeline(pipeline_id)
.layout_chan
.0
.send(LayoutControlMsg::TickAnimationsMsg)
.send(LayoutControlMsg::TickAnimations)
.unwrap();
}

Expand Down Expand Up @@ -745,7 +745,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
if let Some((containing_pipeline_id, subpage_id)) = self.pipeline(pipeline_id).parent_info {
let pipeline = self.pipeline(containing_pipeline_id);
let ScriptControlChan(ref script_channel) = pipeline.script_chan;
let event = ConstellationControlMsg::FocusIFrameMsg(containing_pipeline_id,
let event = ConstellationControlMsg::FocusIFrame(containing_pipeline_id,
subpage_id);
script_channel.send(event).unwrap();

Expand All @@ -766,7 +766,7 @@ impl<LTF: LayoutTaskFactory, STF: ScriptTaskFactory> Constellation<LTF, STF> {
// Find the script channel for the given parent pipeline,
// and pass the event to that script task.
let pipeline = self.pipeline(pipeline_id);
let control_msg = ConstellationControlMsg::WebDriverCommandMsg(pipeline_id, msg);
let control_msg = ConstellationControlMsg::WebDriverCommand(pipeline_id, msg);
let ScriptControlChan(ref script_channel) = pipeline.script_chan;
script_channel.send(control_msg).unwrap();
}
Expand Down
8 changes: 4 additions & 4 deletions components/compositing/pipeline.rs
Expand Up @@ -239,7 +239,7 @@ impl Pipeline {
let _ = self.paint_chan.send(PaintMsg::Exit(None, PipelineExitType::PipelineOnly));
let LayoutControlChan(ref layout_channel) = self.layout_chan;
let _ = layout_channel.send(
LayoutControlMsg::ExitNowMsg(PipelineExitType::PipelineOnly)).unwrap();
LayoutControlMsg::ExitNow(PipelineExitType::PipelineOnly)).unwrap();
}

pub fn to_sendable(&self) -> CompositionPipeline {
Expand All @@ -260,9 +260,9 @@ impl Pipeline {
assert!(opts::experimental_enabled());

let ScriptControlChan(ref script_channel) = self.script_chan;
let event = ConstellationControlMsg::MozBrowserEventMsg(self.id,
subpage_id,
event);
let event = ConstellationControlMsg::MozBrowserEvent(self.id,
subpage_id,
event);
script_channel.send(event).unwrap();
}
}
10 changes: 5 additions & 5 deletions components/layout/layout_task.rs
Expand Up @@ -404,10 +404,10 @@ impl LayoutTask {
match port_to_read {
PortToRead::Pipeline => {
match self.pipeline_port.recv().unwrap() {
LayoutControlMsg::TickAnimationsMsg => {
LayoutControlMsg::TickAnimations => {
self.handle_request_helper(Msg::TickAnimations, possibly_locked_rw_data)
}
LayoutControlMsg::ExitNowMsg(exit_type) => {
LayoutControlMsg::ExitNow(exit_type) => {
self.handle_request_helper(Msg::ExitNow(exit_type),
possibly_locked_rw_data)
}
Expand Down Expand Up @@ -516,7 +516,7 @@ impl LayoutTask {
return false
},
Msg::ExitNow(exit_type) => {
debug!("layout: ExitNowMsg received");
debug!("layout: ExitNow received");
self.exit_now(possibly_locked_rw_data, exit_type);
return false
}
Expand All @@ -542,7 +542,7 @@ impl LayoutTask {
}

/// Enters a quiescent state in which no new messages except for
/// `layout_interface::Msg::ReapLayoutData` will be processed until an `ExitNowMsg` is
/// `layout_interface::Msg::ReapLayoutData` will be processed until an `ExitNow` is
/// received. A pong is immediately sent on the given response channel.
fn prepare_to_exit<'a>(&'a self,
response_chan: Sender<()>,
Expand All @@ -561,7 +561,7 @@ impl LayoutTask {
break
}
_ => {
panic!("layout: message that wasn't `ExitNowMsg` received after \
panic!("layout: message that wasn't `ExitNow` received after \
`PrepareToExitMsg`")
}
}
Expand Down
4 changes: 2 additions & 2 deletions components/layout_traits/lib.rs
Expand Up @@ -28,8 +28,8 @@ use std::sync::mpsc::{Sender, Receiver};

/// Messages sent to the layout task from the constellation
pub enum LayoutControlMsg {
ExitNowMsg(PipelineExitType),
TickAnimationsMsg,
ExitNow(PipelineExitType),
TickAnimations,
}

/// A channel wrapper for constellation messages
Expand Down
6 changes: 3 additions & 3 deletions components/msg/constellation_msg.rs
Expand Up @@ -221,19 +221,19 @@ pub enum Msg {
/// 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.
MozBrowserEventMsg(PipelineId, SubpageId, MozBrowserEvent),
MozBrowserEvent(PipelineId, SubpageId, MozBrowserEvent),
/// Indicates whether this pipeline is currently running animations.
ChangeRunningAnimationsState(PipelineId, bool),
/// Requests that the constellation instruct layout to begin a new tick of the animation.
TickAnimation(PipelineId),
// Request that the constellation send the current root pipeline id over a provided channel
GetRootPipeline(Sender<Option<PipelineId>>),
/// Notifies the constellation that this frame has received focus.
FocusMsg(PipelineId),
Focus(PipelineId),
/// Requests that the constellation retrieve the current contents of the clipboard
GetClipboardContents(Sender<String>),
// Dispatch a webdriver command
WebDriverCommandMsg(PipelineId, WebDriverScriptCommand)
WebDriverCommand(PipelineId, WebDriverScriptCommand)
}

// https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API#Events
Expand Down
8 changes: 4 additions & 4 deletions components/script/dom/document.rs
Expand Up @@ -481,7 +481,7 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {
if focus_type == FocusType::Element {
let window = self.window.root();
let ConstellationChan(ref chan) = window.r().constellation_chan();
let event = ConstellationMsg::FocusMsg(window.r().pipeline());
let event = ConstellationMsg::Focus(window.r().pipeline());
chan.send(event).unwrap();
}
}
Expand Down Expand Up @@ -769,9 +769,9 @@ impl<'a> DocumentHelpers<'a> for JSRef<'a, Document> {

if let Some((containing_pipeline_id, subpage_id)) = window.r().parent_info() {
let ConstellationChan(ref chan) = window.r().constellation_chan();
let event = ConstellationMsg::MozBrowserEventMsg(containing_pipeline_id,
subpage_id,
event);
let event = ConstellationMsg::MozBrowserEvent(containing_pipeline_id,
subpage_id,
event);
chan.send(event).unwrap();
}
}
Expand Down
10 changes: 5 additions & 5 deletions components/script/script_task.rs
Expand Up @@ -718,19 +718,19 @@ impl ScriptTask {
self.handle_freeze_msg(pipeline_id),
ConstellationControlMsg::Thaw(pipeline_id) =>
self.handle_thaw_msg(pipeline_id),
ConstellationControlMsg::MozBrowserEventMsg(parent_pipeline_id,
subpage_id,
event) =>
ConstellationControlMsg::MozBrowserEvent(parent_pipeline_id,
subpage_id,
event) =>
self.handle_mozbrowser_event_msg(parent_pipeline_id,
subpage_id,
event),
ConstellationControlMsg::UpdateSubpageId(containing_pipeline_id,
old_subpage_id,
new_subpage_id) =>
self.handle_update_subpage_id(containing_pipeline_id, old_subpage_id, new_subpage_id),
ConstellationControlMsg::FocusIFrameMsg(containing_pipeline_id, subpage_id) =>
ConstellationControlMsg::FocusIFrame(containing_pipeline_id, subpage_id) =>
self.handle_focus_iframe_msg(containing_pipeline_id, subpage_id),
ConstellationControlMsg::WebDriverCommandMsg(pipeline_id, msg) => {
ConstellationControlMsg::WebDriverCommand(pipeline_id, msg) => {
self.handle_webdriver_msg(pipeline_id, msg);
}
}
Expand Down
6 changes: 3 additions & 3 deletions components/script_traits/lib.rs
Expand Up @@ -72,13 +72,13 @@ pub enum ConstellationControlMsg {
/// Notifies script task that a url should be loaded in this iframe.
Navigate(PipelineId, SubpageId, LoadData),
/// Requests the script task forward a mozbrowser event to an iframe it owns
MozBrowserEventMsg(PipelineId, SubpageId, MozBrowserEvent),
MozBrowserEvent(PipelineId, SubpageId, MozBrowserEvent),
/// Updates the current subpage id of a given iframe
UpdateSubpageId(PipelineId, SubpageId, SubpageId),
/// Set an iframe to be focused. Used when an element in an iframe gains focus.
FocusIFrameMsg(PipelineId, SubpageId),
FocusIFrame(PipelineId, SubpageId),
// Passes a webdriver command to the script task for execution
WebDriverCommandMsg(PipelineId, WebDriverScriptCommand)
WebDriverCommand(PipelineId, WebDriverScriptCommand)
}

/// The mouse button involved in the event.
Expand Down
4 changes: 2 additions & 2 deletions components/webdriver_server/lib.rs
Expand Up @@ -133,8 +133,8 @@ impl Handler {

let (sender, reciever) = channel();
let ConstellationChan(ref const_chan) = self.constellation_chan;
const_chan.send(ConstellationMsg::WebDriverCommandMsg(pipeline_id,
WebDriverScriptCommand::EvaluateJS(script, sender))).unwrap();
const_chan.send(ConstellationMsg::WebDriverCommand(pipeline_id,
WebDriverScriptCommand::EvaluateJS(script, sender))).unwrap();

match reciever.recv().unwrap() {
Ok(value) => Ok(WebDriverResponse::Generic(ValueResponse::new(value.to_json()))),
Expand Down

0 comments on commit b980278

Please sign in to comment.