mirror of
https://github.com/servo/servo.git
synced 2025-06-10 09:33:13 +00:00
Take WorkerGlobalScope's worker_id out of its Option.
Unsurprisingly, every worker has an id, so there is no need to wrap it in an Option.
This commit is contained in:
parent
1809748dc1
commit
bd04cecceb
4 changed files with 8 additions and 8 deletions
|
@ -125,7 +125,7 @@ impl<'a> GlobalRef<'a> {
|
|||
pub fn get_worker_id(&self) -> Option<WorkerId> {
|
||||
match *self {
|
||||
GlobalRef::Window(_) => None,
|
||||
GlobalRef::Worker(ref worker) => worker.get_worker_id(),
|
||||
GlobalRef::Worker(ref worker) => Some(worker.get_worker_id()),
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
parent_sender: Box<ScriptChan+Send>,
|
||||
own_sender: Sender<(TrustedWorkerAddress, ScriptMsg)>,
|
||||
receiver: Receiver<(TrustedWorkerAddress, ScriptMsg)>,
|
||||
worker_id: Option<WorkerId>)
|
||||
worker_id: WorkerId)
|
||||
-> DedicatedWorkerGlobalScope {
|
||||
DedicatedWorkerGlobalScope {
|
||||
workerglobalscope: WorkerGlobalScope::new_inherited(
|
||||
|
@ -146,7 +146,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
parent_sender: Box<ScriptChan+Send>,
|
||||
own_sender: Sender<(TrustedWorkerAddress, ScriptMsg)>,
|
||||
receiver: Receiver<(TrustedWorkerAddress, ScriptMsg)>,
|
||||
worker_id: Option<WorkerId>)
|
||||
worker_id: WorkerId)
|
||||
-> Root<DedicatedWorkerGlobalScope> {
|
||||
let scope = box DedicatedWorkerGlobalScope::new_inherited(
|
||||
worker_url, id, mem_profiler_chan, devtools_chan, devtools_sender, devtools_port,
|
||||
|
@ -170,7 +170,7 @@ impl DedicatedWorkerGlobalScope {
|
|||
parent_sender: Box<ScriptChan+Send>,
|
||||
own_sender: Sender<(TrustedWorkerAddress, ScriptMsg)>,
|
||||
receiver: Receiver<(TrustedWorkerAddress, ScriptMsg)>,
|
||||
worker_id: Option<WorkerId>) {
|
||||
worker_id: WorkerId) {
|
||||
let serialized_worker_url = worker_url.serialize();
|
||||
spawn_named(format!("WebWorker for {}", serialized_worker_url), move || {
|
||||
task_state::initialize(SCRIPT | IN_WORKER);
|
||||
|
|
|
@ -98,7 +98,7 @@ impl Worker {
|
|||
DedicatedWorkerGlobalScope::run_worker_scope(
|
||||
worker_url, global.pipeline(), global.mem_profiler_chan(), global.devtools_chan(),
|
||||
optional_sender, devtools_receiver, worker_ref, resource_task,
|
||||
constellation_chan, global.script_chan(), sender, receiver, Some(worker_id));
|
||||
constellation_chan, global.script_chan(), sender, receiver, worker_id);
|
||||
|
||||
Ok(worker)
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ pub enum WorkerGlobalScopeTypeId {
|
|||
#[dom_struct]
|
||||
pub struct WorkerGlobalScope {
|
||||
eventtarget: EventTarget,
|
||||
worker_id: Option<WorkerId>,
|
||||
worker_id: WorkerId,
|
||||
worker_url: Url,
|
||||
runtime: Rc<Runtime>,
|
||||
next_worker_id: Cell<WorkerId>,
|
||||
|
@ -84,7 +84,7 @@ impl WorkerGlobalScope {
|
|||
devtools_sender: Option<IpcSender<DevtoolScriptControlMsg>>,
|
||||
devtools_receiver: Receiver<DevtoolScriptControlMsg>,
|
||||
constellation_chan: ConstellationChan,
|
||||
worker_id: Option<WorkerId>)
|
||||
worker_id: WorkerId)
|
||||
-> WorkerGlobalScope {
|
||||
WorkerGlobalScope {
|
||||
eventtarget: EventTarget::new_inherited(EventTargetTypeId::WorkerGlobalScope(type_id)),
|
||||
|
@ -144,7 +144,7 @@ impl WorkerGlobalScope {
|
|||
&self.worker_url
|
||||
}
|
||||
|
||||
pub fn get_worker_id(&self) -> Option<WorkerId> {
|
||||
pub fn get_worker_id(&self) -> WorkerId {
|
||||
self.worker_id.clone()
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue