#[repr(C)]pub(crate) struct WorkerGlobalScope {Show 16 fields
globalscope: GlobalScope,
worker_name: DOMString,
worker_type: WorkerType,
worker_id: WorkerId,
worker_url: DomRefCell<ServoUrl>,
closing: Arc<AtomicBool>,
runtime: DomRefCell<Option<Runtime>>,
location: MutNullableDom<WorkerLocation>,
navigator: MutNullableDom<WorkerNavigator>,
policy_container: DomRefCell<PolicyContainer>,
_devtools_sender: Option<IpcSender<DevtoolScriptControlMsg>>,
devtools_receiver: Option<Receiver<DevtoolScriptControlMsg>>,
navigation_start: CrossProcessInstant,
performance: MutNullableDom<Performance>,
timer_scheduler: RefCell<TimerScheduler>,
insecure_requests_policy: InsecureRequestsPolicy,
}
Fields§
§globalscope: GlobalScope
§worker_name: DOMString
§worker_type: WorkerType
§worker_id: WorkerId
§worker_url: DomRefCell<ServoUrl>
§closing: Arc<AtomicBool>
§runtime: DomRefCell<Option<Runtime>>
§location: MutNullableDom<WorkerLocation>
§policy_container: DomRefCell<PolicyContainer>
§_devtools_sender: Option<IpcSender<DevtoolScriptControlMsg>>
A Sender
for sending messages to devtools. This is unused but is stored here to
keep the channel alive.
devtools_receiver: Option<Receiver<DevtoolScriptControlMsg>>
A Receiver
for receiving messages from devtools.
performance: MutNullableDom<Performance>
§timer_scheduler: RefCell<TimerScheduler>
A TimerScheduler
used to schedule timers for this WorkerGlobalScope
.
Timers are handled in the service worker event loop.
insecure_requests_policy: InsecureRequestsPolicy
Implementations§
source§impl WorkerGlobalScope
impl WorkerGlobalScope
pub(crate) fn new_inherited( init: WorkerGlobalScopeInit, worker_name: DOMString, worker_type: WorkerType, worker_url: ServoUrl, runtime: Runtime, devtools_receiver: Receiver<DevtoolScriptControlMsg>, closing: Arc<AtomicBool>, gpu_id_hub: Arc<IdentityHub>, insecure_requests_policy: InsecureRequestsPolicy, ) -> Self
sourcepub(crate) fn insecure_requests_policy(&self) -> InsecureRequestsPolicy
pub(crate) fn insecure_requests_policy(&self) -> InsecureRequestsPolicy
Returns a policy value that should be used by fetches initiated by this worker.
sourcepub(crate) fn clear_js_runtime(&self)
pub(crate) fn clear_js_runtime(&self)
Clear various items when the worker event-loop shuts-down.
pub(crate) fn runtime_handle(&self) -> ParentRuntime
pub(crate) fn devtools_receiver( &self, ) -> Option<&Receiver<DevtoolScriptControlMsg>>
pub(crate) fn get_cx(&self) -> JSContext
pub(crate) fn is_closing(&self) -> bool
pub(crate) fn get_url(&self) -> Ref<'_, ServoUrl>
pub(crate) fn set_url(&self, url: ServoUrl)
pub(crate) fn get_worker_id(&self) -> WorkerId
pub(crate) fn pipeline_id(&self) -> PipelineId
pub(crate) fn policy_container(&self) -> Ref<'_, PolicyContainer>
sourcepub(crate) fn timer_scheduler(&self) -> RefMut<'_, TimerScheduler>
pub(crate) fn timer_scheduler(&self) -> RefMut<'_, TimerScheduler>
Get a mutable reference to the TimerScheduler
for this [ServiceWorkerGlobalScope
].
Return a copy to the shared task canceller that is used to cancel all tasks when this worker is closing.
source§impl WorkerGlobalScope
impl WorkerGlobalScope
pub(crate) fn execute_script(&self, source: DOMString, can_gc: CanGc)
pub(crate) fn new_script_pair( &self, ) -> (ScriptEventLoopSender, ScriptEventLoopReceiver)
sourcepub(crate) fn process_event(&self, msg: CommonScriptMsg) -> bool
pub(crate) fn process_event(&self, msg: CommonScriptMsg) -> bool
Process a single event as if it were the next event in the queue for this worker event-loop. Returns a boolean indicating whether further events should be processed.
pub(crate) fn close(&self)
Trait Implementations§
§impl Castable for WorkerGlobalScope
impl Castable for WorkerGlobalScope
source§impl DomObject for WorkerGlobalScope
impl DomObject for WorkerGlobalScope
source§impl HasParent for WorkerGlobalScope
impl HasParent for WorkerGlobalScope
source§fn as_parent(&self) -> &GlobalScope
fn as_parent(&self) -> &GlobalScope
This is used in a type assertion to ensure that the source and webidls agree as to what the parent type is
type Parent = GlobalScope
source§impl IDLInterface for WorkerGlobalScope
impl IDLInterface for WorkerGlobalScope
source§impl MallocSizeOf for WorkerGlobalScope
impl MallocSizeOf for WorkerGlobalScope
source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
source§impl MutDomObject for WorkerGlobalScope
impl MutDomObject for WorkerGlobalScope
source§impl PartialEq for WorkerGlobalScope
impl PartialEq for WorkerGlobalScope
source§impl Traceable for WorkerGlobalScope
impl Traceable for WorkerGlobalScope
source§impl WorkerGlobalScopeMethods<DomTypeHolder> for WorkerGlobalScope
impl WorkerGlobalScopeMethods<DomTypeHolder> for WorkerGlobalScope
source§fn StructuredClone(
&self,
cx: JSContext,
value: HandleValue<'_>,
options: RootedTraceableBox<StructuredSerializeOptions>,
retval: MutableHandleValue<'_>,
) -> Result<(), Error>
fn StructuredClone( &self, cx: JSContext, value: HandleValue<'_>, options: RootedTraceableBox<StructuredSerializeOptions>, retval: MutableHandleValue<'_>, ) -> Result<(), Error>
fn Self_(&self) -> Root<Dom<WorkerGlobalScope>>
fn Location(&self) -> Root<Dom<WorkerLocation>>
fn GetOnerror(&self) -> Option<Rc<OnErrorEventHandlerNonNull>>
fn SetOnerror(&self, listener: Option<Rc<OnErrorEventHandlerNonNull>>)
fn ImportScripts( &self, url_strings: Vec<DOMString>, can_gc: CanGc, ) -> Result<(), Error>
fn Crypto(&self) -> Root<Dom<Crypto>>
fn Btoa(&self, btoa: DOMString) -> Result<DOMString, Error>
fn Atob(&self, atob: DOMString) -> Result<DOMString, Error>
fn SetTimeout( &self, _cx: JSContext, callback: StringOrFunction, timeout: i32, args: Vec<HandleValue<'_>>, ) -> i32
fn ClearTimeout(&self, handle: i32)
fn SetInterval( &self, _cx: JSContext, callback: StringOrFunction, timeout: i32, args: Vec<HandleValue<'_>>, ) -> i32
fn ClearInterval(&self, handle: i32)
fn QueueMicrotask(&self, callback: Rc<VoidFunction>)
fn CreateImageBitmap( &self, image: ImageBitmapSource, options: &ImageBitmapOptions, can_gc: CanGc, ) -> Rc<Promise>
fn Fetch( &self, input: RequestOrUSVString, init: RootedTraceableBox<RequestInit>, comp: InRealm<'_>, can_gc: CanGc, ) -> Rc<Promise>
fn Performance(&self) -> Root<Dom<Performance>>
fn Origin(&self) -> USVString
fn IsSecureContext(&self) -> bool
impl DerivedFrom<EventTarget> for WorkerGlobalScope
impl DerivedFrom<GlobalScope> for WorkerGlobalScope
impl DerivedFrom<WorkerGlobalScope> for DedicatedWorkerGlobalScope
impl DerivedFrom<WorkerGlobalScope> for ServiceWorkerGlobalScope
impl DerivedFrom<WorkerGlobalScope> for WorkerGlobalScope
impl Eq for WorkerGlobalScope
Auto Trait Implementations§
impl !Freeze for WorkerGlobalScope
impl !RefUnwindSafe for WorkerGlobalScope
impl !Send for WorkerGlobalScope
impl !Sync for WorkerGlobalScope
impl Unpin for WorkerGlobalScope
impl !UnwindSafe for WorkerGlobalScope
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
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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