diff options
author | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2014-10-21 02:20:28 +0900 |
---|---|---|
committer | Tetsuharu OHZEKI <saneyuki.snyk@gmail.com> | 2014-10-22 10:01:01 +0900 |
commit | bf22a473fa968854e5c9ca3aacf65501a15f8e68 (patch) | |
tree | d66d4d50fad6828778752043986843c86e3a4770 | |
parent | 71b4143d32398623f584e93d9fdc2e862344301f (diff) | |
download | servo-bf22a473fa968854e5c9ca3aacf65501a15f8e68.tar.gz servo-bf22a473fa968854e5c9ca3aacf65501a15f8e68.zip |
Use DOMRefCell for TimerManager.
-rw-r--r-- | components/script/timers.rs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/components/script/timers.rs b/components/script/timers.rs index d6fe8cb206c..ba9141aebd1 100644 --- a/components/script/timers.rs +++ b/components/script/timers.rs @@ -2,6 +2,8 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +use dom::bindings::cell::DOMRefCell; + use script_task::{FireTimerMsg, ScriptChan}; use script_task::{TimerSource, FromWindow, FromWorker}; @@ -12,7 +14,7 @@ use js::jsapi::{JSContext, JSObject}; use js::jsval::{JSVal, NullValue}; use js::rust::with_compartment; -use std::cell::{Cell, RefCell}; +use std::cell::Cell; use std::cmp; use std::collections::hashmap::HashMap; use std::comm::{channel, Sender}; @@ -50,7 +52,7 @@ impl TimerHandle { #[jstraceable] #[privatize] pub struct TimerManager { - active_timers: RefCell<HashMap<TimerId, TimerHandle>>, + active_timers: DOMRefCell<HashMap<TimerId, TimerHandle>>, next_timer_handle: Cell<i32>, } @@ -77,7 +79,7 @@ struct TimerData { impl TimerManager { pub fn new() -> TimerManager { TimerManager { - active_timers: RefCell::new(HashMap::new()), + active_timers: DOMRefCell::new(HashMap::new()), next_timer_handle: Cell::new(0) } } |