mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01: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()));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue