@@ -549,7 +549,6 @@ struct MappedFontKey {
549
549
}
550
550
551
551
struct FontKeyMapLocked {
552
- namespace : IdNamespace ,
553
552
next_id : u32 ,
554
553
template_map : FastHashMap < FontTemplate , Arc < MappedFontKey > > ,
555
554
key_map : FastHashMap < FontKey , Arc < MappedFontKey > > ,
@@ -562,15 +561,15 @@ struct FontKeyMapLocked {
562
561
/// final shared key. The shared key will stay alive so long as there are
563
562
/// any strong references to the mapping entry. Care must be taken when
564
563
/// 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.
567
565
#[ derive( Clone ) ]
568
566
pub struct FontKeyMap ( Arc < RwLock < FontKeyMapLocked > > ) ;
569
567
570
568
impl FontKeyMap {
571
- pub fn new ( namespace : IdNamespace ) -> Self {
569
+ const SHARED_NAMESPACE : IdNamespace = IdNamespace ( 0 ) ;
570
+
571
+ pub fn new ( ) -> Self {
572
572
FontKeyMap ( Arc :: new ( RwLock :: new ( FontKeyMapLocked {
573
- namespace,
574
573
next_id : 1 ,
575
574
template_map : FastHashMap :: default ( ) ,
576
575
key_map : FastHashMap :: default ( ) ,
@@ -601,7 +600,7 @@ impl FontKeyMap {
601
600
locked. key_map . insert ( * font_key, mapped) ;
602
601
return None ;
603
602
}
604
- let shared_key = FontKey :: new ( locked . namespace , locked. next_id ) ;
603
+ let shared_key = FontKey :: new ( Self :: SHARED_NAMESPACE , locked. next_id ) ;
605
604
locked. next_id += 1 ;
606
605
let mapped = Arc :: new ( MappedFontKey {
607
606
font_key : shared_key,
@@ -718,7 +717,6 @@ impl FontTemplateMap {
718
717
}
719
718
720
719
struct FontInstanceKeyMapLocked {
721
- namespace : IdNamespace ,
722
720
next_id : u32 ,
723
721
instances : FastHashSet < Arc < BaseFontInstance > > ,
724
722
key_map : FastHashMap < FontInstanceKey , Weak < BaseFontInstance > > ,
@@ -731,15 +729,15 @@ struct FontInstanceKeyMapLocked {
731
729
/// key to assign to that instance. When the weak count of the mapping is zero,
732
730
/// the entry is allowed to expire. Again, care must be taken when clearing
733
731
/// 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.
736
733
#[ derive( Clone ) ]
737
734
pub struct FontInstanceKeyMap ( Arc < RwLock < FontInstanceKeyMapLocked > > ) ;
738
735
739
736
impl FontInstanceKeyMap {
740
- pub fn new ( namespace : IdNamespace ) -> Self {
737
+ const SHARED_NAMESPACE : IdNamespace = IdNamespace ( 0 ) ;
738
+
739
+ pub fn new ( ) -> Self {
741
740
FontInstanceKeyMap ( Arc :: new ( RwLock :: new ( FontInstanceKeyMapLocked {
742
- namespace,
743
741
next_id : 1 ,
744
742
instances : FastHashSet :: default ( ) ,
745
743
key_map : FastHashMap :: default ( ) ,
@@ -771,7 +769,7 @@ impl FontInstanceKeyMap {
771
769
return None ;
772
770
}
773
771
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 ) ;
775
773
locked. next_id += 1 ;
776
774
let shared_instance = Arc :: new ( instance) ;
777
775
locked. instances . insert ( shared_instance. clone ( ) ) ;
@@ -913,12 +911,12 @@ pub struct SharedFontResources {
913
911
}
914
912
915
913
impl SharedFontResources {
916
- pub fn new ( namespace : IdNamespace ) -> Self {
914
+ pub fn new ( ) -> Self {
917
915
SharedFontResources {
918
916
templates : FontTemplateMap :: new ( ) ,
919
917
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 ( ) ,
922
920
}
923
921
}
924
922
}
0 commit comments