diff options
author | Matthew Rasmus <mattr@zzntd.com> | 2015-01-07 19:07:27 -0800 |
---|---|---|
committer | Matthew Rasmus <mattr@zzntd.com> | 2015-01-08 08:51:11 -0800 |
commit | dc721199985feaf94d23af3e7c5ab2a12e15bcbe (patch) | |
tree | 62111fce4d1cb4dac19ee085f23aeeb67bf526a4 /components | |
parent | 01d4739d168aaa8c3b1ec4b4e6f1ab99a0596251 (diff) | |
download | servo-dc721199985feaf94d23af3e7c5ab2a12e15bcbe.tar.gz servo-dc721199985feaf94d23af3e7c5ab2a12e15bcbe.zip |
Fix `non_upper_case_globals` warnings
Diffstat (limited to 'components')
-rw-r--r-- | components/layout/context.rs | 4 | ||||
-rw-r--r-- | components/layout/layout_debug.rs | 12 | ||||
-rw-r--r-- | components/script/dom/bindings/js.rs | 6 | ||||
-rw-r--r-- | components/script/dom/bindings/refcounted.rs | 10 | ||||
-rw-r--r-- | components/script/script_task.rs | 6 | ||||
-rw-r--r-- | components/util/tid.rs | 4 |
6 files changed, 21 insertions, 21 deletions
diff --git a/components/layout/context.rs b/components/layout/context.rs index 7a5b0454ab8..dd88741aed5 100644 --- a/components/layout/context.rs +++ b/components/layout/context.rs @@ -28,10 +28,10 @@ struct LocalLayoutContext { style_sharing_candidate_cache: StyleSharingCandidateCache, } -thread_local!(static local_context_key: Cell<*mut LocalLayoutContext> = Cell::new(ptr::null_mut())) +thread_local!(static LOCAL_CONTEXT_KEY: Cell<*mut LocalLayoutContext> = Cell::new(ptr::null_mut())) fn create_or_get_local_context(shared_layout_context: &SharedLayoutContext) -> *mut LocalLayoutContext { - local_context_key.with(|ref r| { + LOCAL_CONTEXT_KEY.with(|ref r| { if r.get().is_null() { let context = box LocalLayoutContext { font_context: FontContext::new(shared_layout_context.font_cache_task.clone()), diff --git a/components/layout/layout_debug.rs b/components/layout/layout_debug.rs index f16a18e1dfb..94ddad456f6 100644 --- a/components/layout/layout_debug.rs +++ b/components/layout/layout_debug.rs @@ -14,7 +14,7 @@ use std::cell::RefCell; use std::io::File; use std::sync::atomic::{AtomicUint, SeqCst, INIT_ATOMIC_UINT}; -thread_local!(static state_key: RefCell<Option<State>> = RefCell::new(None)) +thread_local!(static STATE_KEY: RefCell<Option<State>> = RefCell::new(None)) static mut DEBUG_ID_COUNTER: AtomicUint = INIT_ATOMIC_UINT; @@ -59,7 +59,7 @@ struct State { /// will be output at the beginning and end of this scope. impl Scope { pub fn new(name: String) -> Scope { - state_key.with(|ref r| { + STATE_KEY.with(|ref r| { match &mut *r.borrow_mut() { &Some(ref mut state) => { let flow_trace = json::encode(&flow::base(state.flow_root.deref())); @@ -76,7 +76,7 @@ impl Scope { #[cfg(not(ndebug))] impl Drop for Scope { fn drop(&mut self) { - state_key.with(|ref r| { + STATE_KEY.with(|ref r| { match &mut *r.borrow_mut() { &Some(ref mut state) => { let mut current_scope = state.scope_stack.pop().unwrap(); @@ -100,9 +100,9 @@ pub fn generate_unique_debug_id() -> u16 { /// Begin a layout debug trace. If this has not been called, /// creating debug scopes has no effect. pub fn begin_trace(flow_root: FlowRef) { - assert!(state_key.with(|ref r| r.borrow().is_none())); + assert!(STATE_KEY.with(|ref r| r.borrow().is_none())); - state_key.with(|ref r| { + STATE_KEY.with(|ref r| { let flow_trace = json::encode(&flow::base(flow_root.deref())); let state = State { scope_stack: vec![box ScopeData::new("root".into_string(), flow_trace)], @@ -116,7 +116,7 @@ pub fn begin_trace(flow_root: FlowRef) { /// trace to disk in the current directory. The output /// file can then be viewed with an external tool. pub fn end_trace() { - let mut task_state = state_key.with(|ref r| r.borrow_mut().take().unwrap()); + let mut task_state = STATE_KEY.with(|ref r| r.borrow_mut().take().unwrap()); assert!(task_state.scope_stack.len() == 1); let mut root_scope = task_state.scope_stack.pop().unwrap(); root_scope.post = json::encode(&flow::base(task_state.flow_root.deref())); diff --git a/components/script/dom/bindings/js.rs b/components/script/dom/bindings/js.rs index a0c099769f0..ac8da0f8ba6 100644 --- a/components/script/dom/bindings/js.rs +++ b/components/script/dom/bindings/js.rs @@ -51,7 +51,7 @@ use dom::node::Node; use js::jsapi::JSObject; use js::jsval::JSVal; use layout_interface::TrustedNodeAddress; -use script_task::StackRoots; +use script_task::STACK_ROOTS; use servo_util::smallvec::{SmallVec, SmallVec16}; use std::cell::{Cell, UnsafeCell}; @@ -101,7 +101,7 @@ impl<T: Reflectable> Temporary<T> { /// Create a stack-bounded root for this value. pub fn root(self) -> Root<T> { - StackRoots.with(|ref collection| { + STACK_ROOTS.with(|ref collection| { let RootCollectionPtr(collection) = collection.get().unwrap(); unsafe { Root::new(&*collection, &self.inner) @@ -164,7 +164,7 @@ impl<T: Reflectable> JS<T> { /// Root this JS-owned value to prevent its collection as garbage. pub fn root(&self) -> Root<T> { - StackRoots.with(|ref collection| { + STACK_ROOTS.with(|ref collection| { let RootCollectionPtr(collection) = collection.get().unwrap(); unsafe { Root::new(&*collection, self) diff --git a/components/script/dom/bindings/refcounted.rs b/components/script/dom/bindings/refcounted.rs index 1f6149394f2..adf7d71fde5 100644 --- a/components/script/dom/bindings/refcounted.rs +++ b/components/script/dom/bindings/refcounted.rs @@ -36,7 +36,7 @@ use std::collections::hash_map::{HashMap, Vacant, Occupied}; use std::rc::Rc; use std::sync::{Arc, Mutex}; -thread_local!(pub static LiveReferences: Rc<RefCell<Option<LiveDOMReferences>>> = Rc::new(RefCell::new(None))) +thread_local!(pub static LIVE_REFERENCES: Rc<RefCell<Option<LiveDOMReferences>>> = Rc::new(RefCell::new(None))) /// A safe wrapper around a raw pointer to a DOM object that can be @@ -57,7 +57,7 @@ impl<T: Reflectable> Trusted<T> { /// be prevented from being GCed for the duration of the resulting `Trusted<T>` object's /// lifetime. pub fn new(cx: *mut JSContext, ptr: JSRef<T>, script_chan: Box<ScriptChan + Send>) -> Trusted<T> { - LiveReferences.with(|ref r| { + LIVE_REFERENCES.with(|ref r| { let r = r.borrow(); let live_references = r.as_ref().unwrap(); let refcount = live_references.addref(cx, &*ptr as *const T); @@ -74,7 +74,7 @@ impl<T: Reflectable> Trusted<T> { /// a different thread than the original value from which this `Trusted<T>` was /// obtained. pub fn to_temporary(&self) -> Temporary<T> { - assert!(LiveReferences.with(|ref r| { + assert!(LIVE_REFERENCES.with(|ref r| { let r = r.borrow(); let live_references = r.as_ref().unwrap(); self.owner_thread == (&*live_references) as *const _ as *const libc::c_void @@ -123,7 +123,7 @@ pub struct LiveDOMReferences { impl LiveDOMReferences { /// Set up the task-local data required for storing the outstanding DOM references. pub fn initialize() { - LiveReferences.with(|ref r| { + LIVE_REFERENCES.with(|ref r| { *r.borrow_mut() = Some(LiveDOMReferences { table: RefCell::new(HashMap::new()), }) @@ -152,7 +152,7 @@ impl LiveDOMReferences { /// Unpin the given DOM object if its refcount is 0. pub fn cleanup(cx: *mut JSContext, raw_reflectable: *const libc::c_void) { - LiveReferences.with(|ref r| { + LIVE_REFERENCES.with(|ref r| { let r = r.borrow(); let live_references = r.as_ref().unwrap(); let reflectable = raw_reflectable as *const Reflector; diff --git a/components/script/script_task.rs b/components/script/script_task.rs index faefda42904..cb757d97f93 100644 --- a/components/script/script_task.rs +++ b/components/script/script_task.rs @@ -85,7 +85,7 @@ use std::rc::Rc; use std::u32; use time::{Tm, strptime}; -thread_local!(pub static StackRoots: Cell<Option<RootCollectionPtr>> = Cell::new(None)) +thread_local!(pub static STACK_ROOTS: Cell<Option<RootCollectionPtr>> = Cell::new(None)) #[deriving(Copy)] pub enum TimerSource { @@ -161,7 +161,7 @@ pub struct StackRootTLS; impl StackRootTLS { pub fn new(roots: &RootCollection) -> StackRootTLS { - StackRoots.with(|ref r| { + STACK_ROOTS.with(|ref r| { r.set(Some(RootCollectionPtr(roots as *const _))) }); StackRootTLS @@ -170,7 +170,7 @@ impl StackRootTLS { impl Drop for StackRootTLS { fn drop(&mut self) { - StackRoots.with(|ref r| r.set(None)); + STACK_ROOTS.with(|ref r| r.set(None)); } } diff --git a/components/util/tid.rs b/components/util/tid.rs index a1e24147019..5cea4fe0d43 100644 --- a/components/util/tid.rs +++ b/components/util/tid.rs @@ -8,11 +8,11 @@ use std::cell::RefCell; static mut next_tid: AtomicUint = INIT_ATOMIC_UINT; -thread_local!(static task_local_tid: Rc<RefCell<Option<uint>>> = Rc::new(RefCell::new(None))) +thread_local!(static TASK_LOCAL_TID: Rc<RefCell<Option<uint>>> = Rc::new(RefCell::new(None))) /// Every task gets one, that's unique. pub fn tid() -> uint { - task_local_tid.with(|ref k| { + TASK_LOCAL_TID.with(|ref k| { let ret = match *k.borrow() { None => unsafe { next_tid.fetch_add(1, SeqCst) }, |