mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
style: Allow references to static, single-generic C++ SharedFontList objects from Rust FontFamilyList.
UA style sheets only ever specify a single generic font family in font-family properties, so we pre-create a unique, static SharedFontList for each generic and change the representation of FontFamilyList to be able to refer to them by their generic ID. This avoids having to share refcounted SharedFontList objects across processes. Differential Revision: https://phabricator.services.mozilla.com/D17183
This commit is contained in:
parent
91586eea0e
commit
b6b5ddda71
4 changed files with 59 additions and 23 deletions
|
@ -567,8 +567,14 @@ impl MallocSizeOf for FontFamily {
|
|||
match *self {
|
||||
FontFamily::Values(ref v) => {
|
||||
// Although a SharedFontList object is refcounted, we always
|
||||
// attribute its size to the specified value.
|
||||
unsafe { bindings::Gecko_SharedFontList_SizeOfIncludingThis(v.0.get()) }
|
||||
// attribute its size to the specified value, as long as it's
|
||||
// not a value in SharedFontList::sSingleGenerics.
|
||||
if matches!(v, FontFamilyList::SharedFontList(_)) {
|
||||
let ptr = v.shared_font_list().get();
|
||||
unsafe { bindings::Gecko_SharedFontList_SizeOfIncludingThis(ptr) }
|
||||
} else {
|
||||
0
|
||||
}
|
||||
},
|
||||
FontFamily::System(_) => 0,
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue