Bug 1446865 - Rename various AddRefTable() functions as RegisterStaticAtoms. r=froydnj draft
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 19 Mar 2018 15:43:09 +1100
changeset 769229 8376fe998beff238d67729f60c6bd0cef9e823d1
parent 769228 96ce4288b4670e26bd5b4b75d7ee7ec2d784c513
push id103075
push usernnethercote@mozilla.com
push dateMon, 19 Mar 2018 05:49:09 +0000
reviewersfroydnj
bugs1446865
milestone61.0a1
Bug 1446865 - Rename various AddRefTable() functions as RegisterStaticAtoms. r=froydnj These functions no longer perform any refcounting, so the existing names are misleading. MozReview-Commit-ID: LX55e0bUP8N
layout/build/nsLayoutStatics.cpp
layout/style/nsCSSAnonBoxes.cpp
layout/style/nsCSSAnonBoxes.h
layout/style/nsCSSPseudoClasses.cpp
layout/style/nsCSSPseudoClasses.h
layout/style/nsCSSPseudoElements.cpp
layout/style/nsCSSPseudoElements.h
xpcom/ds/nsAtomTable.cpp
xpcom/ds/nsGkAtoms.cpp
xpcom/ds/nsGkAtoms.h
--- a/layout/build/nsLayoutStatics.cpp
+++ b/layout/build/nsLayoutStatics.cpp
@@ -144,19 +144,19 @@ nsLayoutStatics::Initialize()
                 "nsLayoutStatics", 1);
 
   nsresult rv;
 
   ContentParent::StartUp();
 
   // Register static atoms. Note that nsGkAtoms must be initialized earlier
   // than here, so it's done in NS_InitAtomTable() instead.
-  nsCSSAnonBoxes::AddRefAtoms();
-  nsCSSPseudoClasses::AddRefAtoms();
-  nsCSSPseudoElements::AddRefAtoms();
+  nsCSSAnonBoxes::RegisterStaticAtoms();
+  nsCSSPseudoClasses::RegisterStaticAtoms();
+  nsCSSPseudoElements::RegisterStaticAtoms();
   nsCSSKeywords::AddRefTable();
   nsCSSProps::AddRefTable();
   nsColorNames::AddRefTable();
 
   NS_SetStaticAtomsDone();
 
   StartupJSEnvironment();
 
--- a/layout/style/nsCSSAnonBoxes.cpp
+++ b/layout/style/nsCSSAnonBoxes.cpp
@@ -34,17 +34,17 @@ static const nsStaticAtomSetup sCSSAnonB
   #define CSS_ANON_BOX(name_, value_) \
     NS_STATIC_ATOM_SUBCLASS_SETUP(nsCSSAnonBoxes, name_)
   #define CSS_NON_INHERITING_ANON_BOX(name_, value_) /* nothing */
   #include "nsCSSAnonBoxList.h"
   #undef CSS_NON_INHERITING_ANON_BOX
   #undef CSS_ANON_BOX
 };
 
-void nsCSSAnonBoxes::AddRefAtoms()
+void nsCSSAnonBoxes::RegisterStaticAtoms()
 {
   NS_RegisterStaticAtoms(sCSSAnonBoxAtomSetup);
 }
 
 bool nsCSSAnonBoxes::IsAnonBox(nsAtom *aAtom)
 {
   return nsStaticAtomUtils::IsMember(aAtom, sCSSAnonBoxAtomSetup);
 }
--- a/layout/style/nsCSSAnonBoxes.h
+++ b/layout/style/nsCSSAnonBoxes.h
@@ -14,17 +14,17 @@
 
 // Empty class derived from nsAtom so that function signatures can
 // require an atom from this atom list.
 class nsICSSAnonBoxPseudo : public nsAtom {};
 
 class nsCSSAnonBoxes {
 public:
 
-  static void AddRefAtoms();
+  static void RegisterStaticAtoms();
 
   static bool IsAnonBox(nsAtom *aAtom);
 #ifdef MOZ_XUL
   static bool IsTreePseudoElement(nsAtom* aPseudo);
 #endif
   static bool IsNonElement(nsAtom* aPseudo)
   {
     return aPseudo == mozText || aPseudo == oofPlaceholder ||
--- a/layout/style/nsCSSPseudoClasses.cpp
+++ b/layout/style/nsCSSPseudoClasses.cpp
@@ -63,30 +63,30 @@ nsCSSPseudoClasses::kPseudoClassFlags[] 
     flags_,
   #include "nsCSSPseudoClassList.h"
   #undef CSS_PSEUDO_CLASS
 };
 
 /* static */ bool
 nsCSSPseudoClasses::sPseudoClassEnabled[] = {
   // If the pseudo class has any "ENABLED_IN" flag set, it is disabled by
-  // default. Note that, if a pseudo class has pref, whatever its default
-  // value is, it'll later be changed in nsCSSPseudoClasses::AddRefAtoms()
-  // If the pseudo class has "ENABLED_IN" flags but doesn't have a pref,
-  // it is an internal pseudo class which is disabled elsewhere.
+  // default. Note that, if a pseudo class has pref, whatever its default value
+  // is, it'll later be changed in nsCSSPseudoClasses::RegisterStaticAtoms() If
+  // the pseudo class has "ENABLED_IN" flags but doesn't have a pref, it is an
+  // internal pseudo class which is disabled elsewhere.
   #define IS_ENABLED_BY_DEFAULT(flags_) \
     (!((flags_) & CSS_PSEUDO_CLASS_ENABLED_MASK))
   #define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
     IS_ENABLED_BY_DEFAULT(flags_),
   #include "nsCSSPseudoClassList.h"
   #undef CSS_PSEUDO_CLASS
   #undef IS_ENABLED_BY_DEFAULT
 };
 
-void nsCSSPseudoClasses::AddRefAtoms()
+void nsCSSPseudoClasses::RegisterStaticAtoms()
 {
   NS_RegisterStaticAtoms(sCSSPseudoClassAtomSetup);
 
   #define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_)                      \
     if (pref_[0]) {                                                           \
       auto idx = static_cast<CSSPseudoElementTypeBase>(Type::name_);          \
       Preferences::AddBoolVarCache(&sPseudoClassEnabled[idx], pref_);         \
     }
--- a/layout/style/nsCSSPseudoClasses.h
+++ b/layout/style/nsCSSPseudoClasses.h
@@ -54,17 +54,17 @@ enum class CSSPseudoClassType : CSSPseud
 } // namespace mozilla
 
 class nsCSSPseudoClasses
 {
   typedef mozilla::CSSPseudoClassType Type;
   typedef mozilla::CSSEnabledState EnabledState;
 
 public:
-  static void AddRefAtoms();
+  static void RegisterStaticAtoms();
 
   static Type GetPseudoType(nsAtom* aAtom, EnabledState aEnabledState);
   static bool HasStringArg(Type aType);
   static bool HasNthPairArg(Type aType);
   static bool HasSelectorListArg(Type aType) {
     return aType == Type::any;
   }
   static bool IsUserActionPseudoClass(Type aType);
--- a/layout/style/nsCSSPseudoElements.cpp
+++ b/layout/style/nsCSSPseudoElements.cpp
@@ -40,17 +40,17 @@ static const nsStaticAtomSetup sCSSPseud
 /* static */ const uint32_t
 nsCSSPseudoElements::kPseudoElementFlags[] = {
 #define CSS_PSEUDO_ELEMENT(name_, value_, flags_) \
   flags_,
 #include "nsCSSPseudoElementList.h"
 #undef CSS_PSEUDO_ELEMENT
 };
 
-void nsCSSPseudoElements::AddRefAtoms()
+void nsCSSPseudoElements::RegisterStaticAtoms()
 {
   NS_RegisterStaticAtoms(sCSSPseudoElementAtomSetup);
 }
 
 bool nsCSSPseudoElements::IsPseudoElement(nsAtom *aAtom)
 {
   return nsStaticAtomUtils::IsMember(aAtom, sCSSPseudoElementAtomSetup);
 }
--- a/layout/style/nsCSSPseudoElements.h
+++ b/layout/style/nsCSSPseudoElements.h
@@ -86,17 +86,17 @@ enum class CSSPseudoElementType : CSSPse
 class nsICSSPseudoElement : public nsAtom {};
 
 class nsCSSPseudoElements
 {
   typedef mozilla::CSSPseudoElementType Type;
   typedef mozilla::CSSEnabledState EnabledState;
 
 public:
-  static void AddRefAtoms();
+  static void RegisterStaticAtoms();
 
   static bool IsPseudoElement(nsAtom *aAtom);
 
   static bool IsCSS2PseudoElement(nsAtom *aAtom);
 
   // This must match EAGER_PSEUDO_COUNT in Rust code.
   static const size_t kEagerPseudoCount = 4;
 
--- a/xpcom/ds/nsAtomTable.cpp
+++ b/xpcom/ds/nsAtomTable.cpp
@@ -614,17 +614,17 @@ NS_InitAtomTable()
   gAtomTable = new nsAtomTable();
 
   // Bug 1340710 has caused us to use an empty atom at arbitrary times after
   // startup. If we end up creating one before nsGkAtoms::_empty is registered,
   // we get an assertion about transmuting a dynamic atom into a static atom.
   // In order to avoid that, we register nsGkAtoms immediately after creating
   // the atom table to guarantee that the empty string atom will always be
   // static.
-  nsGkAtoms::AddRefAtoms();
+  nsGkAtoms::RegisterStaticAtoms();
 }
 
 void
 NS_ShutdownAtomTable()
 {
   MOZ_ASSERT(NS_IsMainThread());
   MOZ_ASSERT(gAtomTable);
 
--- a/xpcom/ds/nsGkAtoms.cpp
+++ b/xpcom/ds/nsGkAtoms.cpp
@@ -16,13 +16,13 @@
 #undef GK_ATOM
 
 static const nsStaticAtomSetup sGkAtomSetup[] = {
   #define GK_ATOM(name_, value_) NS_STATIC_ATOM_SETUP(nsGkAtoms, name_)
   #include "nsGkAtomList.h"
   #undef GK_ATOM
 };
 
-void nsGkAtoms::AddRefAtoms()
+void nsGkAtoms::RegisterStaticAtoms()
 {
   NS_RegisterStaticAtoms(sGkAtomSetup);
 }
 
--- a/xpcom/ds/nsGkAtoms.h
+++ b/xpcom/ds/nsGkAtoms.h
@@ -7,16 +7,16 @@
 #ifndef nsGkAtoms_h___
 #define nsGkAtoms_h___
 
 #include "nsStaticAtom.h"
 
 class nsGkAtoms
 {
 public:
-  static void AddRefAtoms();
+  static void RegisterStaticAtoms();
 
   #define GK_ATOM(_name, _value) NS_STATIC_ATOM_DECL(_name)
   #include "nsGkAtomList.h"
   #undef GK_ATOM
 };
 
 #endif /* nsGkAtoms_h___ */