mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +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
|
@ -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