author | Nathan Froyd <froydnj@mozilla.com> |
Fri, 07 Nov 2014 11:18:19 -0500 | |
changeset 215514 | 97408585e41c165f6e5d0fdc0eeedda92cd237b4 |
parent 215513 | cf6287a1392711f24a7af4691ea8519dcbf81cf1 |
child 215515 | 7db30249d1d86f01440b619f78d33e99d1e3fd9b |
push id | 27818 |
push user | ryanvm@gmail.com |
push date | Thu, 13 Nov 2014 20:19:09 +0000 |
treeherder | mozilla-central@292ed84594c1 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | bsmedberg |
bugs | 1095541 |
milestone | 36.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
|
--- a/xpcom/base/nsRefPtr.h +++ b/xpcom/base/nsRefPtr.h @@ -2,17 +2,19 @@ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef nsRefPtr_h #define nsRefPtr_h -#include "nsCOMPtr.h" +#include "AlreadyAddRefed.h" +#include "nsDebug.h" +#include "nsISupportsUtils.h" /*****************************************************************************/ // template <class T> class nsRefPtrGetterAddRefs; class nsCOMPtr_helper; template <class T> @@ -264,22 +266,18 @@ public: NS_PRECONDITION(mRawPtr != 0, "You can't dereference a NULL nsRefPtr with operator*()."); return *get(); } T** StartAssignment() { -#ifndef NSCAP_FEATURE_INLINE_STARTASSIGNMENT - return reinterpret_cast<T**>(begin_assignment()); -#else assign_assuming_AddRef(0); return reinterpret_cast<T**>(&mRawPtr); -#endif } }; template <class T> nsRefPtr<T>::nsRefPtr(const nsCOMPtr_helper& aHelper) { void* newRawPtr; if (NS_FAILED(aHelper(NS_GET_TEMPLATE_IID(T), &newRawPtr))) { @@ -468,47 +466,49 @@ operator!=(const nsRefPtr<T>& aLhs, U* a template <class T, class U> inline bool operator!=(U* aLhs, const nsRefPtr<T>& aRhs) { return const_cast<const U*>(aLhs) != static_cast<const T*>(aRhs.get()); } - +namespace detail { +class nsRefPtrZero; +} // Comparing an |nsRefPtr| to |0| template <class T> inline bool -operator==(const nsRefPtr<T>& aLhs, NSCAP_Zero* aRhs) +operator==(const nsRefPtr<T>& aLhs, ::detail::nsRefPtrZero* aRhs) // specifically to allow |smartPtr == 0| { return static_cast<const void*>(aLhs.get()) == reinterpret_cast<const void*>(aRhs); } template <class T> inline bool -operator==(NSCAP_Zero* aLhs, const nsRefPtr<T>& aRhs) +operator==(::detail::nsRefPtrZero* aLhs, const nsRefPtr<T>& aRhs) // specifically to allow |0 == smartPtr| { return reinterpret_cast<const void*>(aLhs) == static_cast<const void*>(aRhs.get()); } template <class T> inline bool -operator!=(const nsRefPtr<T>& aLhs, NSCAP_Zero* aRhs) +operator!=(const nsRefPtr<T>& aLhs, ::detail::nsRefPtrZero* aRhs) // specifically to allow |smartPtr != 0| { return static_cast<const void*>(aLhs.get()) != reinterpret_cast<const void*>(aRhs); } template <class T> inline bool -operator!=(NSCAP_Zero* aLhs, const nsRefPtr<T>& aRhs) +operator!=(::detail::nsRefPtrZero* aLhs, const nsRefPtr<T>& aRhs) // specifically to allow |0 != smartPtr| { return reinterpret_cast<const void*>(aLhs) != static_cast<const void*>(aRhs.get()); } template <class SourceType, class DestinationType> inline nsresult