servo: Merge #5895 - Uniformise the various Msg types [#5882] (from psdh:uniformiseMsgTypes); r=jdm

Fixes #5882

Source-Repo: https://github.com/servo/servo
Source-Revision: 19a4a263645a643d3a3f79b41b816fe8b8727265
This commit is contained in:
Prabhjyot Singh Sodhi 2015-04-29 15:51:39 -05:00
Родитель 1585980663
Коммит 6b09a033e8
9 изменённых файлов: 37 добавлений и 37 удалений

Просмотреть файл

@ -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,
@ -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);
}
@ -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);
@ -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();
}
@ -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();
@ -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();
}

Просмотреть файл

@ -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();
}
}

Просмотреть файл

@ -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`")
}
}

Просмотреть файл

@ -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

Просмотреть файл

@ -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<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

Просмотреть файл

@ -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();
}
}

Просмотреть файл

@ -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);
}
}

Просмотреть файл

@ -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.

Просмотреть файл

@ -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()))),