Bug 1435944 part 1 - Add ToAddRefed() for nsStaticAtom. r=froydnj
authorXidorn Quan <me@upsuper.org>
Thu, 08 Feb 2018 13:50:42 +1100
changeset 402866 43a1e6e51a52fffbad6b7442857681ddc0bd2606
parent 402865 ba64db4fd491c98dd45b5a27e1aab1b4dbfff55f
child 402867 332427963060bac736d5ab3ee0332f95ddee1b63
push id59280
push userxquan@mozilla.com
push dateThu, 08 Feb 2018 04:22:39 +0000
treeherderautoland@332427963060 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1435944
milestone60.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 1435944 part 1 - Add ToAddRefed() for nsStaticAtom. r=froydnj MozReview-Commit-ID: 80HginrqhOi
xpcom/ds/nsAtom.h
--- a/xpcom/ds/nsAtom.h
+++ b/xpcom/ds/nsAtom.h
@@ -111,16 +111,20 @@ protected:
 class nsStaticAtom : public nsAtom
 {
 public:
   // These are deleted so it's impossible to RefPtr<nsStaticAtom>. Raw
   // nsStaticAtom atoms should be used instead.
   MozExternalRefCountType AddRef() = delete;
   MozExternalRefCountType Release() = delete;
 
+  already_AddRefed<nsAtom> ToAddRefed() {
+    return already_AddRefed<nsAtom>(static_cast<nsAtom*>(this));
+  }
+
 private:
   friend class nsAtomFriend;
 
   // Construction is done entirely by |friend|s.
   nsStaticAtom(const char16_t* aString, uint32_t aLength, uint32_t aHash)
     : nsAtom(aString, aLength, aHash)
   {}
 };