mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Remove reference counting from the Runtime implementation.
This commit is contained in:
parent
9abe47b76f
commit
cfe240d117
7 changed files with 17 additions and 15 deletions
|
@ -36,10 +36,11 @@ use util::task_state::{SCRIPT, IN_WORKER};
|
|||
use js::jsapi::JSContext;
|
||||
use js::jsval::JSVal;
|
||||
use js::rust::Runtime;
|
||||
|
||||
use std::sync::mpsc::{Sender, Receiver, channel};
|
||||
use url::Url;
|
||||
|
||||
use std::rc::Rc;
|
||||
use std::sync::mpsc::{Sender, Receiver, channel};
|
||||
|
||||
/// A ScriptChan that can be cloned freely and will silently send a TrustedWorkerAddress with
|
||||
/// every message. While this SendableWorkerScriptChan is alive, the associated Worker object
|
||||
/// will remain alive.
|
||||
|
@ -105,7 +106,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
fn new_inherited(worker_url: Url,
|
||||
id: PipelineId,
|
||||
devtools_chan: Option<DevtoolsControlChan>,
|
||||
runtime: Runtime,
|
||||
runtime: Rc<Runtime>,
|
||||
resource_task: ResourceTask,
|
||||
parent_sender: Box<ScriptChan+Send>,
|
||||
own_sender: Sender<(TrustedWorkerAddress, ScriptMsg)>,
|
||||
|
@ -126,7 +127,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
pub fn new(worker_url: Url,
|
||||
id: PipelineId,
|
||||
devtools_chan: Option<DevtoolsControlChan>,
|
||||
runtime: Runtime,
|
||||
runtime: Rc<Runtime>,
|
||||
resource_task: ResourceTask,
|
||||
parent_sender: Box<ScriptChan+Send>,
|
||||
own_sender: Sender<(TrustedWorkerAddress, ScriptMsg)>,
|
||||
|
@ -166,7 +167,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
}
|
||||
};
|
||||
|
||||
let runtime = ScriptTask::new_rt_and_cx();
|
||||
let runtime = Rc::new(ScriptTask::new_rt_and_cx());
|
||||
let global = DedicatedWorkerGlobalScope::new(
|
||||
worker_url, id, devtools_chan, runtime.clone(), resource_task,
|
||||
parent_sender, own_sender, receiver).root();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue