mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
script: Implement jsglue trap for runJobs()
Co-authored-by: atbrakhi <atbrakhi@igalia.com> Signed-off-by: Delan Azabani <dazabani@igalia.com>
This commit is contained in:
parent
554b2da1ad
commit
cc5a4d9436
2 changed files with 15 additions and 3 deletions
6
Cargo.lock
generated
6
Cargo.lock
generated
|
@ -5239,7 +5239,7 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozjs"
|
name = "mozjs"
|
||||||
version = "0.14.1"
|
version = "0.14.1"
|
||||||
source = "git+https://github.com/servo/mozjs#b23161580b082e1ccfa3273d94f43f6168aedc3d"
|
source = "git+https://github.com/servo/mozjs#4035b0c4e9e2df5cacc68c4b71e7375a48605902"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen 0.71.1",
|
"bindgen 0.71.1",
|
||||||
"cc",
|
"cc",
|
||||||
|
@ -5250,8 +5250,8 @@ dependencies = [
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozjs_sys"
|
name = "mozjs_sys"
|
||||||
version = "0.128.13-2"
|
version = "0.128.13-3"
|
||||||
source = "git+https://github.com/servo/mozjs#b23161580b082e1ccfa3273d94f43f6168aedc3d"
|
source = "git+https://github.com/servo/mozjs#4035b0c4e9e2df5cacc68c4b71e7375a48605902"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"bindgen 0.71.1",
|
"bindgen 0.71.1",
|
||||||
"cc",
|
"cc",
|
||||||
|
|
|
@ -87,6 +87,7 @@ use crate::task_source::SendableTaskSource;
|
||||||
static JOB_QUEUE_TRAPS: JobQueueTraps = JobQueueTraps {
|
static JOB_QUEUE_TRAPS: JobQueueTraps = JobQueueTraps {
|
||||||
getIncumbentGlobal: Some(get_incumbent_global),
|
getIncumbentGlobal: Some(get_incumbent_global),
|
||||||
enqueuePromiseJob: Some(enqueue_promise_job),
|
enqueuePromiseJob: Some(enqueue_promise_job),
|
||||||
|
runJobs: Some(run_jobs),
|
||||||
empty: Some(empty),
|
empty: Some(empty),
|
||||||
pushNewInterruptQueue: Some(push_new_interrupt_queue),
|
pushNewInterruptQueue: Some(push_new_interrupt_queue),
|
||||||
popInterruptQueue: Some(pop_interrupt_queue),
|
popInterruptQueue: Some(pop_interrupt_queue),
|
||||||
|
@ -241,6 +242,17 @@ unsafe extern "C" fn get_incumbent_global(_: *const c_void, _: *mut RawJSContext
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[allow(unsafe_code)]
|
||||||
|
unsafe extern "C" fn run_jobs(microtask_queue: *const c_void, cx: *mut RawJSContext) {
|
||||||
|
let cx = JSContext::from_ptr(cx);
|
||||||
|
wrap_panic(&mut || {
|
||||||
|
let microtask_queue = &*(microtask_queue as *const MicrotaskQueue);
|
||||||
|
// TODO: run Promise- and User-variant Microtasks, and do #notify-about-rejected-promises.
|
||||||
|
// Those will require real `target_provider` and `globalscopes` values.
|
||||||
|
microtask_queue.checkpoint(cx, |_| None, vec![], CanGc::note());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#[allow(unsafe_code)]
|
#[allow(unsafe_code)]
|
||||||
unsafe extern "C" fn empty(extra: *const c_void) -> bool {
|
unsafe extern "C" fn empty(extra: *const c_void) -> bool {
|
||||||
let mut result = false;
|
let mut result = false;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue