Struct script::dom::worklet::WorkletThread
source · struct WorkletThread {
role: WorkletThreadRole,
control_receiver: Receiver<WorkletControl>,
primary_sender: Sender<WorkletData>,
hot_backup_sender: Sender<WorkletData>,
cold_backup_sender: Sender<WorkletData>,
global_init: WorkletGlobalScopeInit,
global_scopes: HashMap<WorkletId, Dom<WorkletGlobalScope>>,
control_buffer: Option<WorkletControl>,
runtime: Runtime,
should_gc: bool,
gc_threshold: u32,
}
Expand description
A thread for executing worklets.
Fields§
§role: WorkletThreadRole
Which role the thread is currently playing
control_receiver: Receiver<WorkletControl>
The thread’s receiver for control messages
primary_sender: Sender<WorkletData>
Senders
hot_backup_sender: Sender<WorkletData>
§cold_backup_sender: Sender<WorkletData>
§global_init: WorkletGlobalScopeInit
Data for initializing new worklet global scopes
global_scopes: HashMap<WorkletId, Dom<WorkletGlobalScope>>
The global scopes created by this thread
control_buffer: Option<WorkletControl>
A one-place buffer for control messages
runtime: Runtime
The JS runtime
should_gc: bool
§gc_threshold: u32
Implementations§
source§impl WorkletThread
impl WorkletThread
sourcefn spawn(
role: WorkletThreadRole,
init: WorkletThreadInit,
thread_index: u8,
) -> Sender<WorkletControl>
fn spawn( role: WorkletThreadRole, init: WorkletThreadInit, thread_index: u8, ) -> Sender<WorkletControl>
Spawn a new worklet thread, returning the channel to send it control messages.
sourcefn current_memory_usage(&self) -> u32
fn current_memory_usage(&self) -> u32
The current memory usage of the thread
sourcefn get_worklet_global_scope(
&mut self,
pipeline_id: PipelineId,
worklet_id: WorkletId,
global_type: WorkletGlobalScopeType,
base_url: ServoUrl,
) -> Root<Dom<WorkletGlobalScope>>
fn get_worklet_global_scope( &mut self, pipeline_id: PipelineId, worklet_id: WorkletId, global_type: WorkletGlobalScopeType, base_url: ServoUrl, ) -> Root<Dom<WorkletGlobalScope>>
Get the worklet global scope for a given worklet. Creates the worklet global scope if it doesn’t exist.
sourcefn fetch_and_invoke_a_worklet_script(
&self,
global_scope: &WorkletGlobalScope,
pipeline_id: PipelineId,
origin: ImmutableOrigin,
script_url: ServoUrl,
credentials: RequestCredentials,
pending_tasks_struct: PendingTasksStruct,
promise: TrustedPromise,
can_gc: CanGc,
)
fn fetch_and_invoke_a_worklet_script( &self, global_scope: &WorkletGlobalScope, pipeline_id: PipelineId, origin: ImmutableOrigin, script_url: ServoUrl, credentials: RequestCredentials, pending_tasks_struct: PendingTasksStruct, promise: TrustedPromise, can_gc: CanGc, )
Fetch and invoke a worklet script. https://drafts.css-houdini.org/worklets/#fetch-and-invoke-a-worklet-script
sourcefn perform_a_worklet_task(&self, worklet_id: WorkletId, task: WorkletTask)
fn perform_a_worklet_task(&self, worklet_id: WorkletId, task: WorkletTask)
Perform a task.
sourcefn process_control(&mut self, control: WorkletControl, can_gc: CanGc)
fn process_control(&mut self, control: WorkletControl, can_gc: CanGc)
Process a control message.
sourcefn run_in_script_thread<T>(&self, task: T)where
T: TaskBox + 'static,
fn run_in_script_thread<T>(&self, task: T)where
T: TaskBox + 'static,
Run a task in the main script thread.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for WorkletThread
impl !RefUnwindSafe for WorkletThread
impl !Send for WorkletThread
impl !Sync for WorkletThread
impl Unpin for WorkletThread
impl !UnwindSafe for WorkletThread
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> Filterable for T
impl<T> Filterable for T
source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(_: DataRequest<'_>) -> bool>
Creates a filterable data provider with the given name for debugging. Read more
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<T> MaybeBoxed<Box<T>> for T
impl<T> MaybeBoxed<Box<T>> for T
source§fn maybe_boxed(self) -> Box<T>
fn maybe_boxed(self) -> Box<T>
Convert
source§impl<T> MaybeBoxed<T> for T
impl<T> MaybeBoxed<T> for T
source§fn maybe_boxed(self) -> T
fn maybe_boxed(self) -> T
Convert