mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +01:00
script: Move the FontContext
to Window
(#34845)
This will allow using layout's `FontContext` in `Window` letting script manage font selection and download. Signed-off-by: Martin Robinson <mrobinson@igalia.com> Co-authored-by: Mukilan Thiyagarajan <mukilan@igalia.com>
This commit is contained in:
parent
fe8a22b72c
commit
7142a96d36
6 changed files with 61 additions and 45 deletions
|
@ -50,6 +50,7 @@ use std::cell::OnceCell;
|
|||
use std::collections::BinaryHeap;
|
||||
use std::hash::{BuildHasher, Hash};
|
||||
use std::ops::Range;
|
||||
use std::sync::Arc;
|
||||
|
||||
pub use style_malloc_size_of::MallocSizeOfOps;
|
||||
use uuid::Uuid;
|
||||
|
@ -523,6 +524,38 @@ impl<T: MallocSizeOf> MallocConditionalSizeOf for servo_arc::Arc<T> {
|
|||
}
|
||||
}
|
||||
|
||||
impl<T> MallocUnconditionalShallowSizeOf for Arc<T> {
|
||||
fn unconditional_shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
unsafe { ops.malloc_size_of(Arc::as_ptr(self)) }
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: MallocSizeOf> MallocUnconditionalSizeOf for Arc<T> {
|
||||
fn unconditional_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
self.unconditional_shallow_size_of(ops) + (**self).size_of(ops)
|
||||
}
|
||||
}
|
||||
|
||||
impl<T> MallocConditionalShallowSizeOf for Arc<T> {
|
||||
fn conditional_shallow_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
if ops.have_seen_ptr(Arc::as_ptr(self)) {
|
||||
0
|
||||
} else {
|
||||
self.unconditional_shallow_size_of(ops)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: MallocSizeOf> MallocConditionalSizeOf for Arc<T> {
|
||||
fn conditional_size_of(&self, ops: &mut MallocSizeOfOps) -> usize {
|
||||
if ops.have_seen_ptr(Arc::as_ptr(self)) {
|
||||
0
|
||||
} else {
|
||||
self.unconditional_size_of(ops)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// If a mutex is stored directly as a member of a data type that is being measured,
|
||||
/// it is the unique owner of its contents and deserves to be measured.
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue