mirror of
https://github.com/servo/servo.git
synced 2025-08-18 11:55:39 +01:00
Introduce and start using the MallocSizeOf trait.
MallocSizeOf is similar to the existing HeapSizeOf trait from the heapsize crate. The only difference is that MallocSizeOf's malloc_size_of_children() function takes an additional MallocSizeOfFn argument, which is used to measure heap blocks. This extra argument makes MallocSizeOf match how Gecko's memory measurements work, and is required for Stylo to integrate with DMD. The patch also introduces a second trait, MallocSizeOfWithGuard, which is much the same as MallocSizeOf, but with a |guard| argument for the global style lock. Finally, the patch uses the new traits to measure a small amount of Stylo's memory usage.
This commit is contained in:
parent
4ec2e8b4c5
commit
6d5b1242db
5 changed files with 139 additions and 5 deletions
|
@ -39,6 +39,7 @@ use gecko_bindings::structs::FontSizePrefs;
|
|||
use gecko_bindings::structs::GeckoFontMetrics;
|
||||
use gecko_bindings::structs::IterationCompositeOperation;
|
||||
use gecko_bindings::structs::Keyframe;
|
||||
use gecko_bindings::structs::MallocSizeOf;
|
||||
use gecko_bindings::structs::ServoBundledURI;
|
||||
use gecko_bindings::structs::ServoElementSnapshot;
|
||||
use gecko_bindings::structs::ServoElementSnapshotTable;
|
||||
|
@ -1765,6 +1766,11 @@ extern "C" {
|
|||
pub fn Servo_StyleSheet_Clone(sheet: RawServoStyleSheetBorrowed)
|
||||
-> RawServoStyleSheetStrong;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSheet_SizeOfIncludingThis(malloc_size_of: MallocSizeOf,
|
||||
sheet: RawServoStyleSheetBorrowed)
|
||||
-> usize;
|
||||
}
|
||||
extern "C" {
|
||||
pub fn Servo_StyleSet_Init(pres_context: RawGeckoPresContextOwned)
|
||||
-> RawServoStyleSetOwned;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue