pub struct SharedWorkerHandle {
pub script_url: String,
pub name: String,
pub closing: Arc<AtomicBool>,
pub terminated: Arc<AtomicBool>,
pub connected_pages: Arc<AtomicUsize>,
}Expand description
A Send+Sync handle to a servo SharedWorker’s lifecycle state.
Does NOT hold JSObject references — only atomic flags. This is safe to store across threads (unlike SharedWorker DOM objects).
@trace REQ-BRW-004 [entity:SharedWorker]
Fields§
§script_url: StringWorker script URL.
name: StringWorker name (empty string if not specified).
closing: Arc<AtomicBool>Mirrors servo SharedWorker::closing — set by self.close().
terminated: Arc<AtomicBool>Mirrors servo SharedWorker::terminated — true after full teardown.
connected_pages: Arc<AtomicUsize>Number of pages currently connected via MessagePort. Decremented when a page disconnects (unload or port.close()).
Implementations§
Sourcepub fn new(script_url: String, name: String) -> Self
pub fn new(script_url: String, name: String) -> Self
Create a new SharedWorkerHandle in the running state.
@trace REQ-BRW-004 [entity:SharedWorker]
Sourcepub fn id(&self) -> SharedWorkerId
pub fn id(&self) -> SharedWorkerId
Returns the SharedWorkerId for this handle.
@trace REQ-BRW-004 [entity:SharedWorker]
Sourcepub fn is_closing(&self) -> bool
pub fn is_closing(&self) -> bool
Returns true if self.close() has been called.
@trace REQ-BRW-004 [entity:SharedWorker]
Sourcepub fn is_terminated(&self) -> bool
pub fn is_terminated(&self) -> bool
Returns true if the SharedWorker thread has fully exited.
@trace REQ-BRW-004 [entity:SharedWorker]
Sourcepub fn connected_page_count(&self) -> usize
pub fn connected_page_count(&self) -> usize
Returns the number of pages currently connected via MessagePort.
@trace REQ-BRW-004 [entity:SharedWorker]
Sourcepub fn close(&self)
pub fn close(&self)
Signal the SharedWorker to close (mirrors SharedWorker::self.close()). Unlike DedicatedWorker, there is no terminate() from the main thread — SharedWorkers are closed from within via self.close().
@trace REQ-BRW-004 [entity:SharedWorker]
Sourcepub fn mark_terminated(&self)
pub fn mark_terminated(&self)
Mark the SharedWorker as fully terminated (called after thread join).
@trace REQ-BRW-004 [entity:SharedWorker]
Sourcepub fn page_connected(&self)
pub fn page_connected(&self)
Increment the connected-page counter (when a new page connects).
@trace REQ-BRW-004 [entity:SharedWorker] DF-WK-7
Sourcepub fn page_disconnected(&self) -> usize
pub fn page_disconnected(&self) -> usize
Decrement the connected-page counter (when a page disconnects). Returns the previous value.
@trace REQ-BRW-004 [entity:SharedWorker] DF-WK-7
Trait Implementations§
Source§fn clone(&self) -> SharedWorkerHandle
fn clone(&self) -> SharedWorkerHandle
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
Blanket Implementations§
Source§impl<T> AsCtxPtr for Twhere
T: ?Sized,
impl<T> AsCtxPtr for Twhere
T: ?Sized,
Source§fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
fn as_ctx_ptr(&self) -> *mut Selfwhere
Self: Sized,
self’s address as *mut Self for deferred-task / scopeguard /
ref_guard ctx slots. The closures/trampolines deref it as shared
(&*p) — every method they reach is &self post-R-2, so no write
provenance is required; the *mut spelling is purely to match the
existing DerefOnDrop / HasAutoFlush / RefCount ABI.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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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>
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> ⓘ
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> ⓘ
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 more