mirror of
https://github.com/servo/servo.git
synced 2025-06-10 09:33:13 +00:00
use ThreadSafeJSContext
instead of ContextForRequestInterrupt
(#33769)
* use `ThreadSafeJSContext` instead of `ContextForRequestInterrupt` Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> * use servo/mozjs Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com> --------- Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
parent
61a930402d
commit
7cd73ef4a7
10 changed files with 53 additions and 89 deletions
|
@ -145,8 +145,8 @@ use crate::microtask::{Microtask, MicrotaskQueue};
|
|||
use crate::realms::enter_realm;
|
||||
use crate::script_module::ScriptFetchOptions;
|
||||
use crate::script_runtime::{
|
||||
get_reports, new_rt_and_cx, CanGc, CommonScriptMsg, ContextForRequestInterrupt, JSContext,
|
||||
Runtime, ScriptChan, ScriptPort, ScriptThreadEventCategory,
|
||||
get_reports, new_rt_and_cx, CanGc, CommonScriptMsg, JSContext, Runtime, ScriptChan, ScriptPort,
|
||||
ScriptThreadEventCategory, ThreadSafeJSContext,
|
||||
};
|
||||
use crate::task_manager::TaskManager;
|
||||
use crate::task_queue::{QueuedTask, QueuedTaskConversion, TaskQueue};
|
||||
|
@ -734,13 +734,13 @@ pub struct ScriptThread {
|
|||
|
||||
struct BHMExitSignal {
|
||||
closing: Arc<AtomicBool>,
|
||||
js_context: ContextForRequestInterrupt,
|
||||
js_context: ThreadSafeJSContext,
|
||||
}
|
||||
|
||||
impl BackgroundHangMonitorExitSignal for BHMExitSignal {
|
||||
fn signal_to_exit(&self) {
|
||||
self.closing.store(true, Ordering::SeqCst);
|
||||
self.js_context.request_interrupt();
|
||||
self.js_context.request_interrupt_callback();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1314,7 +1314,7 @@ impl ScriptThread {
|
|||
let closing = Arc::new(AtomicBool::new(false));
|
||||
let background_hang_monitor_exit_signal = BHMExitSignal {
|
||||
closing: closing.clone(),
|
||||
js_context: ContextForRequestInterrupt::new(cx),
|
||||
js_context: runtime.thread_safe_js_context(),
|
||||
};
|
||||
|
||||
let background_hang_monitor = state.background_hang_monitor_register.register_component(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue