From 27f100b1d47058b92d0e23d8c1b2e472fb0eafca Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Sat, 1 Oct 2016 17:24:54 +0200 Subject: Introduce GlobalScope::pipeline_id --- components/script/script_runtime.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/script/script_runtime.rs') diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index 658ace4c46a..ab7cb607985 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -178,7 +178,7 @@ unsafe extern "C" fn enqueue_job(_cx: *mut JSContext, _data: *mut c_void) -> bool { let result = panic::catch_unwind(AssertUnwindSafe(|| { let global = global_root_from_object(job.get()); - let pipeline = global.r().pipeline_id(); + let pipeline = global.r().as_global_scope().pipeline_id(); global.r().enqueue_promise_job(EnqueuedPromiseCallback { callback: PromiseJobCallback::new(job.get()), pipeline: pipeline, -- cgit v1.2.3 From 6e3be6d894e311f2f2331d9437b4956fb5fd4752 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 4 Oct 2016 16:00:40 +0200 Subject: Introduce GlobalScope::flush_promise_jobs --- components/script/script_runtime.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'components/script/script_runtime.rs') diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index ab7cb607985..df9341a3777 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -142,7 +142,7 @@ impl PromiseJobQueue { self.promise_job_queue.borrow_mut().push(job); if !self.pending_promise_job_runnable.get() { self.pending_promise_job_runnable.set(true); - global.flush_promise_jobs(); + global.as_global_scope().flush_promise_jobs(); } } -- cgit v1.2.3 From 2ee073053ab4718bced82197b2af2c77fc5f47a7 Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 4 Oct 2016 16:08:12 +0200 Subject: Make PromiseJobQueue::enqueue take a &GlobalScope --- components/script/script_runtime.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'components/script/script_runtime.rs') diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index df9341a3777..36ae678ade7 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -8,11 +8,12 @@ use dom::bindings::callback::ExceptionHandling; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback; -use dom::bindings::global::{global_root_from_object, GlobalRoot, GlobalRef}; +use dom::bindings::global::{global_root_from_object, GlobalRoot}; use dom::bindings::js::{RootCollection, RootCollectionPtr, trace_roots}; use dom::bindings::refcounted::{LiveDOMReferences, trace_refcounted_objects}; use dom::bindings::trace::trace_traceables; use dom::bindings::utils::DOM_CALLBACKS; +use dom::globalscope::GlobalScope; use js::glue::CollectServoSizes; use js::jsapi::{DisableIncrementalGC, GCDescription, GCProgress, HandleObject}; use js::jsapi::{JSContext, JS_GetRuntime, JSRuntime, JSTracer, SetDOMCallbacks, SetGCSliceCallback}; @@ -138,11 +139,11 @@ impl PromiseJobQueue { /// Add a new promise job callback to this queue. It will be invoked as part of the next /// microtask checkpoint. - pub fn enqueue(&self, job: EnqueuedPromiseCallback, global: GlobalRef) { + pub fn enqueue(&self, job: EnqueuedPromiseCallback, global: &GlobalScope) { self.promise_job_queue.borrow_mut().push(job); if !self.pending_promise_job_runnable.get() { self.pending_promise_job_runnable.set(true); - global.as_global_scope().flush_promise_jobs(); + global.flush_promise_jobs(); } } -- cgit v1.2.3 From 4d9347d5b35a9b354577bf76f2251c97edde7eef Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Tue, 4 Oct 2016 16:19:05 +0200 Subject: Introduce GlobalScope::enqueue_promise_job --- components/script/script_runtime.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'components/script/script_runtime.rs') diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index 36ae678ade7..145ef1ef19e 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -8,7 +8,7 @@ use dom::bindings::callback::ExceptionHandling; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback; -use dom::bindings::global::{global_root_from_object, GlobalRoot}; +use dom::bindings::global::{GlobalRoot, global_scope_from_object}; use dom::bindings::js::{RootCollection, RootCollectionPtr, trace_roots}; use dom::bindings::refcounted::{LiveDOMReferences, trace_refcounted_objects}; use dom::bindings::trace::trace_traceables; @@ -178,9 +178,9 @@ unsafe extern "C" fn enqueue_job(_cx: *mut JSContext, _allocation_site: HandleObject, _data: *mut c_void) -> bool { let result = panic::catch_unwind(AssertUnwindSafe(|| { - let global = global_root_from_object(job.get()); - let pipeline = global.r().as_global_scope().pipeline_id(); - global.r().enqueue_promise_job(EnqueuedPromiseCallback { + let global = global_scope_from_object(job.get()); + let pipeline = global.pipeline_id(); + global.enqueue_promise_job(EnqueuedPromiseCallback { callback: PromiseJobCallback::new(job.get()), pipeline: pipeline, }); -- cgit v1.2.3 From c66cf46bee6306ba8cb51f22c0d704c31c17d0fd Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Wed, 5 Oct 2016 10:24:21 +0200 Subject: Make the closure in flush_promise_jobs return a Root --- components/script/script_runtime.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'components/script/script_runtime.rs') diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index 145ef1ef19e..c1da1104cd4 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -8,8 +8,8 @@ use dom::bindings::callback::ExceptionHandling; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback; -use dom::bindings::global::{GlobalRoot, global_scope_from_object}; -use dom::bindings::js::{RootCollection, RootCollectionPtr, trace_roots}; +use dom::bindings::global::global_scope_from_object; +use dom::bindings::js::{Root, RootCollection, RootCollectionPtr, trace_roots}; use dom::bindings::refcounted::{LiveDOMReferences, trace_refcounted_objects}; use dom::bindings::trace::trace_traceables; use dom::bindings::utils::DOM_CALLBACKS; @@ -150,7 +150,7 @@ impl PromiseJobQueue { /// Perform a microtask checkpoint, by invoking all of the pending promise job callbacks in /// FIFO order (#4283). pub fn flush_promise_jobs(&self, target_provider: F) - where F: Fn(PipelineId) -> Option + where F: Fn(PipelineId) -> Option> { self.pending_promise_job_runnable.set(false); { @@ -162,7 +162,7 @@ impl PromiseJobQueue { // `flushing_queue` is a static snapshot during this checkpoint. for job in &*self.flushing_job_queue.borrow() { if let Some(target) = target_provider(job.pipeline) { - let _ = job.callback.Call_(&target.r(), ExceptionHandling::Report); + let _ = job.callback.Call_(&*target, ExceptionHandling::Report); } } self.flushing_job_queue.borrow_mut().clear(); -- cgit v1.2.3 From b6bbd41e11a8d73f884b7011905c05bd3efec3cd Mon Sep 17 00:00:00 2001 From: Anthony Ramine Date: Wed, 5 Oct 2016 10:29:38 +0200 Subject: Remove GlobalRoot and GlobalRef --- components/script/script_runtime.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'components/script/script_runtime.rs') diff --git a/components/script/script_runtime.rs b/components/script/script_runtime.rs index c1da1104cd4..603e24a1468 100644 --- a/components/script/script_runtime.rs +++ b/components/script/script_runtime.rs @@ -8,7 +8,6 @@ use dom::bindings::callback::ExceptionHandling; use dom::bindings::cell::DOMRefCell; use dom::bindings::codegen::Bindings::PromiseBinding::PromiseJobCallback; -use dom::bindings::global::global_scope_from_object; use dom::bindings::js::{Root, RootCollection, RootCollectionPtr, trace_roots}; use dom::bindings::refcounted::{LiveDOMReferences, trace_refcounted_objects}; use dom::bindings::trace::trace_traceables; @@ -178,7 +177,7 @@ unsafe extern "C" fn enqueue_job(_cx: *mut JSContext, _allocation_site: HandleObject, _data: *mut c_void) -> bool { let result = panic::catch_unwind(AssertUnwindSafe(|| { - let global = global_scope_from_object(job.get()); + let global = GlobalScope::from_object(job.get()); let pipeline = global.pipeline_id(); global.enqueue_promise_job(EnqueuedPromiseCallback { callback: PromiseJobCallback::new(job.get()), -- cgit v1.2.3