Skip to content

Commit f96ce85

Browse files
author
Butkovits Atila
committed
Backed out changeset 8da43c1bdd49 (bug 1759891) causing Webrender busatges. CLOSED TREE
[ghsync] From https://hg.mozilla.org/mozilla-central/rev/73cf808ebf54ed0219d272128d7e459fc2dee5b1
1 parent 324e6b5 commit f96ce85

File tree

3 files changed

+16
-20
lines changed

3 files changed

+16
-20
lines changed

webrender/src/glyph_rasterizer/mod.rs

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -549,7 +549,6 @@ struct MappedFontKey {
549549
}
550550

551551
struct FontKeyMapLocked {
552-
namespace: IdNamespace,
553552
next_id: u32,
554553
template_map: FastHashMap<FontTemplate, Arc<MappedFontKey>>,
555554
key_map: FastHashMap<FontKey, Arc<MappedFontKey>>,
@@ -562,15 +561,15 @@ struct FontKeyMapLocked {
562561
/// final shared key. The shared key will stay alive so long as there are
563562
/// any strong references to the mapping entry. Care must be taken when
564563
/// clearing namespaces of shared keys as this may trigger shared font keys
565-
/// to expire which require individual processing. Shared font keys will be
566-
/// created within the provided unique namespace.
564+
/// to expire which require individual processing.
567565
#[derive(Clone)]
568566
pub struct FontKeyMap(Arc<RwLock<FontKeyMapLocked>>);
569567

570568
impl FontKeyMap {
571-
pub fn new(namespace: IdNamespace) -> Self {
569+
const SHARED_NAMESPACE: IdNamespace = IdNamespace(0);
570+
571+
pub fn new() -> Self {
572572
FontKeyMap(Arc::new(RwLock::new(FontKeyMapLocked {
573-
namespace,
574573
next_id: 1,
575574
template_map: FastHashMap::default(),
576575
key_map: FastHashMap::default(),
@@ -601,7 +600,7 @@ impl FontKeyMap {
601600
locked.key_map.insert(*font_key, mapped);
602601
return None;
603602
}
604-
let shared_key = FontKey::new(locked.namespace, locked.next_id);
603+
let shared_key = FontKey::new(Self::SHARED_NAMESPACE, locked.next_id);
605604
locked.next_id += 1;
606605
let mapped = Arc::new(MappedFontKey {
607606
font_key: shared_key,
@@ -718,7 +717,6 @@ impl FontTemplateMap {
718717
}
719718

720719
struct FontInstanceKeyMapLocked {
721-
namespace: IdNamespace,
722720
next_id: u32,
723721
instances: FastHashSet<Arc<BaseFontInstance>>,
724722
key_map: FastHashMap<FontInstanceKey, Weak<BaseFontInstance>>,
@@ -731,15 +729,15 @@ struct FontInstanceKeyMapLocked {
731729
/// key to assign to that instance. When the weak count of the mapping is zero,
732730
/// the entry is allowed to expire. Again, care must be taken when clearing
733731
/// a namespace within the key map as it may cause shared key expirations that
734-
/// require individual processing. Shared instance keys will be created within
735-
/// the provided unique namespace.
732+
/// require individual processing.
736733
#[derive(Clone)]
737734
pub struct FontInstanceKeyMap(Arc<RwLock<FontInstanceKeyMapLocked>>);
738735

739736
impl FontInstanceKeyMap {
740-
pub fn new(namespace: IdNamespace) -> Self {
737+
const SHARED_NAMESPACE: IdNamespace = IdNamespace(0);
738+
739+
pub fn new() -> Self {
741740
FontInstanceKeyMap(Arc::new(RwLock::new(FontInstanceKeyMapLocked {
742-
namespace,
743741
next_id: 1,
744742
instances: FastHashSet::default(),
745743
key_map: FastHashMap::default(),
@@ -771,7 +769,7 @@ impl FontInstanceKeyMap {
771769
return None;
772770
}
773771
let unmapped_key = instance.instance_key;
774-
instance.instance_key = FontInstanceKey::new(locked.namespace, locked.next_id);
772+
instance.instance_key = FontInstanceKey::new(Self::SHARED_NAMESPACE, locked.next_id);
775773
locked.next_id += 1;
776774
let shared_instance = Arc::new(instance);
777775
locked.instances.insert(shared_instance.clone());
@@ -913,12 +911,12 @@ pub struct SharedFontResources {
913911
}
914912

915913
impl SharedFontResources {
916-
pub fn new(namespace: IdNamespace) -> Self {
914+
pub fn new() -> Self {
917915
SharedFontResources {
918916
templates: FontTemplateMap::new(),
919917
instances: FontInstanceMap::new(),
920-
font_keys: FontKeyMap::new(namespace),
921-
instance_keys: FontInstanceKeyMap::new(namespace),
918+
font_keys: FontKeyMap::new(),
919+
instance_keys: FontInstanceKeyMap::new(),
922920
}
923921
}
924922
}

webrender/src/render_backend.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -733,7 +733,7 @@ impl RenderBackend {
733733
}
734734
}
735735

736-
pub fn next_namespace_id() -> IdNamespace {
736+
fn next_namespace_id(&self) -> IdNamespace {
737737
IdNamespace(NEXT_NAMESPACE_ID.fetch_add(1, Ordering::Relaxed) as u32)
738738
}
739739

@@ -908,7 +908,7 @@ impl RenderBackend {
908908
match msg {
909909
ApiMsg::CloneApi(sender) => {
910910
assert!(!self.namespace_alloc_by_client);
911-
sender.send(Self::next_namespace_id()).unwrap();
911+
sender.send(self.next_namespace_id()).unwrap();
912912
}
913913
ApiMsg::CloneApiByClient(namespace_id) => {
914914
assert!(self.namespace_alloc_by_client);

webrender/src/renderer/mod.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1212,9 +1212,7 @@ impl Renderer {
12121212
let sampler = options.sampler;
12131213
let namespace_alloc_by_client = options.namespace_alloc_by_client;
12141214

1215-
// Ensure shared font keys exist within their own unique namespace so
1216-
// that they don't accidentally collide across Renderer instances.
1217-
let fonts = SharedFontResources::new(RenderBackend::next_namespace_id());
1215+
let fonts = SharedFontResources::new();
12181216

12191217
let blob_image_handler = options.blob_image_handler.take();
12201218
let scene_builder_hooks = options.scene_builder_hooks;

0 commit comments

Comments
 (0)