Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop reference-counting Runtime for workers. #10268

Merged
merged 1 commit into from Mar 30, 2016
Merged
Changes from all commits
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

@@ -32,7 +32,6 @@ use script_thread::ScriptThreadEventCategory::WorkerEvent;
use script_thread::{ScriptThread, ScriptChan, ScriptPort, StackRootTLS, CommonScriptMsg};
use script_traits::{TimerEvent, TimerSource};
use std::mem::replace;
use std::rc::Rc;
use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
use url::Url;
use util::str::DOMString;
@@ -158,7 +157,7 @@ impl DedicatedWorkerGlobalScope {
worker_url: Url,
id: PipelineId,
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
runtime: Rc<Runtime>,
runtime: Runtime,
parent_sender: Box<ScriptChan + Send>,
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>,
@@ -185,24 +184,25 @@ impl DedicatedWorkerGlobalScope {
worker_url: Url,
id: PipelineId,
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
runtime: Rc<Runtime>,
runtime: Runtime,
parent_sender: Box<ScriptChan + Send>,
own_sender: Sender<(TrustedWorkerAddress, WorkerScriptMsg)>,
receiver: Receiver<(TrustedWorkerAddress, WorkerScriptMsg)>,
timer_event_chan: IpcSender<TimerEvent>,
timer_event_port: Receiver<(TrustedWorkerAddress, TimerEvent)>)
-> Root<DedicatedWorkerGlobalScope> {
let cx = runtime.cx();
let scope = box DedicatedWorkerGlobalScope::new_inherited(init,
worker_url,
id,
from_devtools_receiver,
runtime.clone(),
runtime,
parent_sender,
own_sender,
receiver,
timer_event_chan,
timer_event_port);
DedicatedWorkerGlobalScopeBinding::Wrap(runtime.cx(), scope)
DedicatedWorkerGlobalScopeBinding::Wrap(cx, scope)
}

pub fn run_worker_scope(init: WorkerGlobalScopeInit,
@@ -235,7 +235,7 @@ impl DedicatedWorkerGlobalScope {
}
};

let runtime = Rc::new(ScriptThread::new_rt_and_cx());
let runtime = ScriptThread::new_rt_and_cx();

let (devtools_mpsc_chan, devtools_mpsc_port) = channel();
ROUTER.route_ipc_receiver_to_mpsc_sender(from_devtools_receiver, devtools_mpsc_chan);
@@ -249,7 +249,7 @@ impl DedicatedWorkerGlobalScope {
});

let global = DedicatedWorkerGlobalScope::new(
init, url, id, devtools_mpsc_port, runtime.clone(),
init, url, id, devtools_mpsc_port, runtime,
parent_sender.clone(), own_sender, receiver,
timer_ipc_chan, timer_rx);
// FIXME(njn): workers currently don't have a unique ID suitable for using in reporter
@@ -55,8 +55,8 @@ pub struct WorkerGlobalScope {
eventtarget: EventTarget,
worker_id: WorkerId,
worker_url: Url,
#[ignore_heap_size_of = "Defined in std"]
runtime: Rc<Runtime>,
#[ignore_heap_size_of = "Defined in js"]
runtime: Runtime,
next_worker_id: Cell<WorkerId>,
#[ignore_heap_size_of = "Defined in std"]

This comment has been minimized.

@emilio

emilio Mar 29, 2016

Member

This comment might deserve to be updated?

resource_thread: ResourceThread,
@@ -94,7 +94,7 @@ pub struct WorkerGlobalScope {
impl WorkerGlobalScope {
pub fn new_inherited(init: WorkerGlobalScopeInit,
worker_url: Url,
runtime: Rc<Runtime>,
runtime: Runtime,
from_devtools_receiver: Receiver<DevtoolScriptControlMsg>,
timer_event_chan: IpcSender<TimerEvent>)
-> WorkerGlobalScope {
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.