Reformat some task-related functions

This commit is contained in:
Anthony Ramine 2017-09-08 10:19:06 +02:00
parent 35a7252254
commit 53d30d85b3
3 changed files with 28 additions and 20 deletions

View file

@ -1281,19 +1281,21 @@ impl ScriptThread {
fn handle_msg_from_script(&self, msg: MainThreadScriptMsg) {
match msg {
MainThreadScriptMsg::Navigate(parent_pipeline_id, load_data, replace) =>
self.handle_navigate(parent_pipeline_id, None, load_data, replace),
MainThreadScriptMsg::ExitWindow(id) =>
self.handle_exit_window_msg(id),
MainThreadScriptMsg::Navigate(parent_pipeline_id, load_data, replace) => {
self.handle_navigate(parent_pipeline_id, None, load_data, replace)
},
MainThreadScriptMsg::ExitWindow(id) => {
self.handle_exit_window_msg(id)
},
MainThreadScriptMsg::Common(CommonScriptMsg::RunnableMsg(_, runnable)) => {
// The category of the runnable is ignored by the pattern, however
// it is still respected by profiling (see categorize_msg).
runnable.main_thread_handler(self)
}
MainThreadScriptMsg::Common(CommonScriptMsg::CollectReports(reports_chan)) =>
self.collect_reports(reports_chan),
MainThreadScriptMsg::WorkletLoaded(pipeline_id) =>
self.handle_worklet_loaded(pipeline_id),
MainThreadScriptMsg::Common(CommonScriptMsg::CollectReports(chan)) => {
self.collect_reports(chan)
},
MainThreadScriptMsg::WorkletLoaded(pipeline_id) => {
self.handle_worklet_loaded(pipeline_id)
},
}
}

View file

@ -25,11 +25,14 @@ impl fmt::Debug for DOMManipulationTaskSource {
}
impl TaskSource for DOMManipulationTaskSource {
fn queue_with_wrapper<T>(&self,
msg: Box<T>,
wrapper: &RunnableWrapper)
-> Result<(), ()>
where T: Runnable + Send + 'static {
fn queue_with_wrapper<T>(
&self,
msg: Box<T>,
wrapper: &RunnableWrapper,
) -> Result<(), ()>
where
T: Runnable + Send + 'static,
{
let msg = MainThreadScriptMsg::Common(CommonScriptMsg::RunnableMsg(
ScriptThreadEventCategory::ScriptEvent,
wrapper.wrap_runnable(msg),

View file

@ -25,11 +25,14 @@ impl fmt::Debug for UserInteractionTaskSource {
}
impl TaskSource for UserInteractionTaskSource {
fn queue_with_wrapper<T>(&self,
msg: Box<T>,
wrapper: &RunnableWrapper)
-> Result<(), ()>
where T: Runnable + Send + 'static {
fn queue_with_wrapper<T>(
&self,
msg: Box<T>,
wrapper: &RunnableWrapper,
) -> Result<(), ()>
where
T: Runnable + Send + 'static,
{
let msg = MainThreadScriptMsg::Common(CommonScriptMsg::RunnableMsg(
ScriptThreadEventCategory::InputEvent,
wrapper.wrap_runnable(msg),