Bug 1045065 - Fix some bad implicit constructors in xpcom; r=froydnj

This commit is contained in:
Ehsan Akhgari 2014-07-28 13:19:06 -04:00
parent a7a241f207
commit 4c9c55eba5
29 changed files with 78 additions and 78 deletions

View File

@ -51,7 +51,7 @@ template<class SmartPtr>
class PointerClearer : public ShutdownObserver class PointerClearer : public ShutdownObserver
{ {
public: public:
PointerClearer(SmartPtr* aPtr) explicit PointerClearer(SmartPtr* aPtr)
: mPtr(aPtr) : mPtr(aPtr)
{ {
} }

View File

@ -235,7 +235,7 @@ TraceWeakMapping(js::WeakMapTracer* aTrc, JSObject* aMap,
// This is based on the logic in TraceWeakMapping. // This is based on the logic in TraceWeakMapping.
struct FixWeakMappingGrayBitsTracer : public js::WeakMapTracer struct FixWeakMappingGrayBitsTracer : public js::WeakMapTracer
{ {
FixWeakMappingGrayBitsTracer(JSRuntime* aRt) explicit FixWeakMappingGrayBitsTracer(JSRuntime* aRt)
: js::WeakMapTracer(aRt, FixWeakMappingGrayBits) : js::WeakMapTracer(aRt, FixWeakMappingGrayBits)
{ {
} }
@ -295,7 +295,7 @@ private:
struct Closure struct Closure
{ {
Closure(nsCycleCollectionNoteRootCallback* aCb) explicit Closure(nsCycleCollectionNoteRootCallback* aCb)
: mCycleCollectionEnabled(true), mCb(aCb) : mCycleCollectionEnabled(true), mCb(aCb)
{ {
} }

View File

@ -48,7 +48,7 @@ private:
class Ptr class Ptr
{ {
public: public:
Ptr(T* aPtr) MOZ_IMPLICIT Ptr(T* aPtr)
: mPtr(aPtr) : mPtr(aPtr)
{ {
} }
@ -81,7 +81,7 @@ public:
{ {
} }
nsAutoPtr(Ptr aRawPtr) MOZ_IMPLICIT nsAutoPtr(Ptr aRawPtr)
: mRawPtr(aRawPtr) : mRawPtr(aRawPtr)
// construct from a raw pointer (of the right type) // construct from a raw pointer (of the right type)
{ {
@ -471,7 +471,7 @@ public:
{ {
} }
nsAutoArrayPtr(T* aRawPtr) MOZ_IMPLICIT nsAutoArrayPtr(T* aRawPtr)
: mRawPtr(aRawPtr) : mRawPtr(aRawPtr)
// construct from a raw pointer (of the right type) // construct from a raw pointer (of the right type)
{ {
@ -878,7 +878,7 @@ public:
// construct from a raw pointer (of the right type) // construct from a raw pointer (of the right type)
nsRefPtr(T* aRawPtr) MOZ_IMPLICIT nsRefPtr(T* aRawPtr)
: mRawPtr(aRawPtr) : mRawPtr(aRawPtr)
{ {
if (mRawPtr) { if (mRawPtr) {
@ -900,7 +900,7 @@ public:
{ {
} }
nsRefPtr(const nsCOMPtr_helper& aHelper) MOZ_IMPLICIT nsRefPtr(const nsCOMPtr_helper& aHelper)
{ {
void* newRawPtr; void* newRawPtr;
if (NS_FAILED(aHelper(NS_GET_TEMPLATE_IID(T), &newRawPtr))) { if (NS_FAILED(aHelper(NS_GET_TEMPLATE_IID(T), &newRawPtr))) {
@ -1330,7 +1330,7 @@ template<class T>
class nsQueryObject : public nsCOMPtr_helper class nsQueryObject : public nsCOMPtr_helper
{ {
public: public:
nsQueryObject(T* aRawPtr) explicit nsQueryObject(T* aRawPtr)
: mRawPtr(aRawPtr) : mRawPtr(aRawPtr)
{ {
} }

View File

@ -16,7 +16,7 @@ class nsConsoleMessage MOZ_FINAL : public nsIConsoleMessage
{ {
public: public:
nsConsoleMessage(); nsConsoleMessage();
nsConsoleMessage(const char16_t* aMessage); explicit nsConsoleMessage(const char16_t* aMessage);
NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSICONSOLEMESSAGE NS_DECL_NSICONSOLEMESSAGE

View File

@ -70,7 +70,7 @@ nsConsoleService::~nsConsoleService()
class AddConsolePrefWatchers : public nsRunnable class AddConsolePrefWatchers : public nsRunnable
{ {
public: public:
AddConsolePrefWatchers(nsConsoleService* aConsole) : mConsole(aConsole) explicit AddConsolePrefWatchers(nsConsoleService* aConsole) : mConsole(aConsole)
{ {
} }

View File

@ -433,7 +433,7 @@ public:
Iterator() : mPointer(nullptr) Iterator() : mPointer(nullptr)
{ {
} }
Iterator(PtrInfoOrBlock* aPointer) : mPointer(aPointer) explicit Iterator(PtrInfoOrBlock* aPointer) : mPointer(aPointer)
{ {
} }
Iterator(const Iterator& aOther) : mPointer(aOther.mPointer) Iterator(const Iterator& aOther) : mPointer(aOther.mPointer)
@ -483,7 +483,7 @@ public:
class Builder class Builder
{ {
public: public:
Builder(EdgePool& aPool) explicit Builder(EdgePool& aPool)
: mCurrent(&aPool.mSentinelAndBlocks[0]) : mCurrent(&aPool.mSentinelAndBlocks[0])
, mBlockEnd(&aPool.mSentinelAndBlocks[0]) , mBlockEnd(&aPool.mSentinelAndBlocks[0])
, mNextBlockPtr(&aPool.Blocks()) , mNextBlockPtr(&aPool.Blocks())
@ -697,7 +697,7 @@ public:
class Builder class Builder
{ {
public: public:
Builder(NodePool& aPool) explicit Builder(NodePool& aPool)
: mNextBlock(&aPool.mBlocks) : mNextBlock(&aPool.mBlocks)
, mNext(aPool.mLast) , mNext(aPool.mLast)
, mBlockEnd(nullptr) , mBlockEnd(nullptr)
@ -727,7 +727,7 @@ public:
class Enumerator class Enumerator
{ {
public: public:
Enumerator(NodePool& aPool) explicit Enumerator(NodePool& aPool)
: mFirstBlock(aPool.mBlocks) : mFirstBlock(aPool.mBlocks)
, mCurBlock(nullptr) , mCurBlock(nullptr)
, mNext(nullptr) , mNext(nullptr)
@ -1184,7 +1184,7 @@ AddPurpleRoot(CCGraphBuilder& aBuilder, void* aRoot,
struct SelectPointersVisitor struct SelectPointersVisitor
{ {
SelectPointersVisitor(CCGraphBuilder& aBuilder) explicit SelectPointersVisitor(CCGraphBuilder& aBuilder)
: mBuilder(aBuilder) : mBuilder(aBuilder)
{ {
} }
@ -1378,7 +1378,7 @@ public:
void WalkFromRoots(CCGraph& aGraph); void WalkFromRoots(CCGraph& aGraph);
// copy-constructing the visitor should be cheap, and less // copy-constructing the visitor should be cheap, and less
// indirection than using a reference // indirection than using a reference
GraphWalker(const Visitor aVisitor) : mVisitor(aVisitor) explicit GraphWalker(const Visitor aVisitor) : mVisitor(aVisitor)
{ {
} }
}; };
@ -1595,7 +1595,7 @@ private:
nsCOMPtr<nsIFile> mFile; nsCOMPtr<nsIFile> mFile;
FILE* mStream; FILE* mStream;
FileInfo(const char* aPrefix) : mPrefix(aPrefix), mStream(nullptr) { } explicit FileInfo(const char* aPrefix) : mPrefix(aPrefix), mStream(nullptr) { }
}; };
/** /**
@ -2525,7 +2525,7 @@ class JSPurpleBuffer
} }
public: public:
JSPurpleBuffer(JSPurpleBuffer*& aReferenceToThis) explicit JSPurpleBuffer(JSPurpleBuffer*& aReferenceToThis)
: mReferenceToThis(aReferenceToThis) : mReferenceToThis(aReferenceToThis)
{ {
mReferenceToThis = this; mReferenceToThis = this;

View File

@ -130,7 +130,7 @@ private:
static mozilla::StaticRefPtr<FifoWatcher> sSingleton; static mozilla::StaticRefPtr<FifoWatcher> sSingleton;
FifoWatcher(nsCString aPath) explicit FifoWatcher(nsCString aPath)
: mDirPath(aPath) : mDirPath(aPath)
, mFifoInfoLock("FifoWatcher.mFifoInfoLock") , mFifoInfoLock("FifoWatcher.mFifoInfoLock")
{ {

View File

@ -49,7 +49,7 @@ public:
// Allow construction using '0' as the initial value, for readability, // Allow construction using '0' as the initial value, for readability,
// but no other numbers (so we don't have any implicit unit conversions). // but no other numbers (so we don't have any implicit unit conversions).
struct _SomethingVeryRandomHere; struct _SomethingVeryRandomHere;
TimeDuration(_SomethingVeryRandomHere* aZero) : mValue(0) MOZ_IMPLICIT TimeDuration(_SomethingVeryRandomHere* aZero) : mValue(0)
{ {
MOZ_ASSERT(!aZero, "Who's playing funny games here?"); MOZ_ASSERT(!aZero, "Who's playing funny games here?");
} }
@ -391,7 +391,7 @@ private:
friend struct IPC::ParamTraits<mozilla::TimeStamp>; friend struct IPC::ParamTraits<mozilla::TimeStamp>;
friend void StartupTimelineRecordExternal(int, uint64_t); friend void StartupTimelineRecordExternal(int, uint64_t);
TimeStamp(TimeStampValue aValue) : mValue(aValue) {} MOZ_IMPLICIT TimeStamp(TimeStampValue aValue) : mValue(aValue) {}
static TimeStamp Now(bool aHighResolution); static TimeStamp Now(bool aHighResolution);

View File

@ -35,7 +35,7 @@ public:
protected: protected:
nsArrayBase() {} nsArrayBase() {}
nsArrayBase(const nsArrayBase& aOther); nsArrayBase(const nsArrayBase& aOther);
nsArrayBase(const nsCOMArray_base& aBaseArray) : mArray(aBaseArray) {} explicit nsArrayBase(const nsCOMArray_base& aBaseArray) : mArray(aBaseArray) {}
virtual ~nsArrayBase(); virtual ~nsArrayBase();
nsCOMArray_base mArray; nsCOMArray_base mArray;
@ -51,7 +51,7 @@ public:
private: private:
nsArray() : nsArrayBase() {} nsArray() : nsArrayBase() {}
nsArray(const nsArray& aOther); nsArray(const nsArray& aOther);
nsArray(const nsCOMArray_base& aBaseArray) : nsArrayBase(aBaseArray) {} explicit nsArray(const nsCOMArray_base& aBaseArray) : nsArrayBase(aBaseArray) {}
~nsArray() {} ~nsArray() {}
}; };
@ -66,7 +66,7 @@ public:
private: private:
nsArrayCC() : nsArrayBase() {} nsArrayCC() : nsArrayBase() {}
nsArrayCC(const nsArrayCC& aOther); nsArrayCC(const nsArrayCC& aOther);
nsArrayCC(const nsCOMArray_base& aBaseArray) : nsArrayBase(aBaseArray) {} explicit nsArrayCC(const nsCOMArray_base& aBaseArray) : nsArrayBase(aBaseArray) {}
~nsArrayCC() {} ~nsArrayCC() {}
}; };

View File

@ -23,8 +23,8 @@ class ObserverServiceReporter;
struct ObserverRef struct ObserverRef
{ {
ObserverRef(const ObserverRef& aO) : isWeakRef(aO.isWeakRef), ref(aO.ref) {} ObserverRef(const ObserverRef& aO) : isWeakRef(aO.isWeakRef), ref(aO.ref) {}
ObserverRef(nsIObserver* aObserver) : isWeakRef(false), ref(aObserver) {} explicit ObserverRef(nsIObserver* aObserver) : isWeakRef(false), ref(aObserver) {}
ObserverRef(nsIWeakReference* aWeak) : isWeakRef(true), ref(aWeak) {} explicit ObserverRef(nsIWeakReference* aWeak) : isWeakRef(true), ref(aWeak) {}
bool isWeakRef; bool isWeakRef;
nsCOMPtr<nsISupports> ref; nsCOMPtr<nsISupports> ref;
@ -49,7 +49,7 @@ class nsObserverList : public nsCharPtrHashKey
friend class nsObserverService; friend class nsObserverService;
public: public:
nsObserverList(const char* aKey) : nsCharPtrHashKey(aKey) explicit nsObserverList(const char* aKey) : nsCharPtrHashKey(aKey)
{ {
MOZ_COUNT_CTOR(nsObserverList); MOZ_COUNT_CTOR(nsObserverList);
} }
@ -85,7 +85,7 @@ public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
NS_DECL_NSISIMPLEENUMERATOR NS_DECL_NSISIMPLEENUMERATOR
nsObserverEnumerator(nsObserverList* aObserverList); explicit nsObserverEnumerator(nsObserverList* aObserverList);
private: private:
~nsObserverEnumerator() {} ~nsObserverEnumerator() {}

View File

@ -82,7 +82,7 @@ enum EParserSpecial
class nsPropertiesParser class nsPropertiesParser
{ {
public: public:
nsPropertiesParser(nsIPersistentProperties* aProps) explicit nsPropertiesParser(nsIPersistentProperties* aProps)
: mHaveMultiLine(false) : mHaveMultiLine(false)
, mState(eParserState_AwaitingKey) , mState(eParserState_AwaitingKey)
, mProps(aProps) , mProps(aProps)

View File

@ -31,7 +31,7 @@ public:
NS_DECL_AGGREGATED NS_DECL_AGGREGATED
NS_DECL_NSIPROPERTIES NS_DECL_NSIPROPERTIES
nsProperties(nsISupports *aOuter) { NS_INIT_AGGREGATED(aOuter); } explicit nsProperties(nsISupports *aOuter) { NS_INIT_AGGREGATED(aOuter); }
~nsProperties() {} ~nsProperties() {}
}; };

View File

@ -19,13 +19,13 @@ using namespace mozilla;
struct NameTableKey struct NameTableKey
{ {
NameTableKey(const nsAFlatCString* aKeyStr) explicit NameTableKey(const nsAFlatCString* aKeyStr)
: mIsUnichar(false) : mIsUnichar(false)
{ {
mKeyStr.m1b = aKeyStr; mKeyStr.m1b = aKeyStr;
} }
NameTableKey(const nsAFlatString* aKeyStr) explicit NameTableKey(const nsAFlatString* aKeyStr)
: mIsUnichar(true) : mIsUnichar(true)
{ {
mKeyStr.m2b = aKeyStr; mKeyStr.m2b = aKeyStr;

View File

@ -141,7 +141,7 @@ protected:
private: private:
// Copy constructors are not allowed // Copy constructors are not allowed
nsSupportsArray(const nsISupportsArray& aOther); explicit nsSupportsArray(const nsISupportsArray& aOther);
}; };
#endif // nsSupportsArray_h__ #endif // nsSupportsArray_h__

View File

@ -16,7 +16,7 @@ class nsSupportsArrayEnumerator MOZ_FINAL : public nsIBidirectionalEnumerator
public: public:
NS_DECL_ISUPPORTS NS_DECL_ISUPPORTS
nsSupportsArrayEnumerator(nsISupportsArray* aArray); explicit nsSupportsArrayEnumerator(nsISupportsArray* aArray);
// nsIEnumerator methods: // nsIEnumerator methods:
NS_DECL_NSIENUMERATOR NS_DECL_NSIENUMERATOR

View File

@ -315,7 +315,7 @@ public:
NS_DECL_NSISUPPORTSPRIMITIVE NS_DECL_NSISUPPORTSPRIMITIVE
NS_DECL_NSISUPPORTSCSTRING NS_DECL_NSISUPPORTSCSTRING
nsSupportsDependentCString(const char* aStr); explicit nsSupportsDependentCString(const char* aStr);
private: private:
~nsSupportsDependentCString() {} ~nsSupportsDependentCString() {}

View File

@ -34,7 +34,7 @@ private:
T mValue; T mValue;
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
public: public:
AutoRestore(T& aValue MOZ_GUARD_OBJECT_NOTIFIER_PARAM) explicit AutoRestore(T& aValue MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mLocation(aValue) : mLocation(aValue)
, mValue(aValue) , mValue(aValue)
{ {

View File

@ -54,7 +54,7 @@ public:
* unexpected performance issues. * unexpected performance issues.
*/ */
NS_DEADLOCK_DETECTOR_CONSTEXPR NS_DEADLOCK_DETECTOR_CONSTEXPR
CallStack(const callstack_id aCallStack = NS_GET_BACKTRACE()) explicit CallStack(const callstack_id aCallStack = NS_GET_BACKTRACE())
: mCallStack(aCallStack) : mCallStack(aCallStack)
{ {
} }
@ -156,8 +156,8 @@ public:
const T* mResource; const T* mResource;
CallStack mCallContext; CallStack mCallContext;
ResourceAcquisition(const T* aResource, explicit ResourceAcquisition(const T* aResource,
const CallStack aCallContext = CallStack::kNone) const CallStack aCallContext = CallStack::kNone)
: mResource(aResource) : mResource(aResource)
, mCallContext(aCallContext) , mCallContext(aCallContext)
{ {
@ -310,7 +310,7 @@ private:
// Throwaway RAII lock to make the following code safer. // Throwaway RAII lock to make the following code safer.
struct PRAutoLock struct PRAutoLock
{ {
PRAutoLock(PRLock* aLock) : mLock(aLock) { PR_Lock(mLock); } explicit PRAutoLock(PRLock* aLock) : mLock(aLock) { PR_Lock(mLock); }
~PRAutoLock() { PR_Unlock(mLock); } ~PRAutoLock() { PR_Unlock(mLock); }
PRLock* mLock; PRLock* mLock;
}; };
@ -325,7 +325,7 @@ public:
* @param aNumResourcesGuess Guess at approximate number of resources * @param aNumResourcesGuess Guess at approximate number of resources
* that will be checked. * that will be checked.
*/ */
DeadlockDetector(uint32_t aNumResourcesGuess = kDefaultNumBuckets) explicit DeadlockDetector(uint32_t aNumResourcesGuess = kDefaultNumBuckets)
{ {
mOrdering = PL_NewHashTable(aNumResourcesGuess, mOrdering = PL_NewHashTable(aNumResourcesGuess,
HashKey, HashKey,

View File

@ -24,7 +24,7 @@ namespace mozilla {
class NS_COM_GLUE Monitor class NS_COM_GLUE Monitor
{ {
public: public:
Monitor(const char* aName) explicit Monitor(const char* aName)
: mMutex(aName) : mMutex(aName)
, mCondVar(mMutex, "[Monitor.mCondVar]") , mCondVar(mMutex, "[Monitor.mCondVar]")
{ {
@ -72,7 +72,7 @@ private:
class NS_COM_GLUE MOZ_STACK_CLASS MonitorAutoLock class NS_COM_GLUE MOZ_STACK_CLASS MonitorAutoLock
{ {
public: public:
MonitorAutoLock(Monitor& aMonitor) explicit MonitorAutoLock(Monitor& aMonitor)
: mMonitor(&aMonitor) : mMonitor(&aMonitor)
{ {
mMonitor->Lock(); mMonitor->Lock();
@ -111,7 +111,7 @@ private:
class NS_COM_GLUE MOZ_STACK_CLASS MonitorAutoUnlock class NS_COM_GLUE MOZ_STACK_CLASS MonitorAutoUnlock
{ {
public: public:
MonitorAutoUnlock(Monitor& aMonitor) explicit MonitorAutoUnlock(Monitor& aMonitor)
: mMonitor(&aMonitor) : mMonitor(&aMonitor)
{ {
mMonitor->Unlock(); mMonitor->Unlock();

View File

@ -43,7 +43,7 @@ public:
* If success, a valid Mutex* which must be destroyed * If success, a valid Mutex* which must be destroyed
* by Mutex::DestroyMutex() * by Mutex::DestroyMutex()
**/ **/
OffTheBooksMutex(const char* aName) explicit OffTheBooksMutex(const char* aName)
: BlockingResourceBase(aName, eMutex) : BlockingResourceBase(aName, eMutex)
{ {
mLock = PR_NewLock(); mLock = PR_NewLock();
@ -120,7 +120,7 @@ private:
class NS_COM_GLUE Mutex : public OffTheBooksMutex class NS_COM_GLUE Mutex : public OffTheBooksMutex
{ {
public: public:
Mutex(const char* aName) explicit Mutex(const char* aName)
: OffTheBooksMutex(aName) : OffTheBooksMutex(aName)
{ {
MOZ_COUNT_CTOR(Mutex); MOZ_COUNT_CTOR(Mutex);
@ -156,7 +156,7 @@ public:
* @param aLock A valid mozilla::Mutex* returned by * @param aLock A valid mozilla::Mutex* returned by
* mozilla::Mutex::NewMutex. * mozilla::Mutex::NewMutex.
**/ **/
BaseAutoLock(T& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM) explicit BaseAutoLock(T& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mLock(&aLock) : mLock(&aLock)
{ {
MOZ_GUARD_OBJECT_NOTIFIER_INIT; MOZ_GUARD_OBJECT_NOTIFIER_INIT;
@ -194,7 +194,7 @@ template<typename T>
class NS_COM_GLUE MOZ_STACK_CLASS BaseAutoUnlock class NS_COM_GLUE MOZ_STACK_CLASS BaseAutoUnlock
{ {
public: public:
BaseAutoUnlock(T& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM) explicit BaseAutoUnlock(T& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
: mLock(&aLock) : mLock(&aLock)
{ {
MOZ_GUARD_OBJECT_NOTIFIER_INIT; MOZ_GUARD_OBJECT_NOTIFIER_INIT;

View File

@ -32,7 +32,7 @@ private:
typedef typename KeyClass::KeyType KeyType; typedef typename KeyClass::KeyType KeyType;
typedef typename KeyClass::KeyTypePointer KeyTypePointer; typedef typename KeyClass::KeyTypePointer KeyTypePointer;
nsBaseHashtableET(KeyTypePointer aKey); explicit nsBaseHashtableET(KeyTypePointer aKey);
nsBaseHashtableET(nsBaseHashtableET<KeyClass, DataType>&& aToMove); nsBaseHashtableET(nsBaseHashtableET<KeyClass, DataType>&& aToMove);
~nsBaseHashtableET(); ~nsBaseHashtableET();
}; };

View File

@ -23,7 +23,7 @@ class NS_COM_GLUE nsCOMArray_base
friend class nsArrayBase; friend class nsArrayBase;
protected: protected:
nsCOMArray_base() {} nsCOMArray_base() {}
nsCOMArray_base(int32_t aCount) : mArray(aCount) {} explicit nsCOMArray_base(int32_t aCount) : mArray(aCount) {}
nsCOMArray_base(const nsCOMArray_base& aOther); nsCOMArray_base(const nsCOMArray_base& aOther);
~nsCOMArray_base(); ~nsCOMArray_base();

View File

@ -110,7 +110,7 @@ class NS_NO_VTABLE nsCycleCollectionParticipant
{ {
public: public:
MOZ_CONSTEXPR nsCycleCollectionParticipant() : mMightSkip(false) {} MOZ_CONSTEXPR nsCycleCollectionParticipant() : mMightSkip(false) {}
MOZ_CONSTEXPR nsCycleCollectionParticipant(bool aSkip) : mMightSkip(aSkip) {} MOZ_CONSTEXPR explicit nsCycleCollectionParticipant(bool aSkip) : mMightSkip(aSkip) {}
NS_IMETHOD Traverse(void* aPtr, nsCycleCollectionTraversalCallback& aCb) = 0; NS_IMETHOD Traverse(void* aPtr, nsCycleCollectionTraversalCallback& aCb) = 0;
@ -176,7 +176,7 @@ public:
: nsCycleCollectionParticipant(false) : nsCycleCollectionParticipant(false)
{ {
} }
MOZ_CONSTEXPR nsScriptObjectTracer(bool aSkip) MOZ_CONSTEXPR explicit nsScriptObjectTracer(bool aSkip)
: nsCycleCollectionParticipant(aSkip) : nsCycleCollectionParticipant(aSkip)
{ {
} }
@ -195,7 +195,7 @@ public:
: nsScriptObjectTracer(false) : nsScriptObjectTracer(false)
{ {
} }
MOZ_CONSTEXPR nsXPCOMCycleCollectionParticipant(bool aSkip) MOZ_CONSTEXPR explicit nsXPCOMCycleCollectionParticipant(bool aSkip)
: nsScriptObjectTracer(aSkip) : nsScriptObjectTracer(aSkip)
{ {
} }

View File

@ -66,7 +66,7 @@ class NS_COM_GLUE nsDeque
friend class nsDequeIterator; friend class nsDequeIterator;
typedef mozilla::fallible_t fallible_t; typedef mozilla::fallible_t fallible_t;
public: public:
nsDeque(nsDequeFunctor* aDeallocator = nullptr); explicit nsDeque(nsDequeFunctor* aDeallocator = nullptr);
~nsDeque(); ~nsDeque();
/** /**
@ -256,7 +256,7 @@ public:
* @param aQueue is the deque object to be iterated * @param aQueue is the deque object to be iterated
* @param aIndex is the starting position for your iteration * @param aIndex is the starting position for your iteration
*/ */
nsDequeIterator(const nsDeque& aQueue, int aIndex = 0); explicit nsDequeIterator(const nsDeque& aQueue, int aIndex = 0);
/** /**
* Create a copy of a DequeIterator * Create a copy of a DequeIterator

View File

@ -77,7 +77,7 @@ public:
typedef const nsAString& KeyType; typedef const nsAString& KeyType;
typedef const nsAString* KeyTypePointer; typedef const nsAString* KeyTypePointer;
nsStringHashKey(KeyTypePointer aStr) : mStr(*aStr) {} explicit nsStringHashKey(KeyTypePointer aStr) : mStr(*aStr) {}
nsStringHashKey(const nsStringHashKey& aToCopy) : mStr(aToCopy.mStr) {} nsStringHashKey(const nsStringHashKey& aToCopy) : mStr(aToCopy.mStr) {}
~nsStringHashKey() {} ~nsStringHashKey() {}
@ -114,7 +114,7 @@ public:
typedef const nsAString& KeyType; typedef const nsAString& KeyType;
typedef const nsAString* KeyTypePointer; typedef const nsAString* KeyTypePointer;
nsStringCaseInsensitiveHashKey(KeyTypePointer aStr) explicit nsStringCaseInsensitiveHashKey(KeyTypePointer aStr)
: mStr(*aStr) : mStr(*aStr)
{ {
// take it easy just deal HashKey // take it easy just deal HashKey
@ -157,7 +157,7 @@ public:
typedef const nsACString& KeyType; typedef const nsACString& KeyType;
typedef const nsACString* KeyTypePointer; typedef const nsACString* KeyTypePointer;
nsCStringHashKey(const nsACString* aStr) : mStr(*aStr) {} explicit nsCStringHashKey(const nsACString* aStr) : mStr(*aStr) {}
nsCStringHashKey(const nsCStringHashKey& aToCopy) : mStr(aToCopy.mStr) {} nsCStringHashKey(const nsCStringHashKey& aToCopy) : mStr(aToCopy.mStr) {}
~nsCStringHashKey() {} ~nsCStringHashKey() {}
@ -186,7 +186,7 @@ public:
typedef const uint32_t& KeyType; typedef const uint32_t& KeyType;
typedef const uint32_t* KeyTypePointer; typedef const uint32_t* KeyTypePointer;
nsUint32HashKey(KeyTypePointer aKey) : mValue(*aKey) {} explicit nsUint32HashKey(KeyTypePointer aKey) : mValue(*aKey) {}
nsUint32HashKey(const nsUint32HashKey& aToCopy) : mValue(aToCopy.mValue) {} nsUint32HashKey(const nsUint32HashKey& aToCopy) : mValue(aToCopy.mValue) {}
~nsUint32HashKey() {} ~nsUint32HashKey() {}
@ -212,7 +212,7 @@ public:
typedef const uint64_t& KeyType; typedef const uint64_t& KeyType;
typedef const uint64_t* KeyTypePointer; typedef const uint64_t* KeyTypePointer;
nsUint64HashKey(KeyTypePointer aKey) : mValue(*aKey) {} explicit nsUint64HashKey(KeyTypePointer aKey) : mValue(*aKey) {}
nsUint64HashKey(const nsUint64HashKey& aToCopy) : mValue(aToCopy.mValue) {} nsUint64HashKey(const nsUint64HashKey& aToCopy) : mValue(aToCopy.mValue) {}
~nsUint64HashKey() {} ~nsUint64HashKey() {}
@ -241,7 +241,7 @@ public:
typedef const float& KeyType; typedef const float& KeyType;
typedef const float* KeyTypePointer; typedef const float* KeyTypePointer;
nsFloatHashKey(KeyTypePointer aKey) : mValue(*aKey) {} explicit nsFloatHashKey(KeyTypePointer aKey) : mValue(*aKey) {}
nsFloatHashKey(const nsFloatHashKey& aToCopy) : mValue(aToCopy.mValue) {} nsFloatHashKey(const nsFloatHashKey& aToCopy) : mValue(aToCopy.mValue) {}
~nsFloatHashKey() {} ~nsFloatHashKey() {}
@ -270,7 +270,7 @@ public:
typedef nsISupports* KeyType; typedef nsISupports* KeyType;
typedef const nsISupports* KeyTypePointer; typedef const nsISupports* KeyTypePointer;
nsISupportsHashKey(const nsISupports* aKey) explicit nsISupportsHashKey(const nsISupports* aKey)
: mSupports(const_cast<nsISupports*>(aKey)) : mSupports(const_cast<nsISupports*>(aKey))
{ {
} }
@ -306,7 +306,7 @@ public:
typedef T* KeyType; typedef T* KeyType;
typedef const T* KeyTypePointer; typedef const T* KeyTypePointer;
nsRefPtrHashKey(const T* aKey) : mKey(const_cast<T*>(aKey)) {} explicit nsRefPtrHashKey(const T* aKey) : mKey(const_cast<T*>(aKey)) {}
nsRefPtrHashKey(const nsRefPtrHashKey& aToCopy) : mKey(aToCopy.mKey) {} nsRefPtrHashKey(const nsRefPtrHashKey& aToCopy) : mKey(aToCopy.mKey) {}
~nsRefPtrHashKey() {} ~nsRefPtrHashKey() {}
@ -346,7 +346,7 @@ public:
typedef T* KeyType; typedef T* KeyType;
typedef const T* KeyTypePointer; typedef const T* KeyTypePointer;
nsPtrHashKey(const T* aKey) : mKey(const_cast<T*>(aKey)) {} explicit nsPtrHashKey(const T* aKey) : mKey(const_cast<T*>(aKey)) {}
nsPtrHashKey(const nsPtrHashKey<T>& aToCopy) : mKey(aToCopy.mKey) {} nsPtrHashKey(const nsPtrHashKey<T>& aToCopy) : mKey(aToCopy.mKey) {}
~nsPtrHashKey() {} ~nsPtrHashKey() {}
@ -376,7 +376,7 @@ template<class T>
class nsClearingPtrHashKey : public nsPtrHashKey<T> class nsClearingPtrHashKey : public nsPtrHashKey<T>
{ {
public: public:
nsClearingPtrHashKey(const T* aKey) : nsPtrHashKey<T>(aKey) {} explicit nsClearingPtrHashKey(const T* aKey) : nsPtrHashKey<T>(aKey) {}
nsClearingPtrHashKey(const nsClearingPtrHashKey<T>& aToCopy) nsClearingPtrHashKey(const nsClearingPtrHashKey<T>& aToCopy)
: nsPtrHashKey<T>(aToCopy) : nsPtrHashKey<T>(aToCopy)
{ {
@ -399,7 +399,7 @@ public:
typedef T& KeyType; typedef T& KeyType;
typedef const T* KeyTypePointer; typedef const T* KeyTypePointer;
nsFuncPtrHashKey(const T* aKey) : mKey(*const_cast<T*>(aKey)) {} explicit nsFuncPtrHashKey(const T* aKey) : mKey(*const_cast<T*>(aKey)) {}
nsFuncPtrHashKey(const nsFuncPtrHashKey<T>& aToCopy) : mKey(aToCopy.mKey) {} nsFuncPtrHashKey(const nsFuncPtrHashKey<T>& aToCopy) : mKey(aToCopy.mKey) {}
~nsFuncPtrHashKey() {} ~nsFuncPtrHashKey() {}
@ -428,7 +428,7 @@ public:
typedef const nsID& KeyType; typedef const nsID& KeyType;
typedef const nsID* KeyTypePointer; typedef const nsID* KeyTypePointer;
nsIDHashKey(const nsID* aInID) : mID(*aInID) {} explicit nsIDHashKey(const nsID* aInID) : mID(*aInID) {}
nsIDHashKey(const nsIDHashKey& aToCopy) : mID(aToCopy.mID) {} nsIDHashKey(const nsIDHashKey& aToCopy) : mID(aToCopy.mID) {}
~nsIDHashKey() {} ~nsIDHashKey() {}
@ -464,7 +464,7 @@ public:
typedef const char* KeyType; typedef const char* KeyType;
typedef const char* KeyTypePointer; typedef const char* KeyTypePointer;
nsDepCharHashKey(const char* aKey) : mKey(aKey) {} explicit nsDepCharHashKey(const char* aKey) : mKey(aKey) {}
nsDepCharHashKey(const nsDepCharHashKey& aToCopy) : mKey(aToCopy.mKey) {} nsDepCharHashKey(const nsDepCharHashKey& aToCopy) : mKey(aToCopy.mKey) {}
~nsDepCharHashKey() {} ~nsDepCharHashKey() {}
@ -493,7 +493,7 @@ public:
typedef const char* KeyType; typedef const char* KeyType;
typedef const char* KeyTypePointer; typedef const char* KeyTypePointer;
nsCharPtrHashKey(const char* aKey) : mKey(strdup(aKey)) {} explicit nsCharPtrHashKey(const char* aKey) : mKey(strdup(aKey)) {}
nsCharPtrHashKey(const nsCharPtrHashKey& aToCopy) nsCharPtrHashKey(const nsCharPtrHashKey& aToCopy)
: mKey(strdup(aToCopy.mKey)) : mKey(strdup(aToCopy.mKey))
{ {
@ -538,7 +538,7 @@ public:
typedef const char16_t* KeyType; typedef const char16_t* KeyType;
typedef const char16_t* KeyTypePointer; typedef const char16_t* KeyTypePointer;
nsUnicharPtrHashKey(const char16_t* aKey) : mKey(NS_strdup(aKey)) {} explicit nsUnicharPtrHashKey(const char16_t* aKey) : mKey(NS_strdup(aKey)) {}
nsUnicharPtrHashKey(const nsUnicharPtrHashKey& aToCopy) nsUnicharPtrHashKey(const nsUnicharPtrHashKey& aToCopy)
: mKey(NS_strdup(aToCopy.mKey)) : mKey(NS_strdup(aToCopy.mKey))
{ {
@ -581,7 +581,7 @@ public:
typedef nsIHashable* KeyType; typedef nsIHashable* KeyType;
typedef const nsIHashable* KeyTypePointer; typedef const nsIHashable* KeyTypePointer;
nsHashableHashKey(const nsIHashable* aKey) explicit nsHashableHashKey(const nsIHashable* aKey)
: mKey(const_cast<nsIHashable*>(aKey)) : mKey(const_cast<nsIHashable*>(aKey))
{ {
} }
@ -628,7 +628,7 @@ public:
typedef const T& KeyType; typedef const T& KeyType;
typedef const T* KeyTypePointer; typedef const T* KeyTypePointer;
nsGenericHashKey(KeyTypePointer aKey) : mKey(*aKey) {} explicit nsGenericHashKey(KeyTypePointer aKey) : mKey(*aKey) {}
nsGenericHashKey(const nsGenericHashKey<T>& aOther) : mKey(aOther.mKey) {} nsGenericHashKey(const nsGenericHashKey<T>& aOther) : mKey(aOther.mKey) {}
KeyType GetKey() const { return mKey; } KeyType GetKey() const { return mKey; }

View File

@ -103,7 +103,7 @@ public:
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSICLASSINFO NS_DECL_NSICLASSINFO
GenericClassInfo(const ClassInfoData* aData) : mData(aData) {} explicit GenericClassInfo(const ClassInfoData* aData) : mData(aData) {}
private: private:
const ClassInfoData* mData; const ClassInfoData* mData;

View File

@ -28,7 +28,7 @@ template<class T>
class nsHashKeyDisallowMemmove : public T class nsHashKeyDisallowMemmove : public T
{ {
public: public:
nsHashKeyDisallowMemmove(const T& aKey) : T(aKey) {} explicit nsHashKeyDisallowMemmove(const typename T::KeyTypePointer aKey) : T(aKey) {}
enum { ALLOW_MEMMOVE = false }; enum { ALLOW_MEMMOVE = false };
}; };

View File

@ -112,7 +112,7 @@ public:
// off-main-thread. But some consumers need to use the same pointer for // off-main-thread. But some consumers need to use the same pointer for
// multiple classes, some of which are main-thread-only and some of which // multiple classes, some of which are main-thread-only and some of which
// aren't. So we allow them to explicitly disable this strict checking. // aren't. So we allow them to explicitly disable this strict checking.
nsMainThreadPtrHolder(T* aPtr, bool aStrict = true) explicit nsMainThreadPtrHolder(T* aPtr, bool aStrict = true)
: mRawPtr(nullptr) : mRawPtr(nullptr)
, mStrict(aStrict) , mStrict(aStrict)
{ {

View File

@ -294,7 +294,7 @@ template<class ClassType, bool Owning>
struct nsRunnableMethodReceiver<ClassType, void, Owning> struct nsRunnableMethodReceiver<ClassType, void, Owning>
{ {
ClassType* mObj; ClassType* mObj;
nsRunnableMethodReceiver(ClassType* aObj) : mObj(aObj) { NS_IF_ADDREF(mObj); } explicit nsRunnableMethodReceiver(ClassType* aObj) : mObj(aObj) { NS_IF_ADDREF(mObj); }
~nsRunnableMethodReceiver() { Revoke(); } ~nsRunnableMethodReceiver() { Revoke(); }
void Revoke() { NS_IF_RELEASE(mObj); } void Revoke() { NS_IF_RELEASE(mObj); }
}; };
@ -303,7 +303,7 @@ template<class ClassType>
struct nsRunnableMethodReceiver<ClassType, void, false> struct nsRunnableMethodReceiver<ClassType, void, false>
{ {
ClassType* mObj; ClassType* mObj;
nsRunnableMethodReceiver(ClassType* aObj) : mObj(aObj) {} explicit nsRunnableMethodReceiver(ClassType* aObj) : mObj(aObj) {}
void Revoke() { mObj = nullptr; } void Revoke() { mObj = nullptr; }
}; };