aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/task_source
diff options
context:
space:
mode:
authorMartin Robinson <mrobinson@igalia.com>2024-08-13 23:21:47 +0200
committerGitHub <noreply@github.com>2024-08-13 21:21:47 +0000
commit478d95d2454f15184b45c5887af05c1cf51d2b23 (patch)
tree849bda933c31e5e5862065ee4dafab1a54be82e4 /components/script/task_source
parentfb6b56cdda03d2bf218ec079a5298a9ce8c9eb4e (diff)
downloadservo-478d95d2454f15184b45c5887af05c1cf51d2b23.tar.gz
servo-478d95d2454f15184b45c5887af05c1cf51d2b23.zip
Dedupliate `syn` (#33038)
This is the last step toward removing our use of `syn` version 1. It does three things: 1. Upgrades `async-recursion` to a newer version that uses `syn` 2. 2. Removes the use of `enum-iterator` that was only used to produce a trivial list of enum names. This reduces the number of crates we dependo on by 2. 3. Upgrades `media` to a version which no longer uses `syn` 1 Fixes #33034. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
Diffstat (limited to 'components/script/task_source')
-rw-r--r--components/script/task_source/mod.rs32
1 files changed, 23 insertions, 9 deletions
diff --git a/components/script/task_source/mod.rs b/components/script/task_source/mod.rs
index 5186b319ba7..beddc9495c6 100644
--- a/components/script/task_source/mod.rs
+++ b/components/script/task_source/mod.rs
@@ -18,16 +18,16 @@ pub mod websocket;
use std::result::Result;
-use enum_iterator::IntoEnumIterator;
-
use crate::dom::globalscope::GlobalScope;
use crate::task::{TaskCanceller, TaskOnce};
-// 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.
-#[derive(Clone, Eq, Hash, IntoEnumIterator, JSTraceable, PartialEq)]
+/// 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, Eq, Hash, JSTraceable, PartialEq)]
pub enum TaskSourceName {
DOMManipulation,
FileReading,
@@ -47,8 +47,22 @@ pub enum TaskSourceName {
}
impl TaskSourceName {
- pub fn all() -> Vec<TaskSourceName> {
- TaskSourceName::into_enum_iter().collect()
+ pub fn all() -> &'static [TaskSourceName] {
+ &[
+ TaskSourceName::DOMManipulation,
+ TaskSourceName::FileReading,
+ TaskSourceName::HistoryTraversal,
+ TaskSourceName::Networking,
+ TaskSourceName::PerformanceTimeline,
+ TaskSourceName::PortMessage,
+ TaskSourceName::UserInteraction,
+ TaskSourceName::RemoteEvent,
+ TaskSourceName::Rendering,
+ TaskSourceName::MediaElement,
+ TaskSourceName::Websocket,
+ TaskSourceName::Timer,
+ TaskSourceName::Gamepad,
+ ]
}
}