Allow wrapping worker runnables in cancellable runnables.

This commit is contained in:
Josh Matthews 2016-07-14 13:01:52 -04:00
parent 2cab846140
commit 0e4865ea1a
2 changed files with 17 additions and 1 deletions

View file

@ -29,6 +29,7 @@ use net_traits::{LoadContext, ResourceThreads, load_whole_resource};
use net_traits::{RequestSource, LoadOrigin, CustomResponseSender, IpcSend};
use profile_traits::{mem, time};
use script_runtime::{CommonScriptMsg, ScriptChan, ScriptPort, maybe_take_panic_result};
use script_thread::RunnableWrapper;
use script_traits::ScriptMsg as ConstellationMsg;
use script_traits::{MsDuration, TimerEvent, TimerEventId, TimerEventRequest, TimerSource};
use std::cell::Cell;
@ -268,6 +269,12 @@ impl WorkerGlobalScope {
pub fn panic_chan(&self) -> &IpcSender<PanicMsg> {
&self.panic_chan
}
pub fn get_runnable_wrapper(&self) -> RunnableWrapper {
RunnableWrapper {
cancelled: self.closing.clone(),
}
}
}
impl LoadOrigin for WorkerGlobalScope {