#[repr(u8)]pub enum TaskPriority {
Input = 0,
UserBlocking = 1,
Normal = 2,
Timer = 3,
BestEffort = 4,
Idle = 5,
}Expand description
Priority levels for tasks — determines scheduling order.
Ordered from highest to lowest. The scheduler always picks from the highest non-empty priority level (with anti-starvation for lower levels).
§Chrome mapping
| Kozan | Chrome equivalent |
|---|---|
Input | Input task source (highest) |
UserBlocking | base::TaskPriority::USER_BLOCKING |
Normal | base::TaskPriority::USER_VISIBLE |
Timer | Timer task source (throttleable) |
BestEffort | base::TaskPriority::BEST_EFFORT |
Idle | requestIdleCallback task source |
Variants§
Input = 0
Input events: mouse, keyboard, touch, pointer. Always processed first — responsiveness is critical.
UserBlocking = 1
User is actively waiting for the result. Example: loading a resource the user just clicked on.
Normal = 2
Normal DOM work, network callbacks, general application logic. The default priority for most tasks.
Timer = 3
Timer callbacks (setTimeout/setInterval equivalent).
Can be throttled for background windows.
BestEffort = 4
Background work the user won’t notice if delayed. Example: prefetching, metrics, analytics.
Idle = 5
Idle tasks — only run when the frame budget has spare time.
Example: requestIdleCallback equivalent, GC-like cleanup.
Implementations§
Source§impl TaskPriority
impl TaskPriority
Trait Implementations§
Source§impl Clone for TaskPriority
impl Clone for TaskPriority
Source§fn clone(&self) -> TaskPriority
fn clone(&self) -> TaskPriority
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more