mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
stylo: Measure Elements and ComputedValues.
The patch provides FFI access to Gecko's SeenPtrs type from Rust, in order to record what has already been measured when measuring Arcs. (The SeenPtrs must be initialized on the Gecko side because the same table is reused for measuring all Elements within a window, because Elements can share ComputedValues.) I have confirmed with DMD that this is working correctly. The patch also introduces MallocSizeOfRepeats, which is like MallocSizeOf but takes a SizeOfState, which holds a SeenPtrs table.
This commit is contained in:
parent
e07beacd4d
commit
526e9691f8
9 changed files with 161 additions and 5 deletions
|
@ -41,6 +41,7 @@ use std::hash::{Hash, Hasher};
|
|||
use std::iter::{ExactSizeIterator, Iterator};
|
||||
use std::mem;
|
||||
use std::ops::{Deref, DerefMut};
|
||||
use std::os::raw::c_void;
|
||||
use std::process;
|
||||
use std::ptr;
|
||||
use std::slice;
|
||||
|
@ -200,6 +201,7 @@ impl<T> Arc<T> {
|
|||
pub fn borrow_arc<'a>(&'a self) -> ArcBorrow<'a, T> {
|
||||
ArcBorrow(&**self)
|
||||
}
|
||||
|
||||
/// Temporarily converts |self| into a bonafide RawOffsetArc and exposes it to the
|
||||
/// provided callback. The refcount is not modified.
|
||||
#[inline(always)]
|
||||
|
@ -218,6 +220,12 @@ impl<T> Arc<T> {
|
|||
// Forward the result.
|
||||
result
|
||||
}
|
||||
|
||||
/// Returns the address on the heap of the Arc itself -- not the T within it -- for memory
|
||||
/// reporting.
|
||||
pub fn heap_ptr(&self) -> *const c_void {
|
||||
self.p.ptr() as *const ArcInner<T> as *const c_void
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ?Sized> Arc<T> {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue