Pass a parent JS runtime when creating DOM Worker runtimes

This enables sharing data with the parent runtime, decreasing memory usage and startup time. Also contains an update to current rust-mozjs, because that's required for this to work.
This commit is contained in:
Till Schneidereit 2016-05-24 15:28:25 +02:00
parent 2ce9eba3dc
commit 7536afff2a
7 changed files with 22 additions and 13 deletions

View file

@ -95,9 +95,9 @@ impl<'a> Drop for StackRootTLS<'a> {
}
#[allow(unsafe_code)]
pub unsafe fn new_rt_and_cx() -> Runtime {
pub unsafe fn new_rt_and_cx(parent_rt: *mut JSRuntime) -> Runtime {
LiveDOMReferences::initialize();
let runtime = Runtime::new();
let runtime = Runtime::new(parent_rt);
JS_AddExtraGCRootsTracer(runtime.rt(), Some(trace_rust_roots), ptr::null_mut());
JS_AddExtraGCRootsTracer(runtime.rt(), Some(trace_refcounted_objects), ptr::null_mut());