mirror of
https://github.com/servo/servo.git
synced 2025-06-18 05:14:28 +00:00
worker_id
type changed to uuid
Fixes #6631 `worker_id` is now generate as uuid and saved as string.
This commit is contained in:
parent
03a47c803c
commit
5c56e661ca
5 changed files with 11 additions and 10 deletions
|
@ -307,7 +307,7 @@ fn run_server(
|
||||||
let worker = WorkerActor {
|
let worker = WorkerActor {
|
||||||
name: actors.new_name("worker"),
|
name: actors.new_name("worker"),
|
||||||
console: console.name(),
|
console: console.name(),
|
||||||
id: id,
|
id: id.clone(),
|
||||||
};
|
};
|
||||||
actor_workers.insert((pipeline, id), worker.name.clone());
|
actor_workers.insert((pipeline, id), worker.name.clone());
|
||||||
actors.register(Box::new(worker));
|
actors.register(Box::new(worker));
|
||||||
|
|
|
@ -25,6 +25,7 @@ use msg::constellation_msg::PipelineId;
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use std::net::TcpStream;
|
use std::net::TcpStream;
|
||||||
use time::{self, Duration, Tm};
|
use time::{self, Duration, Tm};
|
||||||
|
//use uuid::Uuid;
|
||||||
|
|
||||||
// Information would be attached to NewGlobal to be received and show in devtools.
|
// Information would be attached to NewGlobal to be received and show in devtools.
|
||||||
// Extend these fields if we need more information.
|
// Extend these fields if we need more information.
|
||||||
|
@ -356,5 +357,5 @@ impl PreciseTime {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
|
#[derive(Clone, Debug, Deserialize, Eq, Hash, MallocSizeOf, PartialEq, Serialize)]
|
||||||
pub struct WorkerId(pub u32);
|
pub struct WorkerId(pub String);
|
||||||
|
|
|
@ -110,7 +110,7 @@ time = "0.1.12"
|
||||||
unicode-segmentation = "1.1.0"
|
unicode-segmentation = "1.1.0"
|
||||||
url = "2.0"
|
url = "2.0"
|
||||||
utf-8 = "0.7"
|
utf-8 = "0.7"
|
||||||
uuid = {version = "0.8", features = ["v4"]}
|
uuid = {version = "0.8", features = ["v4", "serde"]}
|
||||||
xml5ever = "0.16"
|
xml5ever = "0.16"
|
||||||
webdriver = "0.40"
|
webdriver = "0.40"
|
||||||
webgpu = {path = "../webgpu"}
|
webgpu = {path = "../webgpu"}
|
||||||
|
|
|
@ -80,6 +80,7 @@ use std::rc::Rc;
|
||||||
use std::sync::atomic::{AtomicBool, Ordering};
|
use std::sync::atomic::{AtomicBool, Ordering};
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
use time::{get_time, Timespec};
|
use time::{get_time, Timespec};
|
||||||
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(JSTraceable)]
|
#[derive(JSTraceable)]
|
||||||
pub struct AutoCloseWorker(Arc<AtomicBool>);
|
pub struct AutoCloseWorker(Arc<AtomicBool>);
|
||||||
|
@ -94,7 +95,7 @@ impl Drop for AutoCloseWorker {
|
||||||
pub struct GlobalScope {
|
pub struct GlobalScope {
|
||||||
eventtarget: EventTarget,
|
eventtarget: EventTarget,
|
||||||
crypto: MutNullableDom<Crypto>,
|
crypto: MutNullableDom<Crypto>,
|
||||||
next_worker_id: Cell<WorkerId>,
|
next_worker_id: WorkerId,
|
||||||
|
|
||||||
/// The message-port router id for this global, if it is managing ports.
|
/// The message-port router id for this global, if it is managing ports.
|
||||||
message_port_state: DomRefCell<MessagePortState>,
|
message_port_state: DomRefCell<MessagePortState>,
|
||||||
|
@ -347,7 +348,7 @@ impl GlobalScope {
|
||||||
message_port_state: DomRefCell::new(MessagePortState::UnManaged),
|
message_port_state: DomRefCell::new(MessagePortState::UnManaged),
|
||||||
eventtarget: EventTarget::new_inherited(),
|
eventtarget: EventTarget::new_inherited(),
|
||||||
crypto: Default::default(),
|
crypto: Default::default(),
|
||||||
next_worker_id: Cell::new(WorkerId(0)),
|
next_worker_id: WorkerId(Uuid::new_v4().to_string()),
|
||||||
pipeline_id,
|
pipeline_id,
|
||||||
devtools_wants_updates: Default::default(),
|
devtools_wants_updates: Default::default(),
|
||||||
console_timers: DomRefCell::new(Default::default()),
|
console_timers: DomRefCell::new(Default::default()),
|
||||||
|
@ -928,9 +929,7 @@ impl GlobalScope {
|
||||||
|
|
||||||
/// Get next worker id.
|
/// Get next worker id.
|
||||||
pub fn get_next_worker_id(&self) -> WorkerId {
|
pub fn get_next_worker_id(&self) -> WorkerId {
|
||||||
let worker_id = self.next_worker_id.get();
|
let worker_id = self.next_worker_id.clone();
|
||||||
let WorkerId(id_num) = worker_id;
|
|
||||||
self.next_worker_id.set(WorkerId(id_num + 1));
|
|
||||||
worker_id
|
worker_id
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,9 @@ impl ServiceWorkerManager {
|
||||||
title: title,
|
title: title,
|
||||||
url: scope_things.script_url.clone(),
|
url: scope_things.script_url.clone(),
|
||||||
};
|
};
|
||||||
|
let worker_id = scope_things.worker_id.clone();
|
||||||
let _ = chan.send(ScriptToDevtoolsControlMsg::NewGlobal(
|
let _ = chan.send(ScriptToDevtoolsControlMsg::NewGlobal(
|
||||||
(scope_things.init.pipeline_id, Some(scope_things.worker_id)),
|
(scope_things.init.pipeline_id, Some(worker_id)),
|
||||||
devtools_sender,
|
devtools_sender,
|
||||||
page_info,
|
page_info,
|
||||||
));
|
));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue