Store microtask queues in Rc<T>

This commit is contained in:
Anthony Ramine 2017-09-13 10:09:43 +02:00
parent fe29037e89
commit 7f9f95b7ce
3 changed files with 10 additions and 5 deletions

View file

@ -91,7 +91,9 @@ pub struct WorkerGlobalScope {
/// `IpcSender` doesn't exist /// `IpcSender` doesn't exist
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>, from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
microtask_queue: MicrotaskQueue, /// https://html.spec.whatwg.org/multipage/#microtask-queue
#[ignore_heap_size_of = "Rc<T> is hard"]
microtask_queue: Rc<MicrotaskQueue>,
navigation_start_precise: f64, navigation_start_precise: f64,
performance: MutNullableJS<Performance>, performance: MutNullableJS<Performance>,

View file

@ -36,6 +36,7 @@ use script_traits::TimerSchedulerMsg;
use servo_url::ImmutableOrigin; use servo_url::ImmutableOrigin;
use servo_url::MutableOrigin; use servo_url::MutableOrigin;
use servo_url::ServoUrl; use servo_url::ServoUrl;
use std::rc::Rc;
use std::sync::Arc; use std::sync::Arc;
use std::sync::mpsc::Sender; use std::sync::mpsc::Sender;
@ -46,8 +47,9 @@ pub struct WorkletGlobalScope {
globalscope: GlobalScope, globalscope: GlobalScope,
/// The base URL for this worklet. /// The base URL for this worklet.
base_url: ServoUrl, base_url: ServoUrl,
/// The microtask queue for this worklet /// https://html.spec.whatwg.org/multipage/#microtask-queue
microtask_queue: MicrotaskQueue, #[ignore_heap_size_of = "Rc<T> is hard"]
microtask_queue: Rc<MicrotaskQueue>,
/// Sender back to the script thread /// Sender back to the script thread
#[ignore_heap_size_of = "channels are hard"] #[ignore_heap_size_of = "channels are hard"]
to_script_thread_sender: Sender<MainThreadScriptMsg>, to_script_thread_sender: Sender<MainThreadScriptMsg>,

View file

@ -515,7 +515,8 @@ pub struct ScriptThread {
content_process_shutdown_chan: IpcSender<()>, content_process_shutdown_chan: IpcSender<()>,
microtask_queue: MicrotaskQueue, /// https://html.spec.whatwg.org/multipage/#microtask-queue
microtask_queue: Rc<MicrotaskQueue>,
/// Microtask Queue for adding support for mutation observer microtasks /// Microtask Queue for adding support for mutation observer microtasks
mutation_observer_compound_microtask_queued: Cell<bool>, mutation_observer_compound_microtask_queued: Cell<bool>,
@ -892,7 +893,7 @@ impl ScriptThread {
content_process_shutdown_chan: state.content_process_shutdown_chan, content_process_shutdown_chan: state.content_process_shutdown_chan,
microtask_queue: MicrotaskQueue::default(), microtask_queue: Default::default(),
mutation_observer_compound_microtask_queued: Default::default(), mutation_observer_compound_microtask_queued: Default::default(),