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: FxHashMap<WorkletId, Dom<WorkletGlobalScope>>,
control_buffer: Option<WorkletControl>,
runtime: Runtime,
should_gc: bool,
gc_threshold: u32,
}Expand description
A thread for executing worklets.
Fields§
§role: WorkletThreadRoleWhich 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: WorkletGlobalScopeInitData for initializing new worklet global scopes
global_scopes: FxHashMap<WorkletId, Dom<WorkletGlobalScope>>The global scopes created by this thread
control_buffer: Option<WorkletControl>A one-place buffer for control messages
runtime: RuntimeThe JS runtime
should_gc: bool§gc_threshold: u32Implementations§
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,
webview_id: WebViewId,
pipeline_id: PipelineId,
worklet_id: WorkletId,
global_type: WorkletGlobalScopeType,
base_url: ServoUrl,
) -> DomRoot<WorkletGlobalScope>
fn get_worklet_global_scope( &mut self, webview_id: WebViewId, pipeline_id: PipelineId, worklet_id: WorkletId, global_type: WorkletGlobalScopeType, base_url: ServoUrl, ) -> DomRoot<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,
policy_container: PolicyContainer,
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, policy_container: PolicyContainer, credentials: RequestCredentials, pending_tasks_struct: PendingTasksStruct, promise: TrustedPromise, can_gc: CanGc, )
Fetch and invoke a worklet script. https://html.spec.whatwg.org/multipage/#fetch-a-worklet-script-graph
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