aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/task_source.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/task_source.rs')
-rw-r--r--components/script/task_source.rs28
1 files changed, 2 insertions, 26 deletions
diff --git a/components/script/task_source.rs b/components/script/task_source.rs
index cd36e176181..4f18292693e 100644
--- a/components/script/task_source.rs
+++ b/components/script/task_source.rs
@@ -6,6 +6,7 @@ use std::fmt;
use base::id::PipelineId;
use malloc_size_of_derive::MallocSizeOf;
+use strum_macros::VariantArray;
use stylo_atoms::Atom;
use crate::dom::bindings::refcounted::Trusted;
@@ -19,10 +20,7 @@ use crate::task_manager::TaskManager;
/// The names of all task sources, used to differentiate TaskCancellers. Note: When adding a task
/// source, update this enum. Note: The HistoryTraversalTaskSource is not part of this, because it
/// doesn't implement TaskSource.
-///
-/// Note: When adding or removing a [`TaskSourceName`], be sure to also update the return value of
-/// [`TaskSourceName::all`].
-#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, MallocSizeOf, PartialEq)]
+#[derive(Clone, Copy, Debug, Eq, Hash, JSTraceable, MallocSizeOf, PartialEq, VariantArray)]
pub(crate) enum TaskSourceName {
Canvas,
DOMManipulation,
@@ -68,28 +66,6 @@ impl From<TaskSourceName> for ScriptThreadEventCategory {
}
}
-impl TaskSourceName {
- pub(crate) fn all() -> &'static [TaskSourceName] {
- &[
- TaskSourceName::Canvas,
- TaskSourceName::DOMManipulation,
- TaskSourceName::FileReading,
- TaskSourceName::FontLoading,
- TaskSourceName::HistoryTraversal,
- TaskSourceName::Networking,
- TaskSourceName::PerformanceTimeline,
- TaskSourceName::PortMessage,
- TaskSourceName::UserInteraction,
- TaskSourceName::RemoteEvent,
- TaskSourceName::Rendering,
- TaskSourceName::MediaElement,
- TaskSourceName::WebSocket,
- TaskSourceName::Timer,
- TaskSourceName::Gamepad,
- ]
- }
-}
-
pub(crate) struct TaskSource<'task_manager> {
pub(crate) task_manager: &'task_manager TaskManager,
pub(crate) name: TaskSourceName,