mirror of
https://github.com/servo/servo.git
synced 2025-06-13 10:54:29 +00:00
Fix non_upper_case_globals
warnings
This commit is contained in:
parent
01d4739d16
commit
dc72119998
6 changed files with 21 additions and 21 deletions
|
@ -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()),
|
||||
|
|
|
@ -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()));
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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) },
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue