diff options
author | bors-servo <metajack+bors@gmail.com> | 2015-03-27 13:33:56 -0600 |
---|---|---|
committer | bors-servo <metajack+bors@gmail.com> | 2015-03-27 13:33:56 -0600 |
commit | 439e3150d74453b86abbcc7934b7e5152f102940 (patch) | |
tree | 31476b5ae3793db41cf678be6a2e39f9ff54e5f8 /components/script/dom/window.rs | |
parent | 5dd43bf84c78063b6eaf505cab253c1666d969ce (diff) | |
parent | 1244f9e0162e4aebbea701e68363618733780f91 (diff) | |
download | servo-439e3150d74453b86abbcc7934b7e5152f102940.tar.gz servo-439e3150d74453b86abbcc7934b7e5152f102940.zip |
auto merge of #5181 : thiagopnts/servo/master, r=jdm
This is for #4704. I'm not sure if this is the best approach, so I'm open to suggestions.
Diffstat (limited to 'components/script/dom/window.rs')
-rw-r--r-- | components/script/dom/window.rs | 12 |
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(), |