Skip to main content

TaskQueue

Struct TaskQueue 

Source
pub struct TaskQueue { /* private fields */ }
Expand description

A single FIFO task queue with enable/disable support.

Like Chrome’s base::sequence_manager::TaskQueue. Each priority level in the scheduler owns one TaskQueue.

§Chrome features mapped

ChromeKozan
TaskQueue::SetQueueEnabled()set_enabled()
TaskQueue::InsertFence()(future: set_fence()
TaskQueue::GetNumberOfPendinglen()
PushBack / TakeTaskpush() / pop()

Implementations§

Source§

impl TaskQueue

Source

pub fn new(priority: TaskPriority) -> Self

Create a new empty queue for the given priority.

Source

pub fn push(&mut self, task: Task)

Push a task to the back of the queue.

Source

pub fn pop(&mut self) -> Option<Task>

Pop the front task. Returns None if empty or disabled.

Source

pub fn front(&self) -> Option<&Task>

Peek at the front task without removing it.

Source

pub fn len(&self) -> usize

Number of tasks in this queue (regardless of enabled state).

Source

pub fn is_empty(&self) -> bool

Whether this queue has no tasks.

Source

pub fn has_ready(&self) -> bool

Whether this queue has tasks AND is enabled (actually pickable).

Source

pub fn is_enabled(&self) -> bool

Whether this queue is enabled.

Source

pub fn set_enabled(&mut self, enabled: bool)

Enable or disable this queue.

Disabled queues are skipped by TaskQueueManager::pick(). Chrome uses this to throttle background tab timers.

Source

pub fn priority(&self) -> TaskPriority

The priority level this queue serves.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.