From b980278d900ae8dea9bb33d00b73502046106d0c Mon Sep 17 00:00:00 2001 From: Prabhjyot Singh Sodhi Date: Wed, 29 Apr 2015 19:54:22 +0530 Subject: [PATCH] Uniformise the various Msg types [#5882] --- components/compositing/constellation.rs | 18 +++++++++--------- components/compositing/pipeline.rs | 8 ++++---- components/layout/layout_task.rs | 10 +++++----- components/layout_traits/lib.rs | 4 ++-- components/msg/constellation_msg.rs | 6 +++--- components/script/dom/document.rs | 8 ++++---- components/script/script_task.rs | 10 +++++----- components/script_traits/lib.rs | 6 +++--- components/webdriver_server/lib.rs | 4 ++-- 9 files changed, 37 insertions(+), 37 deletions(-) diff --git a/components/compositing/constellation.rs b/components/compositing/constellation.rs index f1a7cd8c4874..7ad95f89b90d 100644 --- a/components/compositing/constellation.rs +++ b/components/compositing/constellation.rs @@ -385,9 +385,9 @@ impl Constellation { 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, @@ -397,7 +397,7 @@ impl Constellation { 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); } @@ -411,8 +411,8 @@ impl Constellation { }; 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); @@ -569,7 +569,7 @@ impl Constellation { self.pipeline(pipeline_id) .layout_chan .0 - .send(LayoutControlMsg::TickAnimationsMsg) + .send(LayoutControlMsg::TickAnimations) .unwrap(); } @@ -745,7 +745,7 @@ impl Constellation { 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(); @@ -766,7 +766,7 @@ impl Constellation { // 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(); } diff --git a/components/compositing/pipeline.rs b/components/compositing/pipeline.rs index 3b3a5d0a4f61..3c96524b18b0 100644 --- a/components/compositing/pipeline.rs +++ b/components/compositing/pipeline.rs @@ -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 { @@ -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(); } } diff --git a/components/layout/layout_task.rs b/components/layout/layout_task.rs index bf2ee6e660ca..6166b95f73b4 100644 --- a/components/layout/layout_task.rs +++ b/components/layout/layout_task.rs @@ -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) } @@ -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 } @@ -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<()>, @@ -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`") } } diff --git a/components/layout_traits/lib.rs b/components/layout_traits/lib.rs index 8381b64c3efd..406730f65d7e 100644 --- a/components/layout_traits/lib.rs +++ b/components/layout_traits/lib.rs @@ -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 diff --git a/components/msg/constellation_msg.rs b/components/msg/constellation_msg.rs index b2edf1c0f8f0..40ddb0161ddc 100644 --- a/components/msg/constellation_msg.rs +++ b/components/msg/constellation_msg.rs @@ -221,7 +221,7 @@ 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. @@ -229,11 +229,11 @@ pub enum Msg { // Request that the constellation send the current root pipeline id over a provided channel GetRootPipeline(Sender>), /// 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), // Dispatch a webdriver command - WebDriverCommandMsg(PipelineId, WebDriverScriptCommand) + WebDriverCommand(PipelineId, WebDriverScriptCommand) } // https://developer.mozilla.org/en-US/docs/Web/API/Using_the_Browser_API#Events diff --git a/components/script/dom/document.rs b/components/script/dom/document.rs index ce1abc1cd89b..a414f782012d 100644 --- a/components/script/dom/document.rs +++ b/components/script/dom/document.rs @@ -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(); } } @@ -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(); } } diff --git a/components/script/script_task.rs b/components/script/script_task.rs index 08020fb12deb..6d408d2f10f4 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -718,9 +718,9 @@ 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), @@ -728,9 +728,9 @@ impl ScriptTask { 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); } } diff --git a/components/script_traits/lib.rs b/components/script_traits/lib.rs index 82f917733dee..1fa6e8d321f8 100644 --- a/components/script_traits/lib.rs +++ b/components/script_traits/lib.rs @@ -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. diff --git a/components/webdriver_server/lib.rs b/components/webdriver_server/lib.rs index afd40fb9414c..7d410c90bf8f 100644 --- a/components/webdriver_server/lib.rs +++ b/components/webdriver_server/lib.rs @@ -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()))),