diff options
author | Josh Matthews <josh@joshmatthews.net> | 2023-02-16 23:09:50 -0500 |
---|---|---|
committer | Josh Matthews <josh@joshmatthews.net> | 2023-05-20 11:05:09 -0400 |
commit | f79e1e327dfdf047cab9652e1cc3e67a7667faa1 (patch) | |
tree | 43c1cf48c9a6448264722780e38315dafacf4a24 /components/script/dom/globalscope.rs | |
parent | 4998c65c423f995149f4b314d8ff68024c24cc72 (diff) | |
download | servo-f79e1e327dfdf047cab9652e1cc3e67a7667faa1.tar.gz servo-f79e1e327dfdf047cab9652e1cc3e67a7667faa1.zip |
Make GlobalScope.get_cx a static method.
Diffstat (limited to 'components/script/dom/globalscope.rs')
-rw-r--r-- | components/script/dom/globalscope.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/components/script/dom/globalscope.rs b/components/script/dom/globalscope.rs index 9a3829f4d0e..9adc6f3213d 100644 --- a/components/script/dom/globalscope.rs +++ b/components/script/dom/globalscope.rs @@ -1215,7 +1215,7 @@ impl GlobalScope { return; } - rooted!(in(*global.get_cx()) let mut message = UndefinedValue()); + rooted!(in(*GlobalScope::get_cx()) let mut message = UndefinedValue()); // Step 10.3 StructuredDeserialize(serialized, targetRealm). if let Ok(ports) = structuredclone::read(&global, data, message.handle_mut()) { @@ -1269,7 +1269,7 @@ impl GlobalScope { }; if let Some((dom_port, PortMessageTask { origin, data })) = should_dispatch { // Substep 3-4 - rooted!(in(*self.get_cx()) let mut message_clone = UndefinedValue()); + rooted!(in(*GlobalScope::get_cx()) let mut message_clone = UndefinedValue()); if let Ok(ports) = structuredclone::read(self, data, message_clone.handle_mut()) { // Substep 6 // Dispatch the event, using the dom message-port. @@ -2120,7 +2120,7 @@ impl GlobalScope { /// Returns the global scope of the realm that the given DOM object's reflector /// was created in. #[allow(unsafe_code)] - pub fn from_reflector<T: DomObject>(reflector: &T) -> DomRoot<Self> { + pub fn from_reflector<T: DomObject>(reflector: &T, _realm: &AlreadyInRealm) -> DomRoot<Self> { unsafe { GlobalScope::from_object(*reflector.reflector().get_jsobject()) } } @@ -2221,7 +2221,7 @@ impl GlobalScope { } #[allow(unsafe_code)] - pub fn get_cx(&self) -> SafeJSContext { + pub fn get_cx() -> SafeJSContext { unsafe { SafeJSContext::from_ptr(Runtime::get()) } } @@ -2603,7 +2603,7 @@ impl GlobalScope { Some(metadata), self.time_profiler_chan().clone(), || { - let cx = self.get_cx(); + let cx = GlobalScope::get_cx(); let ar = enter_realm(&*self); @@ -2857,7 +2857,7 @@ impl GlobalScope { // Only perform the checkpoint if we're not shutting down. if self.can_continue_running() { self.microtask_queue.checkpoint( - self.get_cx(), + GlobalScope::get_cx(), |_| Some(DomRoot::from_ref(self)), vec![DomRoot::from_ref(self)], ); @@ -2866,7 +2866,7 @@ impl GlobalScope { /// Enqueue a microtask for subsequent execution. pub fn enqueue_microtask(&self, job: Microtask) { - self.microtask_queue.enqueue(job, self.get_cx()); + self.microtask_queue.enqueue(job, GlobalScope::get_cx()); } /// Create a new sender/receiver pair that can be used to implement an on-demand |