aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/dom/window.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r--components/script/dom/window.rs12
1 files changed, 11 insertions, 1 deletions
diff --git a/components/script/dom/window.rs b/components/script/dom/window.rs
index bb7a5563d0f..ce7dc34e77d 100644
--- a/components/script/dom/window.rs
+++ b/components/script/dom/window.rs
@@ -36,7 +36,7 @@ use timers::{IsInterval, TimerId, TimerManager, TimerCallback};
use devtools_traits::DevtoolsControlChan;
use msg::compositor_msg::ScriptListener;
-use msg::constellation_msg::{LoadData, PipelineId, SubpageId, ConstellationChan, WindowSizeData};
+use msg::constellation_msg::{LoadData, PipelineId, SubpageId, ConstellationChan, WindowSizeData, WorkerId};
use net::image_cache_task::ImageCacheTask;
use net::resource_task::ResourceTask;
use net::storage_task::{StorageTask, StorageType};
@@ -98,6 +98,8 @@ pub struct Window {
local_storage: MutNullableJS<Storage>,
timers: TimerManager,
+ next_worker_id: Cell<WorkerId>,
+
/// For providing instructions to an optional devtools server.
devtools_chan: Option<DevtoolsControlChan>,
@@ -171,6 +173,13 @@ impl Window {
self.script_chan.clone()
}
+ pub fn get_next_worker_id(&self) -> WorkerId {
+ let worker_id = self.next_worker_id.get();
+ let WorkerId(id_num) = worker_id;
+ self.next_worker_id.set(WorkerId(id_num + 1));
+ worker_id
+ }
+
pub fn pipeline(&self) -> PipelineId {
self.id
}
@@ -814,6 +823,7 @@ impl Window {
session_storage: Default::default(),
local_storage: Default::default(),
timers: TimerManager::new(),
+ next_worker_id: Cell::new(WorkerId(0)),
id: id,
parent_info: parent_info,
dom_static: GlobalStaticData::new(),