diff --git a/components/script/script_thread.rs b/components/script/script_thread.rs index a576af4407e..3062f57e8b5 100644 --- a/components/script/script_thread.rs +++ b/components/script/script_thread.rs @@ -114,7 +114,7 @@ use std::sync::mpsc::{Receiver, Select, Sender, channel}; use std::thread; use style::context::ReflowGoal; use style::thread_state; -use task_source::dom_manipulation::{DOMManipulationTask, DOMManipulationTaskSource}; +use task_source::dom_manipulation::DOMManipulationTaskSource; use task_source::file_reading::FileReadingTaskSource; use task_source::history_traversal::HistoryTraversalTaskSource; use task_source::networking::NetworkingTaskSource; @@ -276,8 +276,6 @@ pub enum MainThreadScriptMsg { /// dispatched to ScriptThread). Allows for a replace bool to be passed. If true, /// the current entry will be replaced instead of a new entry being added. Navigate(PipelineId, LoadData, bool), - /// Tasks that originate from the DOM manipulation task source - DOMManipulation(DOMManipulationTask), /// Tasks that originate from the user interaction task source UserInteraction(UserInteractionTask), /// Notifies the script thread that a new worklet has been loaded, and thus the page should be @@ -1298,8 +1296,6 @@ impl ScriptThread { self.collect_reports(reports_chan), MainThreadScriptMsg::WorkletLoaded(pipeline_id) => self.handle_worklet_loaded(pipeline_id), - MainThreadScriptMsg::DOMManipulation(task) => - task.handle_task(self), MainThreadScriptMsg::UserInteraction(task) => task.handle_task(self), } diff --git a/components/script/task_source/dom_manipulation.rs b/components/script/task_source/dom_manipulation.rs index 2ba5e297ade..18721539693 100644 --- a/components/script/task_source/dom_manipulation.rs +++ b/components/script/task_source/dom_manipulation.rs @@ -7,7 +7,8 @@ use dom::bindings::refcounted::Trusted; use dom::event::{EventBubbles, EventCancelable, EventRunnable, SimpleEventRunnable}; use dom::eventtarget::EventTarget; use dom::window::Window; -use script_thread::{MainThreadScriptMsg, Runnable, RunnableWrapper, ScriptThread}; +use script_runtime::{CommonScriptMsg, ScriptThreadEventCategory}; +use script_thread::{MainThreadScriptMsg, Runnable, RunnableWrapper}; use servo_atoms::Atom; use std::fmt; use std::result::Result; @@ -29,8 +30,11 @@ impl TaskSource for DOMManipulationTaskSource { wrapper: &RunnableWrapper) -> Result<(), ()> where T: Runnable + Send + 'static { - let msg = DOMManipulationTask(wrapper.wrap_runnable(msg)); - self.0.send(MainThreadScriptMsg::DOMManipulation(msg)).map_err(|_| ()) + let msg = MainThreadScriptMsg::Common(CommonScriptMsg::RunnableMsg( + ScriptThreadEventCategory::ScriptEvent, + wrapper.wrap_runnable(msg), + )); + self.0.send(msg).map_err(|_| ()) } } @@ -60,17 +64,3 @@ impl DOMManipulationTaskSource { let _ = self.queue(runnable, window.upcast()); } } - -pub struct DOMManipulationTask(pub Box); - -impl fmt::Debug for DOMManipulationTask { - fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { - write!(f, "DOMManipulationTask(...)") - } -} - -impl DOMManipulationTask { - pub fn handle_task(self, script_thread: &ScriptThread) { - self.0.main_thread_handler(script_thread); - } -}