Bug 1435944 part 1 - Add ToAddRefed() for nsStaticAtom. r?froydnj
MozReview-Commit-ID: 80HginrqhOi
--- 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)
{}
};