aboutsummaryrefslogtreecommitdiffstats
path: root/components/script/script_task.rs
diff options
context:
space:
mode:
authorMs2ger <ms2ger@gmail.com>2015-01-02 12:45:28 +0100
committerJosh Matthews <josh@joshmatthews.net>2015-01-08 09:58:46 -0500
commit16c7060bc8ff91527ae97f8a3feee5706747b9c5 (patch)
tree0cc29f2cc50c729d3a8f9521a22991fad67b9afd /components/script/script_task.rs
parentcf616b90a236f88058dbad74b568b4d4379d2829 (diff)
downloadservo-16c7060bc8ff91527ae97f8a3feee5706747b9c5.tar.gz
servo-16c7060bc8ff91527ae97f8a3feee5706747b9c5.zip
Update rustc to revision 2cfb5acb5a2751c759627377e602bac4f88f2d19.
Diffstat (limited to 'components/script/script_task.rs')
-rw-r--r--components/script/script_task.rs13
1 files changed, 9 insertions, 4 deletions
diff --git a/components/script/script_task.rs b/components/script/script_task.rs
index 88e6ed860a5..9a38f96ffbb 100644
--- a/components/script/script_task.rs
+++ b/components/script/script_task.rs
@@ -14,7 +14,8 @@ use dom::bindings::codegen::InheritTypes::{ElementCast, EventTargetCast, NodeCas
use dom::bindings::conversions::FromJSValConvertible;
use dom::bindings::conversions::StringificationBehavior;
use dom::bindings::global::GlobalRef;
-use dom::bindings::js::{JS, JSRef, RootCollection, Temporary, OptionalRootable};
+use dom::bindings::js::{JS, JSRef, Temporary, OptionalRootable};
+use dom::bindings::js::{RootCollection, RootCollectionPtr};
use dom::bindings::refcounted::LiveDOMReferences;
use dom::bindings::trace::JSTraceable;
use dom::bindings::utils::{wrap_for_same_compartment, pre_wrap};
@@ -76,6 +77,7 @@ use url::Url;
use libc;
use libc::size_t;
use std::any::{Any, AnyRefExt};
+use std::cell::Cell;
use std::comm::{channel, Sender, Receiver, Select};
use std::fmt::{mod, Show};
use std::mem::replace;
@@ -83,8 +85,9 @@ use std::rc::Rc;
use std::u32;
use time::{Tm, strptime};
-local_data_key!(pub StackRoots: *const RootCollection)
+thread_local!(pub static StackRoots: Cell<Option<RootCollectionPtr>> = Cell::new(None))
+#[deriving(Copy)]
pub enum TimerSource {
FromWindow(PipelineId),
FromWorker
@@ -158,14 +161,16 @@ pub struct StackRootTLS;
impl StackRootTLS {
pub fn new(roots: &RootCollection) -> StackRootTLS {
- StackRoots.replace(Some(roots as *const RootCollection));
+ StackRoots.with(|ref r| {
+ r.set(Some(RootCollectionPtr(roots as *const _)))
+ });
StackRootTLS
}
}
impl Drop for StackRootTLS {
fn drop(&mut self) {
- let _ = StackRoots.replace(None);
+ StackRoots.with(|ref r| r.set(None));
}
}