mirror of
https://github.com/servo/servo.git
synced 2025-07-31 11:10:22 +01:00
Auto merge of #15107 - DexterHaslem:15100-convert-debug-to-traces, r=cbrewster
convert less interesting debug! logs to traces <!-- Please describe your changes on the following line: --> converted some debug! invocations to trace! --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #15100 (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [X] These changes do not require tests because only logging changed <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15107) <!-- Reviewable:end -->
This commit is contained in:
commit
b8df502491
5 changed files with 31 additions and 31 deletions
|
@ -77,14 +77,14 @@ impl<'a> SeedableRng<&'a [usize]> for ServoRng {
|
|||
/// Note that this RNG does not reseed itself, so care is needed to reseed the RNG
|
||||
/// is required to be cryptographically sound.
|
||||
fn from_seed(seed: &[usize]) -> ServoRng {
|
||||
debug!("Creating new manually-reseeded ServoRng.");
|
||||
trace!("Creating new manually-reseeded ServoRng.");
|
||||
let isaac_rng = IsaacWordRng::from_seed(as_isaac_seed(seed));
|
||||
let reseeding_rng = ReseedingRng::new(isaac_rng, u64::MAX, ServoReseeder);
|
||||
ServoRng { rng: reseeding_rng }
|
||||
}
|
||||
/// Reseed the RNG.
|
||||
fn reseed(&mut self, seed: &'a [usize]) {
|
||||
debug!("Manually reseeding ServoRng.");
|
||||
trace!("Manually reseeding ServoRng.");
|
||||
self.rng.reseed((ServoReseeder, as_isaac_seed(seed)))
|
||||
}
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ impl ServoRng {
|
|||
/// This uses the shared `OsRng`, so avoids consuming
|
||||
/// a file descriptor.
|
||||
pub fn new() -> ServoRng {
|
||||
debug!("Creating new ServoRng.");
|
||||
trace!("Creating new ServoRng.");
|
||||
let mut os_rng = OS_RNG.lock().expect("Poisoned lock.");
|
||||
let isaac_rng = IsaacWordRng::rand(&mut *os_rng);
|
||||
let reseeding_rng = ReseedingRng::new(isaac_rng, RESEED_THRESHOLD, ServoReseeder);
|
||||
|
@ -108,7 +108,7 @@ struct ServoReseeder;
|
|||
|
||||
impl Reseeder<IsaacWordRng> for ServoReseeder {
|
||||
fn reseed(&mut self, rng: &mut IsaacWordRng) {
|
||||
debug!("Reseeding ServoRng.");
|
||||
trace!("Reseeding ServoRng.");
|
||||
let mut os_rng = OS_RNG.lock().expect("Poisoned lock.");
|
||||
*rng = IsaacWordRng::rand(&mut *os_rng);
|
||||
}
|
||||
|
|
|
@ -159,7 +159,7 @@ unsafe impl<T> Sync for ReentrantMutex<T> where T: Send {}
|
|||
|
||||
impl<T> ReentrantMutex<T> {
|
||||
pub fn new(data: T) -> ReentrantMutex<T> {
|
||||
debug!("{:?} Creating new lock.", ThreadId::current());
|
||||
trace!("{:?} Creating new lock.", ThreadId::current());
|
||||
ReentrantMutex {
|
||||
mutex: HandOverHandMutex::new(),
|
||||
count: Cell::new(0),
|
||||
|
@ -168,53 +168,53 @@ impl<T> ReentrantMutex<T> {
|
|||
}
|
||||
|
||||
pub fn lock(&self) -> LockResult<ReentrantMutexGuard<T>> {
|
||||
debug!("{:?} Locking.", ThreadId::current());
|
||||
trace!("{:?} Locking.", ThreadId::current());
|
||||
if self.mutex.owner() != Some(ThreadId::current()) {
|
||||
debug!("{:?} Becoming owner.", ThreadId::current());
|
||||
trace!("{:?} Becoming owner.", ThreadId::current());
|
||||
if let Err(_) = self.mutex.lock() {
|
||||
debug!("{:?} Poison!", ThreadId::current());
|
||||
trace!("{:?} Poison!", ThreadId::current());
|
||||
return Err(PoisonError::new(self.mk_guard()));
|
||||
}
|
||||
debug!("{:?} Became owner.", ThreadId::current());
|
||||
trace!("{:?} Became owner.", ThreadId::current());
|
||||
}
|
||||
Ok(self.mk_guard())
|
||||
}
|
||||
|
||||
pub fn try_lock(&self) -> TryLockResult<ReentrantMutexGuard<T>> {
|
||||
debug!("{:?} Try locking.", ThreadId::current());
|
||||
trace!("{:?} Try locking.", ThreadId::current());
|
||||
if self.mutex.owner() != Some(ThreadId::current()) {
|
||||
debug!("{:?} Becoming owner?", ThreadId::current());
|
||||
trace!("{:?} Becoming owner?", ThreadId::current());
|
||||
if let Err(err) = self.mutex.try_lock() {
|
||||
match err {
|
||||
TryLockError::WouldBlock => {
|
||||
debug!("{:?} Would block.", ThreadId::current());
|
||||
trace!("{:?} Would block.", ThreadId::current());
|
||||
return Err(TryLockError::WouldBlock)
|
||||
},
|
||||
TryLockError::Poisoned(_) => {
|
||||
debug!("{:?} Poison!", ThreadId::current());
|
||||
trace!("{:?} Poison!", ThreadId::current());
|
||||
return Err(TryLockError::Poisoned(PoisonError::new(self.mk_guard())));
|
||||
},
|
||||
}
|
||||
}
|
||||
debug!("{:?} Became owner.", ThreadId::current());
|
||||
trace!("{:?} Became owner.", ThreadId::current());
|
||||
}
|
||||
Ok(self.mk_guard())
|
||||
}
|
||||
|
||||
fn unlock(&self) {
|
||||
debug!("{:?} Unlocking.", ThreadId::current());
|
||||
trace!("{:?} Unlocking.", ThreadId::current());
|
||||
let count = self.count.get().checked_sub(1).expect("Underflowed lock count.");
|
||||
debug!("{:?} Decrementing count to {}.", ThreadId::current(), count);
|
||||
trace!("{:?} Decrementing count to {}.", ThreadId::current(), count);
|
||||
self.count.set(count);
|
||||
if count == 0 {
|
||||
debug!("{:?} Releasing mutex.", ThreadId::current());
|
||||
trace!("{:?} Releasing mutex.", ThreadId::current());
|
||||
self.mutex.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
fn mk_guard(&self) -> ReentrantMutexGuard<T> {
|
||||
let count = self.count.get().checked_add(1).expect("Overflowed lock count.");
|
||||
debug!("{:?} Incrementing count to {}.", ThreadId::current(), count);
|
||||
trace!("{:?} Incrementing count to {}.", ThreadId::current(), count);
|
||||
self.count.set(count);
|
||||
ReentrantMutexGuard { mutex: self }
|
||||
}
|
||||
|
|
|
@ -362,7 +362,7 @@ pub unsafe fn get_dom_class(obj: *mut JSObject) -> Result<&'static DOMClass, ()>
|
|||
let dom_class: *const DOMClass = GetProxyHandlerExtra(obj) as *const DOMClass;
|
||||
return Ok(&*dom_class);
|
||||
}
|
||||
debug!("not a dom object");
|
||||
trace!("not a dom object");
|
||||
Err(())
|
||||
}
|
||||
|
||||
|
@ -380,27 +380,27 @@ pub unsafe fn private_from_proto_check<F>(mut obj: *mut JSObject,
|
|||
{
|
||||
let dom_class = try!(get_dom_class(obj).or_else(|_| {
|
||||
if IsWrapper(obj) {
|
||||
debug!("found wrapper");
|
||||
trace!("found wrapper");
|
||||
obj = UnwrapObject(obj, /* stopAtWindowProxy = */ 0);
|
||||
if obj.is_null() {
|
||||
debug!("unwrapping security wrapper failed");
|
||||
trace!("unwrapping security wrapper failed");
|
||||
Err(())
|
||||
} else {
|
||||
assert!(!IsWrapper(obj));
|
||||
debug!("unwrapped successfully");
|
||||
trace!("unwrapped successfully");
|
||||
get_dom_class(obj)
|
||||
}
|
||||
} else {
|
||||
debug!("not a dom wrapper");
|
||||
trace!("not a dom wrapper");
|
||||
Err(())
|
||||
}
|
||||
}));
|
||||
|
||||
if proto_check(dom_class) {
|
||||
debug!("good prototype");
|
||||
trace!("good prototype");
|
||||
Ok(private_from_object(obj))
|
||||
} else {
|
||||
debug!("bad prototype");
|
||||
trace!("bad prototype");
|
||||
Err(())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -129,7 +129,7 @@ pub fn trace_jsval(tracer: *mut JSTracer, description: &str, val: &Heap<JSVal>)
|
|||
return;
|
||||
}
|
||||
|
||||
debug!("tracing value {}", description);
|
||||
trace!("tracing value {}", description);
|
||||
CallValueTracer(tracer,
|
||||
val.ptr.get() as *mut _,
|
||||
GCTraceKindToAscii(val.get().trace_kind()));
|
||||
|
@ -140,7 +140,7 @@ pub fn trace_jsval(tracer: *mut JSTracer, description: &str, val: &Heap<JSVal>)
|
|||
#[allow(unrooted_must_root)]
|
||||
pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Reflector) {
|
||||
unsafe {
|
||||
debug!("tracing reflector {}", description);
|
||||
trace!("tracing reflector {}", description);
|
||||
CallUnbarrieredObjectTracer(tracer,
|
||||
reflector.rootable(),
|
||||
GCTraceKindToAscii(TraceKind::Object));
|
||||
|
@ -150,7 +150,7 @@ pub fn trace_reflector(tracer: *mut JSTracer, description: &str, reflector: &Ref
|
|||
/// Trace a `JSObject`.
|
||||
pub fn trace_object(tracer: *mut JSTracer, description: &str, obj: &Heap<*mut JSObject>) {
|
||||
unsafe {
|
||||
debug!("tracing {}", description);
|
||||
trace!("tracing {}", description);
|
||||
CallObjectTracer(tracer,
|
||||
obj.ptr.get() as *mut _,
|
||||
GCTraceKindToAscii(TraceKind::Object));
|
||||
|
@ -734,7 +734,7 @@ impl<'a, T: JSTraceable> DerefMut for RootedVec<'a, T> {
|
|||
|
||||
/// SM Callback that traces the rooted traceables
|
||||
pub unsafe fn trace_traceables(tracer: *mut JSTracer) {
|
||||
debug!("tracing stack-rooted traceables");
|
||||
trace!("tracing stack-rooted traceables");
|
||||
ROOTED_TRACEABLES.with(|ref traceables| {
|
||||
let traceables = traceables.borrow();
|
||||
traceables.trace(tracer);
|
||||
|
|
|
@ -55,7 +55,7 @@ pub trait WeakReferenceable: DomObject + Sized {
|
|||
DOM_WEAK_SLOT)
|
||||
.to_private() as *mut WeakBox<Self>;
|
||||
if ptr.is_null() {
|
||||
debug!("Creating new WeakBox holder for {:p}.", self);
|
||||
trace!("Creating new WeakBox holder for {:p}.", self);
|
||||
ptr = Box::into_raw(box WeakBox {
|
||||
count: Cell::new(1),
|
||||
value: Cell::new(Some(NonZero::new(self))),
|
||||
|
@ -65,7 +65,7 @@ pub trait WeakReferenceable: DomObject + Sized {
|
|||
let box_ = &*ptr;
|
||||
assert!(box_.value.get().is_some());
|
||||
let new_count = box_.count.get() + 1;
|
||||
debug!("Incrementing WeakBox refcount for {:p} to {}.",
|
||||
trace!("Incrementing WeakBox refcount for {:p} to {}.",
|
||||
self,
|
||||
new_count);
|
||||
box_.count.set(new_count);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue