mirror of
https://github.com/servo/servo.git
synced 2025-07-23 07:13:52 +01:00
Add the TaskSourceName to CommonScriptMsg::Task
Update QueuedTaskConversion and the TaskQueue to use it
This commit is contained in:
parent
b211e45bb0
commit
e286fdcc53
18 changed files with 134 additions and 71 deletions
|
@ -27,7 +27,7 @@ impl fmt::Debug for DOMManipulationTaskSource {
|
|||
}
|
||||
|
||||
impl TaskSource for DOMManipulationTaskSource {
|
||||
const NAME: TaskSourceName = TaskSourceName::DOMManipulation;
|
||||
const NAME: TaskSourceName = TaskSourceName::DOMManipulation;
|
||||
|
||||
fn queue_with_canceller<T>(
|
||||
&self,
|
||||
|
@ -40,7 +40,8 @@ impl TaskSource for DOMManipulationTaskSource {
|
|||
let msg = MainThreadScriptMsg::Common(CommonScriptMsg::Task(
|
||||
ScriptThreadEventCategory::ScriptEvent,
|
||||
Box::new(canceller.wrap_task(task)),
|
||||
Some(self.1)
|
||||
Some(self.1),
|
||||
DOMManipulationTaskSource::NAME,
|
||||
));
|
||||
self.0.send(msg).map_err(|_| ())
|
||||
}
|
||||
|
|
|
@ -34,6 +34,7 @@ impl TaskSource for FileReadingTaskSource {
|
|||
ScriptThreadEventCategory::FileRead,
|
||||
Box::new(canceller.wrap_task(task)),
|
||||
Some(self.1),
|
||||
FileReadingTaskSource::NAME,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ use task::{TaskCanceller, TaskOnce};
|
|||
// Note: When adding a task source, update this enum.
|
||||
// Note: The HistoryTraversalTaskSource is not part of this,
|
||||
// because it doesn't implement TaskSource.
|
||||
#[derive(Eq, Hash, IntoEnumIterator, JSTraceable, PartialEq)]
|
||||
#[derive(Clone, Eq, Hash, IntoEnumIterator, JSTraceable, PartialEq)]
|
||||
pub enum TaskSourceName {
|
||||
DOMManipulation,
|
||||
FileReading,
|
||||
|
|
|
@ -31,6 +31,7 @@ impl TaskSource for NetworkingTaskSource {
|
|||
ScriptThreadEventCategory::NetworkEvent,
|
||||
Box::new(canceller.wrap_task(task)),
|
||||
Some(self.1),
|
||||
NetworkingTaskSource::NAME,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
@ -46,6 +47,7 @@ impl NetworkingTaskSource {
|
|||
ScriptThreadEventCategory::NetworkEvent,
|
||||
Box::new(task),
|
||||
Some(self.1),
|
||||
NetworkingTaskSource::NAME,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,7 +44,8 @@ impl TaskSource for PerformanceTimelineTaskSource {
|
|||
let msg = CommonScriptMsg::Task(
|
||||
ScriptThreadEventCategory::PerformanceTimelineTask,
|
||||
Box::new(canceller.wrap_task(task)),
|
||||
Some(self.1)
|
||||
Some(self.1),
|
||||
PerformanceTimelineTaskSource::NAME,
|
||||
);
|
||||
self.0.send(msg).map_err(|_| ())
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ impl TaskSource for RemoteEventTaskSource {
|
|||
ScriptThreadEventCategory::NetworkEvent,
|
||||
Box::new(canceller.wrap_task(task)),
|
||||
Some(self.1),
|
||||
RemoteEventTaskSource::NAME,
|
||||
))
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,8 @@ impl TaskSource for UserInteractionTaskSource {
|
|||
let msg = MainThreadScriptMsg::Common(CommonScriptMsg::Task(
|
||||
ScriptThreadEventCategory::InputEvent,
|
||||
Box::new(canceller.wrap_task(task)),
|
||||
Some(self.1)
|
||||
Some(self.1),
|
||||
UserInteractionTaskSource::NAME,
|
||||
));
|
||||
self.0.send(msg).map_err(|_| ())
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue