Skip to main content

BrowserSingleThreadedDispatcherImpl

Struct BrowserSingleThreadedDispatcherImpl 

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

Dispatcher backend for the browser. The browser event loop is the only loop: wake-ups are posted as macrotasks and the dispatcher runs on the main thread, so its own state needs no locking. A module built with threads has other threads (the render worker), which wake the dispatcher through its signal handle. Pending input is deliberately not queried: the browser dispatches input between our tasks on its own, and gating low-priority jobs on a pending-input query starves them for as long as the pointer keeps moving.

Implementations§

Source§

impl BrowserSingleThreadedDispatcherImpl

Source

pub fn new() -> Rc<Self>

Creates the dispatcher backend of the current thread and makes it the receiver of the callbacks of the page.

Trait Implementations§

Source§

impl IDispatcherImpl for BrowserSingleThreadedDispatcherImpl

Source§

fn current_thread_is_loop_thread(&self) -> bool

Source§

fn signal(&self)

Asynchronously triggers the signaled callback. Called on the loop thread; other threads go through signal_handle.
Source§

fn signal_handle(&self) -> Arc<dyn IDispatcherSignal> ⓘ

The thread-safe handle that does what signal does.
Source§

fn signaled(&self) -> &DispatcherImplEvent

Raised on the loop thread in response to a signal.
Source§

fn timer(&self) -> &DispatcherImplEvent

Raised on the loop thread when the timer set by update_timer is due.
Source§

fn now(&self) -> i64

Monotonic time in milliseconds.
Source§

fn update_timer(&self, due_time_in_ms: Option<i64>)

Sets (or clears) the time at which timer is raised.
Source§

fn as_explicit_background_processing( &self, ) -> Option<&dyn IDispatcherImplWithExplicitBackgroundProcessing>

Returns self when the implementation supports explicit background processing requests.
Source§

fn as_pending_input(&self) -> Option<&dyn IDispatcherImplWithPendingInput>

Returns self when the implementation can report pending input.
Source§

fn as_controlled(&self) -> Option<&dyn IControlledDispatcherImpl>

Returns self when the implementation can run the event loop.
Source§

impl IDispatcherImplWithExplicitBackgroundProcessing for BrowserSingleThreadedDispatcherImpl

Source§

fn ready_for_background_processing(&self) -> &DispatcherImplEvent

Raised on the loop thread once input has been handled after a call to request_background_processing.
Source§

fn request_background_processing(&self)

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> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more