mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
Use strum
to iterate through enum variants and get their names (#35933)
`strum` allows us to avoid manually listing enum variant names and also to get their names as static strings. We cannot use this for all cases due to https://github.com/Peternator7/strum/issues/152, but we can still use it to remove a lot of code. Signed-off-by: Martin Robinson <mrobinson@igalia.com>
This commit is contained in:
parent
959720db0a
commit
294a649a6c
17 changed files with 51 additions and 285 deletions
|
@ -10,6 +10,7 @@ use std::default::Default;
|
|||
|
||||
use base::id::PipelineId;
|
||||
use crossbeam_channel::{self, Receiver, Sender};
|
||||
use strum::VariantArray;
|
||||
|
||||
use crate::dom::bindings::cell::DomRefCell;
|
||||
use crate::dom::worker::TrustedWorkerAddress;
|
||||
|
@ -211,8 +212,7 @@ impl<T: QueuedTaskConversion> TaskQueue<T> {
|
|||
self.process_incoming_tasks(first_msg, &fully_active);
|
||||
let mut throttled = self.throttled.borrow_mut();
|
||||
let mut throttled_length: usize = throttled.values().map(|queue| queue.len()).sum();
|
||||
let task_source_names = TaskSourceName::all();
|
||||
let mut task_source_cycler = task_source_names.iter().cycle();
|
||||
let mut task_source_cycler = TaskSourceName::VARIANTS.iter().cycle();
|
||||
// "being busy", is defined as having more than x tasks for this loop's iteration.
|
||||
// As long as we're not busy, and there are throttled tasks left:
|
||||
loop {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue