Bug 1494515 - Remove an unused argument from nsStaticAtom's constructor. r=froydnj
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 27 Sep 2018 16:14:05 +1000
changeset 438627 cb1bd4097d6bf9ad61c6f4ff146ba193bf370193
parent 438626 1a9268216cd7c52323f5bc95166f5f154acc36be
child 438628 95301d8052055fc5d5f131e123c0c35eef359978
child 438636 e7d5eb0d44a7ee8b6d53d91d96986af873fa16af
push id34728
push userccoroiu@mozilla.com
push dateFri, 28 Sep 2018 04:33:26 +0000
treeherdermozilla-central@95301d805205 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1494515
milestone64.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1494515 - Remove an unused argument from nsStaticAtom's constructor. r=froydnj Presumably the commit that introduced `aStringOffset` could have removed this, but overlooked it.
xpcom/ds/nsAtom.h
xpcom/ds/nsGkAtoms.cpp
xpcom/ds/nsGkAtoms.h
--- a/xpcom/ds/nsAtom.h
+++ b/xpcom/ds/nsAtom.h
@@ -103,17 +103,17 @@ public:
   // of this type is special.
   MozExternalRefCountType AddRef();
   MozExternalRefCountType Release();
 
   typedef mozilla::TrueType HasThreadSafeRefCnt;
 
 protected:
   // Used by nsStaticAtom.
-  constexpr nsAtom(const char16_t* aStr, uint32_t aLength, uint32_t aHash)
+  constexpr nsAtom(uint32_t aLength, uint32_t aHash)
     : mLength(aLength)
     , mKind(static_cast<uint32_t>(nsAtom::AtomKind::Static))
     , mHash(aHash)
   {}
 
   // Used by nsDynamicAtom.
   nsAtom(AtomKind aKind, const nsAString& aString, uint32_t aHash)
     : mLength(aString.Length())
@@ -142,19 +142,19 @@ public:
   MozExternalRefCountType AddRef() = delete;
   MozExternalRefCountType Release() = delete;
 
   // The static atom's precomputed hash value is an argument here, but it
   // must be the same as would be computed by mozilla::HashString(aStr),
   // which is what we use when atomizing strings. We compute this hash in
   // Atom.py and assert in nsAtomTable::RegisterStaticAtoms that the two
   // hashes match.
-  constexpr nsStaticAtom(const char16_t* aStr, uint32_t aLength,
-                         uint32_t aHash, uint32_t aStringOffset)
-    : nsAtom(aStr, aLength, aHash)
+  constexpr nsStaticAtom(uint32_t aLength, uint32_t aHash,
+                         uint32_t aStringOffset)
+    : nsAtom(aLength, aHash)
     , mStringOffset(aStringOffset)
   {}
 
   const char16_t* String() const
   {
     return reinterpret_cast<const char16_t*>(uintptr_t(this) - mStringOffset);
   }
 
--- a/xpcom/ds/nsGkAtoms.cpp
+++ b/xpcom/ds/nsGkAtoms.cpp
@@ -29,33 +29,33 @@ extern constexpr GkAtoms gGkAtoms = {
     //
     // Note that |value_| is an 8-bit string, and so |sizeof(value_)| is equal
     // to the number of chars (including the terminating '\0'). The |u""| prefix
     // converts |value_| to a 16-bit string.
     //
     // Expansion of the example GK_ATOM entries in nsGkAtoms.h:
     //
     //   nsStaticAtom(
-    //     u"a", 1, 0x01234567,
+    //     1, 0x01234567,
     //     offsetof(GkAtoms, mAtoms[static_cast<size_t>(GkAtoms::Atoms::a)]) -
     //     offsetof(GkAtoms, a_string)),
     //
     //   nsStaticAtom(
-    //     u"bb", 2, 0x12345678,
+    //     2, 0x12345678,
     //     offsetof(GkAtoms, mAtoms[static_cast<size_t>(GkAtoms::Atoms::bb)]) -
     //     offsetof(GkAtoms, bb_string)),
     //
     //   nsStaticAtom(
-    //     u"ccc", 3, 0x23456789,
+    //     3, 0x23456789,
     //     offsetof(GkAtoms, mAtoms[static_cast<size_t>(GkAtoms::Atoms::ccc)]) -
     //     offsetof(GkAtoms, ccc_string)),
     //
     #define GK_ATOM(name_, value_, hash_, type_, atom_type_)                   \
       nsStaticAtom(                                                            \
-        u"" value_, sizeof(value_) - 1, hash_,                                 \
+        sizeof(value_) - 1, hash_,                                             \
         offsetof(GkAtoms,                                                      \
                  mAtoms[static_cast<size_t>(GkAtoms::Atoms::name_)]) -         \
         offsetof(GkAtoms, name_##_string)),
     #include "nsGkAtomList.h"
     #undef GK_ATOM
   }
 };
 
--- a/xpcom/ds/nsGkAtoms.h
+++ b/xpcom/ds/nsGkAtoms.h
@@ -50,23 +50,22 @@
 //   GK_ATOM(bb, "bb", 0x12345678, nsICSSPseudoElement, PseudoElementAtom)
 //   GK_ATOM(ccc, "ccc", 0x23456789, nsICSSAnonBoxPseudo, InheritingAnonBoxAtom)
 //
 // Comments throughout this file and nsGkAtoms.cpp show how these entries get
 // expanded by macros.
 
 // Trivial subclasses of nsStaticAtom so that function signatures can require
 // an atom from a specific atom list.
-#define DEFINE_STATIC_ATOM_SUBCLASS(name_)                   \
-  class name_ : public nsStaticAtom                          \
-  {                                                          \
-  public:                                                    \
-    constexpr name_(const char16_t* aStr, uint32_t aLength,  \
-                    uint32_t aHash, uint32_t aOffset)        \
-      : nsStaticAtom(aStr, aLength, aHash, aOffset) {}       \
+#define DEFINE_STATIC_ATOM_SUBCLASS(name_)                                     \
+  class name_ : public nsStaticAtom                                            \
+  {                                                                            \
+  public:                                                                      \
+    constexpr name_(uint32_t aLength, uint32_t aHash, uint32_t aOffset)        \
+      : nsStaticAtom(aLength, aHash, aOffset) {}                               \
   };
 
 DEFINE_STATIC_ATOM_SUBCLASS(nsICSSAnonBoxPseudo)
 DEFINE_STATIC_ATOM_SUBCLASS(nsICSSPseudoElement)
 
 #undef DEFINE_STATIC_ATOM_SUBCLASS
 
 namespace mozilla {