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
{
public:
PointerClearer(SmartPtr* aPtr)
explicit PointerClearer(SmartPtr* aPtr)
: mPtr(aPtr)
{
}

View File

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

View File

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

View File

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

View File

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

View File

@ -433,7 +433,7 @@ public:
Iterator() : mPointer(nullptr)
{
}
Iterator(PtrInfoOrBlock* aPointer) : mPointer(aPointer)
explicit Iterator(PtrInfoOrBlock* aPointer) : mPointer(aPointer)
{
}
Iterator(const Iterator& aOther) : mPointer(aOther.mPointer)
@ -483,7 +483,7 @@ public:
class Builder
{
public:
Builder(EdgePool& aPool)
explicit Builder(EdgePool& aPool)
: mCurrent(&aPool.mSentinelAndBlocks[0])
, mBlockEnd(&aPool.mSentinelAndBlocks[0])
, mNextBlockPtr(&aPool.Blocks())
@ -697,7 +697,7 @@ public:
class Builder
{
public:
Builder(NodePool& aPool)
explicit Builder(NodePool& aPool)
: mNextBlock(&aPool.mBlocks)
, mNext(aPool.mLast)
, mBlockEnd(nullptr)
@ -727,7 +727,7 @@ public:
class Enumerator
{
public:
Enumerator(NodePool& aPool)
explicit Enumerator(NodePool& aPool)
: mFirstBlock(aPool.mBlocks)
, mCurBlock(nullptr)
, mNext(nullptr)
@ -1184,7 +1184,7 @@ AddPurpleRoot(CCGraphBuilder& aBuilder, void* aRoot,
struct SelectPointersVisitor
{
SelectPointersVisitor(CCGraphBuilder& aBuilder)
explicit SelectPointersVisitor(CCGraphBuilder& aBuilder)
: mBuilder(aBuilder)
{
}
@ -1378,7 +1378,7 @@ public:
void WalkFromRoots(CCGraph& aGraph);
// copy-constructing the visitor should be cheap, and less
// 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;
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:
JSPurpleBuffer(JSPurpleBuffer*& aReferenceToThis)
explicit JSPurpleBuffer(JSPurpleBuffer*& aReferenceToThis)
: mReferenceToThis(aReferenceToThis)
{
mReferenceToThis = this;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,7 +23,7 @@ class NS_COM_GLUE nsCOMArray_base
friend class nsArrayBase;
protected:
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();

View File

@ -110,7 +110,7 @@ class NS_NO_VTABLE nsCycleCollectionParticipant
{
public:
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;
@ -176,7 +176,7 @@ public:
: nsCycleCollectionParticipant(false)
{
}
MOZ_CONSTEXPR nsScriptObjectTracer(bool aSkip)
MOZ_CONSTEXPR explicit nsScriptObjectTracer(bool aSkip)
: nsCycleCollectionParticipant(aSkip)
{
}
@ -195,7 +195,7 @@ public:
: nsScriptObjectTracer(false)
{
}
MOZ_CONSTEXPR nsXPCOMCycleCollectionParticipant(bool aSkip)
MOZ_CONSTEXPR explicit nsXPCOMCycleCollectionParticipant(bool aSkip)
: nsScriptObjectTracer(aSkip)
{
}

View File

@ -66,7 +66,7 @@ class NS_COM_GLUE nsDeque
friend class nsDequeIterator;
typedef mozilla::fallible_t fallible_t;
public:
nsDeque(nsDequeFunctor* aDeallocator = nullptr);
explicit nsDeque(nsDequeFunctor* aDeallocator = nullptr);
~nsDeque();
/**
@ -256,7 +256,7 @@ public:
* @param aQueue is the deque object to be iterated
* @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

View File

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

View File

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

View File

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

View File

@ -112,7 +112,7 @@ public:
// 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
// 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)
, mStrict(aStrict)
{

View File

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