diff --git a/accessible/base/NotificationController.h b/accessible/base/NotificationController.h index 60684fba78ed..a83490fdd317 100644 --- a/accessible/base/NotificationController.h +++ b/accessible/base/NotificationController.h @@ -367,10 +367,7 @@ private: typedef const T* KeyTypePointer; explicit nsCOMPtrHashKey(const T* aKey) : mKey(const_cast(aKey)) {} - nsCOMPtrHashKey(nsCOMPtrHashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mKey(std::move(aOther.mKey)) - {} + explicit nsCOMPtrHashKey(const nsPtrHashKey &aToCopy) : mKey(aToCopy.mKey) {} ~nsCOMPtrHashKey() { } KeyType GetKey() const { return mKey; } diff --git a/dom/animation/PseudoElementHashEntry.h b/dom/animation/PseudoElementHashEntry.h index a576e9c572cd..63f9c60c80e0 100644 --- a/dom/animation/PseudoElementHashEntry.h +++ b/dom/animation/PseudoElementHashEntry.h @@ -24,7 +24,7 @@ public: explicit PseudoElementHashEntry(KeyTypePointer aKey) : mElement(aKey->mElement) , mPseudoType(aKey->mPseudoType) { } - PseudoElementHashEntry(PseudoElementHashEntry&& aOther) = default; + explicit PseudoElementHashEntry(const PseudoElementHashEntry& aCopy)=default; ~PseudoElementHashEntry() = default; diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index e2df0ed9e922..5676421a8940 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -386,8 +386,7 @@ nsIdentifierMapEntry::~nsIdentifierMapEntry() {} nsIdentifierMapEntry::nsIdentifierMapEntry(nsIdentifierMapEntry&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mKey(std::move(aOther.mKey)) + : mKey(std::move(aOther.mKey)) , mIdContentList(std::move(aOther.mIdContentList)) , mNameContentList(std::move(aOther.mNameContentList)) , mChangeCallbacks(std::move(aOther.mChangeCallbacks)) diff --git a/dom/base/nsIdentifierMapEntry.h b/dom/base/nsIdentifierMapEntry.h index ce4f5fd1ead0..64a12525d2ad 100644 --- a/dom/base/nsIdentifierMapEntry.h +++ b/dom/base/nsIdentifierMapEntry.h @@ -182,9 +182,8 @@ public: explicit ChangeCallbackEntry(const ChangeCallback* aKey) : mKey(*aKey) { } - ChangeCallbackEntry(ChangeCallbackEntry&& aOther) : - PLDHashEntryHdr(std::move(aOther)), - mKey(std::move(aOther.mKey)) { } + ChangeCallbackEntry(const ChangeCallbackEntry& toCopy) : + mKey(toCopy.mKey) { } KeyType GetKey() const { return mKey; } bool KeyEquals(KeyTypePointer aKey) const { diff --git a/dom/base/nsNodeInfoManager.h b/dom/base/nsNodeInfoManager.h index 97fed1a16d98..876f900916cb 100644 --- a/dom/base/nsNodeInfoManager.h +++ b/dom/base/nsNodeInfoManager.h @@ -149,7 +149,6 @@ private: { public: explicit NodeInfoInnerKey(KeyTypePointer aKey) : nsPtrHashKey(aKey) {} - NodeInfoInnerKey(NodeInfoInnerKey&&) = default; ~NodeInfoInnerKey() = default; bool KeyEquals(KeyTypePointer aKey) const { return *mKey == *aKey; } static PLDHashNumber HashKey(KeyTypePointer aKey) { return aKey->Hash(); } diff --git a/dom/commandhandler/nsCommandParams.cpp b/dom/commandhandler/nsCommandParams.cpp index d72381c589a4..1a7258e06fef 100644 --- a/dom/commandhandler/nsCommandParams.cpp +++ b/dom/commandhandler/nsCommandParams.cpp @@ -336,10 +336,10 @@ nsCommandParams::HashMoveEntry(PLDHashTable* aTable, const PLDHashEntryHdr* aFrom, PLDHashEntryHdr* aTo) { - auto* fromEntry = const_cast(static_cast(aFrom)); + const HashEntry* fromEntry = static_cast(aFrom); HashEntry* toEntry = static_cast(aTo); - new (KnownNotNull, toEntry) HashEntry(std::move(*fromEntry)); + new (toEntry) HashEntry(*fromEntry); fromEntry->~HashEntry(); } diff --git a/dom/commandhandler/nsCommandParams.h b/dom/commandhandler/nsCommandParams.h index 45c27c2d5061..befc4c8c8857 100644 --- a/dom/commandhandler/nsCommandParams.h +++ b/dom/commandhandler/nsCommandParams.h @@ -86,7 +86,7 @@ protected: Reset(mEntryType); } - explicit HashEntry(const HashEntry& aRHS) + HashEntry(const HashEntry& aRHS) : mEntryType(aRHS.mEntryType) { Reset(mEntryType); diff --git a/dom/html/HTMLMediaElement.cpp b/dom/html/HTMLMediaElement.cpp index d67ab3675df3..f9f317fb888c 100644 --- a/dom/html/HTMLMediaElement.cpp +++ b/dom/html/HTMLMediaElement.cpp @@ -3704,10 +3704,15 @@ HTMLMediaElement::MozCaptureStreamUntilEnded(ErrorResult& aRv) class MediaElementSetForURI : public nsURIHashKey { public: - explicit MediaElementSetForURI(const nsIURI* aKey) : nsURIHashKey(aKey) {} - MediaElementSetForURI(MediaElementSetForURI&& aOther) - : nsURIHashKey(std::move(aOther)) - , mElements(std::move(aOther.mElements)) {} + explicit MediaElementSetForURI(const nsIURI* aKey) + : nsURIHashKey(aKey) + { + } + MediaElementSetForURI(const MediaElementSetForURI& toCopy) + : nsURIHashKey(toCopy) + , mElements(toCopy.mElements) + { + } nsTArray mElements; }; diff --git a/dom/smil/nsSMILCompositor.h b/dom/smil/nsSMILCompositor.h index e8968a22e748..e1cddd104e86 100644 --- a/dom/smil/nsSMILCompositor.h +++ b/dom/smil/nsSMILCompositor.h @@ -35,8 +35,7 @@ public: mForceCompositing(false) { } nsSMILCompositor(nsSMILCompositor&& toMove) - : PLDHashEntryHdr(std::move(toMove)), - mKey(std::move(toMove.mKey)), + : mKey(std::move(toMove.mKey)), mAnimationFunctions(std::move(toMove.mAnimationFunctions)), mForceCompositing(false) { } diff --git a/dom/storage/LocalStorageManager.h b/dom/storage/LocalStorageManager.h index 6e76e282ab1c..d7b15f194958 100644 --- a/dom/storage/LocalStorageManager.h +++ b/dom/storage/LocalStorageManager.h @@ -66,10 +66,8 @@ private: , mCache(new LocalStorageCache(aKey)) {} - LocalStorageCacheHashKey(LocalStorageCacheHashKey&& aOther) - : nsCStringHashKey(std::move(aOther)) - , mCache(std::move(aOther.mCache)) - , mCacheRef(std::move(aOther.mCacheRef)) + LocalStorageCacheHashKey(const LocalStorageCacheHashKey& aOther) + : nsCStringHashKey(aOther) { NS_ERROR("Shouldn't be called"); } diff --git a/dom/xslt/xslt/txExecutionState.h b/dom/xslt/xslt/txExecutionState.h index a3db0ccea472..1a2da00d4822 100644 --- a/dom/xslt/xslt/txExecutionState.h +++ b/dom/xslt/xslt/txExecutionState.h @@ -29,10 +29,8 @@ public: mLoadResult(NS_OK) { } - txLoadedDocumentEntry(txLoadedDocumentEntry&& aOther) - : nsStringHashKey(std::move(aOther)) - , mDocument(std::move(aOther.mDocument)) - , mLoadResult(std::move(aOther.mLoadResult)) + txLoadedDocumentEntry(const txLoadedDocumentEntry& aToCopy) + : nsStringHashKey(aToCopy) { NS_ERROR("We're horked."); } diff --git a/gfx/thebes/gfxFontFeatures.h b/gfx/thebes/gfxFontFeatures.h index 9d72a71969f5..83995173f0e6 100644 --- a/gfx/thebes/gfxFontFeatures.h +++ b/gfx/thebes/gfxFontFeatures.h @@ -112,10 +112,7 @@ private: typedef const FeatureValueHashKey *KeyTypePointer; explicit FeatureValueHashEntry(KeyTypePointer aKey) { } - FeatureValueHashEntry(FeatureValueHashEntry&& other) - : PLDHashEntryHdr(std::move(other)) - , mKey(std::move(other.mKey)) - , mValues(std::move(other.mValues)) + FeatureValueHashEntry(const FeatureValueHashEntry& toCopy) { NS_ERROR("Should not be called"); } diff --git a/gfx/thebes/gfxGlyphExtents.h b/gfx/thebes/gfxGlyphExtents.h index 1f5c5c16bf67..c4abb9c643db 100644 --- a/gfx/thebes/gfxGlyphExtents.h +++ b/gfx/thebes/gfxGlyphExtents.h @@ -89,7 +89,9 @@ private: // When constructing a new entry in the hashtable, we'll leave this // blank. The caller of Put() will fill this in. explicit HashEntry(KeyTypePointer aPtr) : nsUint32HashKey(aPtr) {} - HashEntry(HashEntry&& other) = default; + HashEntry(const HashEntry& toCopy) : nsUint32HashKey(toCopy) { + x = toCopy.x; y = toCopy.y; width = toCopy.width; height = toCopy.height; + } float x, y, width, height; }; diff --git a/gfx/thebes/gfxUserFontSet.h b/gfx/thebes/gfxUserFontSet.h index 6fed0de2a8ed..35a36f3442f8 100644 --- a/gfx/thebes/gfxUserFontSet.h +++ b/gfx/thebes/gfxUserFontSet.h @@ -394,8 +394,7 @@ public: { } Entry(Entry&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mURI(std::move(aOther.mURI)) + : mURI(std::move(aOther.mURI)) , mPrincipal(std::move(aOther.mPrincipal)) , mFontEntry(std::move(aOther.mFontEntry)) , mPrivate(std::move(aOther.mPrivate)) diff --git a/layout/painting/RetainedDisplayListHelpers.h b/layout/painting/RetainedDisplayListHelpers.h index c7beca046d44..f34a44303cdf 100644 --- a/layout/painting/RetainedDisplayListHelpers.h +++ b/layout/painting/RetainedDisplayListHelpers.h @@ -28,7 +28,7 @@ public: explicit DisplayItemHashEntry(KeyTypePointer aKey) : mKey(*aKey) {} - DisplayItemHashEntry(DisplayItemHashEntry&&) = default; + explicit DisplayItemHashEntry(const DisplayItemHashEntry& aCopy)=default; ~DisplayItemHashEntry() = default; diff --git a/layout/style/Loader.h b/layout/style/Loader.h index 122c1baf8563..ff792018780b 100644 --- a/layout/style/Loader.h +++ b/layout/style/Loader.h @@ -24,7 +24,6 @@ #include "mozilla/StyleSheetInlines.h" #include "mozilla/Maybe.h" #include "mozilla/MemoryReporting.h" -#include "mozilla/Move.h" #include "mozilla/StyleSheet.h" #include "mozilla/UniquePtr.h" #include "mozilla/net/ReferrerPolicy.h" @@ -70,11 +69,11 @@ public: { MOZ_COUNT_CTOR(URIPrincipalReferrerPolicyAndCORSModeHashKey); } - URIPrincipalReferrerPolicyAndCORSModeHashKey(URIPrincipalReferrerPolicyAndCORSModeHashKey&& toMove) - : nsURIHashKey(std::move(toMove)), - mPrincipal(std::move(toMove.mPrincipal)), - mCORSMode(std::move(toMove.mCORSMode)), - mReferrerPolicy(std::move(toMove.mReferrerPolicy)) + URIPrincipalReferrerPolicyAndCORSModeHashKey(const URIPrincipalReferrerPolicyAndCORSModeHashKey& toCopy) + : nsURIHashKey(toCopy), + mPrincipal(toCopy.mPrincipal), + mCORSMode(toCopy.mCORSMode), + mReferrerPolicy(toCopy.mReferrerPolicy) { MOZ_COUNT_CTOR(URIPrincipalReferrerPolicyAndCORSModeHashKey); } diff --git a/modules/libpref/Preferences.cpp b/modules/libpref/Preferences.cpp index adf13125cbd5..065abe470ac9 100644 --- a/modules/libpref/Preferences.cpp +++ b/modules/libpref/Preferences.cpp @@ -2081,7 +2081,7 @@ public: mCanonical = canonical; } - // This is explicitly not a copy constructor. + // Copy constructor needs to be explicit or the linker complains. explicit PrefCallback(const PrefCallback*& aCopy) : mDomain(aCopy->mDomain) , mBranch(aCopy->mBranch) @@ -2092,9 +2092,6 @@ public: MOZ_COUNT_CTOR(PrefCallback); } - PrefCallback(const PrefCallback&) = delete; - PrefCallback(PrefCallback&&) = default; - ~PrefCallback() { MOZ_COUNT_DTOR(PrefCallback); } bool KeyEquals(const PrefCallback* aKey) const diff --git a/netwerk/base/nsURIHashKey.h b/netwerk/base/nsURIHashKey.h index 47994b953372..520d6c6faf37 100644 --- a/netwerk/base/nsURIHashKey.h +++ b/netwerk/base/nsURIHashKey.h @@ -9,7 +9,6 @@ #include "nsCOMPtr.h" #include "nsIURI.h" #include "nsHashKeys.h" -#include "mozilla/Move.h" #include "mozilla/Unused.h" /** @@ -23,12 +22,8 @@ public: explicit nsURIHashKey(const nsIURI* aKey) : mKey(const_cast(aKey)) { MOZ_COUNT_CTOR(nsURIHashKey); } - nsURIHashKey(nsURIHashKey&& toMove) - : PLDHashEntryHdr(std::move(toMove)) - , mKey(std::move(toMove.mKey)) - { - MOZ_COUNT_CTOR(nsURIHashKey); - } + nsURIHashKey(const nsURIHashKey& toCopy) : + mKey(toCopy.mKey) { MOZ_COUNT_CTOR(nsURIHashKey); } ~nsURIHashKey() { MOZ_COUNT_DTOR(nsURIHashKey); } nsIURI* GetKey() const { return mKey; } diff --git a/netwerk/cache/nsCacheEntry.cpp b/netwerk/cache/nsCacheEntry.cpp index 613394a5d1f7..cfbad5201454 100644 --- a/netwerk/cache/nsCacheEntry.cpp +++ b/netwerk/cache/nsCacheEntry.cpp @@ -502,8 +502,8 @@ nsCacheEntryHashTable::MoveEntry(PLDHashTable * /* table */, const PLDHashEntryHdr *from, PLDHashEntryHdr *to) { - new (KnownNotNull, to) nsCacheEntryHashTableEntry(std::move(*((nsCacheEntryHashTableEntry *)from))); - // No need to destroy `from`. + ((nsCacheEntryHashTableEntry *)to)->cacheEntry = + ((nsCacheEntryHashTableEntry *)from)->cacheEntry; } diff --git a/netwerk/cache/nsDiskCacheBinding.cpp b/netwerk/cache/nsDiskCacheBinding.cpp index 0f21f09d6446..3e3d92452616 100644 --- a/netwerk/cache/nsDiskCacheBinding.cpp +++ b/netwerk/cache/nsDiskCacheBinding.cpp @@ -43,8 +43,7 @@ MoveEntry(PLDHashTable * /* table */, const PLDHashEntryHdr * src, PLDHashEntryHdr * dst) { - new (KnownNotNull, dst) HashTableEntry(std::move(*(HashTableEntry*)src)); - // No need to delete `src`. + ((HashTableEntry *)dst)->mBinding = ((HashTableEntry *)src)->mBinding; } diff --git a/netwerk/cookie/nsCookieKey.h b/netwerk/cookie/nsCookieKey.h index 098ed3e2a7ca..b716a9a0bab2 100644 --- a/netwerk/cookie/nsCookieKey.h +++ b/netwerk/cookie/nsCookieKey.h @@ -28,8 +28,10 @@ public: , mOriginAttributes(other->mOriginAttributes) {} - nsCookieKey(nsCookieKey&& other) = default; - nsCookieKey& operator=(nsCookieKey&&) = default; + nsCookieKey(KeyType other) + : mBaseDomain(other.mBaseDomain) + , mOriginAttributes(other.mOriginAttributes) + {} bool KeyEquals(KeyTypePointer other) const { diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index 694e670d1067..2478a3122d8b 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -2898,7 +2898,7 @@ nsCookieService::Read() nsCookieKey key(baseDomain, attrs); CookieDomainTuple* tuple = mReadArray.AppendElement(); - tuple->key = std::move(key); + tuple->key = key; tuple->cookie = GetCookieFromRow(stmt, attrs); } diff --git a/parser/html/nsHtml5AtomTable.cpp b/parser/html/nsHtml5AtomTable.cpp index a21346637afc..958daea15dc8 100644 --- a/parser/html/nsHtml5AtomTable.cpp +++ b/parser/html/nsHtml5AtomTable.cpp @@ -11,8 +11,8 @@ nsHtml5AtomEntry::nsHtml5AtomEntry(KeyTypePointer aStr) { } -nsHtml5AtomEntry::nsHtml5AtomEntry(nsHtml5AtomEntry&& aOther) - : nsStringHashKey(std::move(aOther)) +nsHtml5AtomEntry::nsHtml5AtomEntry(const nsHtml5AtomEntry& aOther) + : nsStringHashKey(aOther) , mAtom(nullptr) { MOZ_ASSERT_UNREACHABLE("nsHtml5AtomTable is broken; tried to copy an entry"); diff --git a/parser/html/nsHtml5AtomTable.h b/parser/html/nsHtml5AtomTable.h index 2582ffdc2122..9ba15d7c8605 100644 --- a/parser/html/nsHtml5AtomTable.h +++ b/parser/html/nsHtml5AtomTable.h @@ -16,7 +16,7 @@ class nsHtml5AtomEntry : public nsStringHashKey { public: explicit nsHtml5AtomEntry(KeyTypePointer aStr); - nsHtml5AtomEntry(nsHtml5AtomEntry&& aOther); + nsHtml5AtomEntry(const nsHtml5AtomEntry& aOther); ~nsHtml5AtomEntry(); inline nsAtom* GetAtom() { return mAtom; } diff --git a/security/manager/ssl/nsCertOverrideService.h b/security/manager/ssl/nsCertOverrideService.h index 9fe8d122821c..5a5ac9714496 100644 --- a/security/manager/ssl/nsCertOverrideService.h +++ b/security/manager/ssl/nsCertOverrideService.h @@ -81,8 +81,7 @@ class nsCertOverrideEntry final : public PLDHashEntryHdr } nsCertOverrideEntry(nsCertOverrideEntry&& toMove) - : PLDHashEntryHdr(std::move(toMove)) - , mSettings(std::move(toMove.mSettings)) + : mSettings(std::move(toMove.mSettings)) , mHostWithPort(std::move(toMove.mHostWithPort)) { } diff --git a/security/manager/ssl/nsClientAuthRemember.h b/security/manager/ssl/nsClientAuthRemember.h index 91be8c2b50a0..bfc6309204fb 100644 --- a/security/manager/ssl/nsClientAuthRemember.h +++ b/security/manager/ssl/nsClientAuthRemember.h @@ -65,8 +65,7 @@ class nsClientAuthRememberEntry final : public PLDHashEntryHdr } nsClientAuthRememberEntry(nsClientAuthRememberEntry&& aToMove) - : PLDHashEntryHdr(std::move(aToMove)) - , mSettings(std::move(aToMove.mSettings)) + : mSettings(std::move(aToMove.mSettings)) , mEntryKey(std::move(aToMove.mEntryKey)) { } diff --git a/toolkit/components/places/History.h b/toolkit/components/places/History.h index 0328c02f4faf..a052b259de6b 100644 --- a/toolkit/components/places/History.h +++ b/toolkit/components/places/History.h @@ -9,7 +9,6 @@ #include "mozilla/IHistory.h" #include "mozilla/MemoryReporting.h" -#include "mozilla/Move.h" #include "mozilla/Mutex.h" #include "mozIAsyncHistory.h" #include "nsIDownloadHistory.h" @@ -213,10 +212,8 @@ private: : nsURIHashKey(aURI) { } - KeyClass(KeyClass&& aOther) - : nsURIHashKey(std::move(aOther)) - , array(std::move(aOther.array)) - , mVisited(std::move(aOther.mVisited)) + KeyClass(const KeyClass& aOther) + : nsURIHashKey(aOther) { MOZ_ASSERT_UNREACHABLE("Do not call me!"); } @@ -240,7 +237,7 @@ private: explicit RecentURIKey(const nsIURI* aURI) : nsURIHashKey(aURI) { } - RecentURIKey(RecentURIKey&& aOther) : nsURIHashKey(std::move(aOther)) + RecentURIKey(const RecentURIKey& aOther) : nsURIHashKey(aOther) { MOZ_ASSERT_UNREACHABLE("Do not call me!"); } diff --git a/toolkit/components/places/nsFaviconService.h b/toolkit/components/places/nsFaviconService.h index d2703aead1c7..1b283988e1d1 100644 --- a/toolkit/components/places/nsFaviconService.h +++ b/toolkit/components/places/nsFaviconService.h @@ -21,7 +21,6 @@ #include "imgITools.h" #include "mozilla/storage.h" #include "mozilla/Attributes.h" -#include "mozilla/Move.h" #include "FaviconHelpers.h" @@ -38,13 +37,11 @@ class UnassociatedIconHashKey : public nsURIHashKey { public: explicit UnassociatedIconHashKey(const nsIURI* aURI) - : nsURIHashKey(aURI) + : nsURIHashKey(aURI) { } - UnassociatedIconHashKey(UnassociatedIconHashKey&& aOther) - : nsURIHashKey(std::move(aOther)) - , iconData(std::move(aOther.iconData)) - , created(std::move(aOther.created)) + UnassociatedIconHashKey(const UnassociatedIconHashKey& aOther) + : nsURIHashKey(aOther) { MOZ_ASSERT_UNREACHABLE("Do not call me!"); } diff --git a/toolkit/components/places/nsNavHistory.h b/toolkit/components/places/nsNavHistory.h index 0d392e53ba62..618a1d9593b6 100644 --- a/toolkit/components/places/nsNavHistory.h +++ b/toolkit/components/places/nsNavHistory.h @@ -532,8 +532,8 @@ protected: : nsURIHashKey(aURI) { } - VisitHashKey(VisitHashKey&& aOther) - : nsURIHashKey(std::move(aOther)) + VisitHashKey(const VisitHashKey& aOther) + : nsURIHashKey(aOther) { MOZ_ASSERT_UNREACHABLE("Do not call me!"); } diff --git a/toolkit/components/resistfingerprinting/nsRFPService.h b/toolkit/components/resistfingerprinting/nsRFPService.h index c85caac6b754..ca5d89c81461 100644 --- a/toolkit/components/resistfingerprinting/nsRFPService.h +++ b/toolkit/components/resistfingerprinting/nsRFPService.h @@ -108,12 +108,11 @@ public: , mKey(aOther->mKey) {} - KeyboardHashKey(KeyboardHashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mLang(std::move(aOther.mLang)) - , mRegion(std::move(aOther.mRegion)) - , mKeyIdx(std::move(aOther.mKeyIdx)) - , mKey(std::move(aOther.mKey)) + KeyboardHashKey(KeyType aOther) + : mLang(aOther.mLang) + , mRegion(aOther.mRegion) + , mKeyIdx(aOther.mKeyIdx) + , mKey(aOther.mKey) {} ~KeyboardHashKey() diff --git a/xpcom/ds/PLDHashTable.h b/xpcom/ds/PLDHashTable.h index a10ea77aab14..63bfadecff94 100644 --- a/xpcom/ds/PLDHashTable.h +++ b/xpcom/ds/PLDHashTable.h @@ -38,13 +38,6 @@ struct PLDHashTableOps; // -- users need never access it. struct PLDHashEntryHdr { - PLDHashEntryHdr() = default; - PLDHashEntryHdr(const PLDHashEntryHdr&) = delete; - PLDHashEntryHdr(const PLDHashEntryHdr&&) = delete; - PLDHashEntryHdr& operator=(const PLDHashEntryHdr&) = delete; - PLDHashEntryHdr(PLDHashEntryHdr&&) = default; - PLDHashEntryHdr& operator=(PLDHashEntryHdr&&) = default; - private: friend class PLDHashTable; diff --git a/xpcom/ds/nsHashKeys.h b/xpcom/ds/nsHashKeys.h index 49f65d1cb0eb..795d8bda1303 100644 --- a/xpcom/ds/nsHashKeys.h +++ b/xpcom/ds/nsHashKeys.h @@ -24,9 +24,8 @@ #include #include -#include - #include "mozilla/HashFunctions.h" +#include "mozilla/Move.h" namespace mozilla { @@ -82,11 +81,7 @@ public: typedef const nsAString* KeyTypePointer; explicit nsStringHashKey(KeyTypePointer aStr) : mStr(*aStr) {} - nsStringHashKey(const nsStringHashKey&) = delete; - nsStringHashKey(nsStringHashKey&& aToMove) - : PLDHashEntryHdr(std::move(aToMove)) - , mStr(std::move(aToMove.mStr)) - {} + nsStringHashKey(const nsStringHashKey& aToCopy) : mStr(aToCopy.mStr) {} ~nsStringHashKey() {} KeyType GetKey() const { return mStr; } @@ -112,7 +107,7 @@ public: enum { ALLOW_MEMMOVE = true }; private: - nsString mStr; + const nsString mStr; }; #ifdef MOZILLA_INTERNAL_API @@ -136,11 +131,8 @@ public: { // take it easy just deal HashKey } - - nsStringCaseInsensitiveHashKey(const nsStringCaseInsensitiveHashKey&) = delete; - nsStringCaseInsensitiveHashKey(nsStringCaseInsensitiveHashKey&& aToMove) - : PLDHashEntryHdr(std::move(aToMove)) - , mStr(std::move(aToMove.mStr)) + nsStringCaseInsensitiveHashKey(const nsStringCaseInsensitiveHashKey& aToCopy) + : mStr(aToCopy.mStr) { } ~nsStringCaseInsensitiveHashKey() {} @@ -184,10 +176,7 @@ public: typedef const nsACString* KeyTypePointer; explicit nsCStringHashKey(const nsACString* aStr) : mStr(*aStr) {} - nsCStringHashKey(nsCStringHashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mStr(std::move(aOther.mStr)) - {} + nsCStringHashKey(const nsCStringHashKey& aToCopy) : mStr(aToCopy.mStr) {} ~nsCStringHashKey() {} KeyType GetKey() const { return mStr; } @@ -225,10 +214,7 @@ public: typedef const uint32_t* KeyTypePointer; explicit nsUint32HashKey(KeyTypePointer aKey) : mValue(*aKey) {} - nsUint32HashKey(nsUint32HashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mValue(std::move(aOther.mValue)) - {} + nsUint32HashKey(const nsUint32HashKey& aToCopy) : mValue(aToCopy.mValue) {} ~nsUint32HashKey() {} KeyType GetKey() const { return mValue; } @@ -254,10 +240,7 @@ public: typedef const uint64_t* KeyTypePointer; explicit nsUint64HashKey(KeyTypePointer aKey) : mValue(*aKey) {} - nsUint64HashKey(nsUint64HashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mValue(std::move(aOther.mValue)) - {} + nsUint64HashKey(const nsUint64HashKey& aToCopy) : mValue(aToCopy.mValue) {} ~nsUint64HashKey() {} KeyType GetKey() const { return mValue; } @@ -286,10 +269,7 @@ public: typedef const float* KeyTypePointer; explicit nsFloatHashKey(KeyTypePointer aKey) : mValue(*aKey) {} - nsFloatHashKey(nsFloatHashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mValue(std::move(aOther.mValue)) - {} + nsFloatHashKey(const nsFloatHashKey& aToCopy) : mValue(aToCopy.mValue) {} ~nsFloatHashKey() {} KeyType GetKey() const { return mValue; } @@ -318,9 +298,7 @@ public: typedef const intptr_t* KeyTypePointer; explicit IntPtrHashKey(KeyTypePointer aKey) : mValue(*aKey) {} - IntPtrHashKey(IntPtrHashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mValue(aOther.mValue) {} + IntPtrHashKey(const IntPtrHashKey& aToCopy) : mValue(aToCopy.mValue) {} ~IntPtrHashKey() {} KeyType GetKey() const { return mValue; } @@ -352,9 +330,8 @@ public: : mSupports(const_cast(aKey)) { } - nsISupportsHashKey(nsISupportsHashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mSupports(std::move(aOther.mSupports)) + nsISupportsHashKey(const nsISupportsHashKey& aToCopy) + : mSupports(aToCopy.mSupports) { } ~nsISupportsHashKey() {} @@ -386,10 +363,7 @@ public: typedef const T* KeyTypePointer; explicit nsRefPtrHashKey(const T* aKey) : mKey(const_cast(aKey)) {} - nsRefPtrHashKey(nsRefPtrHashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mKey(std::move(aOther.mKey)) - {} + nsRefPtrHashKey(const nsRefPtrHashKey& aToCopy) : mKey(aToCopy.mKey) {} ~nsRefPtrHashKey() {} KeyType GetKey() const { return mKey; } @@ -429,8 +403,8 @@ class nsClearingPtrHashKey : public nsPtrHashKey { public: explicit nsClearingPtrHashKey(const T* aKey) : nsPtrHashKey(aKey) {} - nsClearingPtrHashKey(nsClearingPtrHashKey&& aToMove) - : nsPtrHashKey(std::move(aToMove)) + nsClearingPtrHashKey(const nsClearingPtrHashKey& aToCopy) + : nsPtrHashKey(aToCopy) { } ~nsClearingPtrHashKey() { nsPtrHashKey::mKey = nullptr; } @@ -480,10 +454,7 @@ public: typedef const nsID* KeyTypePointer; explicit nsIDHashKey(const nsID* aInID) : mID(*aInID) {} - nsIDHashKey(nsIDHashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mID(std::move(aOther.mID)) - {} + nsIDHashKey(const nsIDHashKey& aToCopy) : mID(aToCopy.mID) {} ~nsIDHashKey() {} KeyType GetKey() const { return mID; } @@ -499,7 +470,7 @@ public: enum { ALLOW_MEMMOVE = true }; private: - nsID mID; + const nsID mID; }; /** @@ -514,9 +485,7 @@ public: typedef const nsID* KeyTypePointer; explicit nsIDPointerHashKey(const nsID* aInID) : mID(aInID) {} - nsIDPointerHashKey(nsIDPointerHashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mID(aOther.mID) {} + nsIDPointerHashKey(const nsIDPointerHashKey& aToCopy) : mID(aToCopy.mID) {} ~nsIDPointerHashKey() = default; KeyType GetKey() const { return mID; } @@ -552,10 +521,7 @@ public: typedef const char* KeyTypePointer; explicit nsDepCharHashKey(const char* aKey) : mKey(aKey) {} - nsDepCharHashKey(nsDepCharHashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mKey(std::move(aOther.mKey)) - {} + nsDepCharHashKey(const nsDepCharHashKey& aToCopy) : mKey(aToCopy.mKey) {} ~nsDepCharHashKey() {} const char* GetKey() const { return mKey; } @@ -584,8 +550,11 @@ public: typedef const char* KeyTypePointer; explicit nsCharPtrHashKey(const char* aKey) : mKey(strdup(aKey)) {} + nsCharPtrHashKey(const nsCharPtrHashKey& aToCopy) + : mKey(strdup(aToCopy.mKey)) + { + } - nsCharPtrHashKey(const nsCharPtrHashKey&) = delete; nsCharPtrHashKey(nsCharPtrHashKey&& aOther) : mKey(aOther.mKey) { @@ -631,8 +600,11 @@ public: typedef const char16_t* KeyTypePointer; explicit nsUnicharPtrHashKey(const char16_t* aKey) : mKey(NS_strdup(aKey)) {} + nsUnicharPtrHashKey(const nsUnicharPtrHashKey& aToCopy) + : mKey(NS_strdup(aToCopy.mKey)) + { + } - nsUnicharPtrHashKey(const nsUnicharPtrHashKey& aToCopy) = delete; nsUnicharPtrHashKey(nsUnicharPtrHashKey&& aOther) : mKey(aOther.mKey) { @@ -679,10 +651,7 @@ public: : mKey(const_cast(aKey)) { } - nsHashableHashKey(nsHashableHashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mKey(std::move(aOther.mKey)) - {} + nsHashableHashKey(const nsHashableHashKey& aToCopy) : mKey(aToCopy.mKey) {} ~nsHashableHashKey() {} nsIHashable* GetKey() const { return mKey; } @@ -737,10 +706,7 @@ public: typedef const T* KeyTypePointer; explicit nsGenericHashKey(KeyTypePointer aKey) : mKey(*aKey) {} - nsGenericHashKey(const nsGenericHashKey&) = delete; - nsGenericHashKey(nsGenericHashKey&& aOther) - : PLDHashEntryHdr(std::move(aOther)) - , mKey(std::move(aOther.mKey)) {} + nsGenericHashKey(const nsGenericHashKey& aOther) : mKey(aOther.mKey) {} KeyType GetKey() const { return mKey; } bool KeyEquals(KeyTypePointer aKey) const { return *aKey == mKey; } diff --git a/xpcom/ds/nsObserverList.h b/xpcom/ds/nsObserverList.h index 286b60b35c3f..90a685ea60d8 100644 --- a/xpcom/ds/nsObserverList.h +++ b/xpcom/ds/nsObserverList.h @@ -51,12 +51,6 @@ public: MOZ_COUNT_CTOR(nsObserverList); } - nsObserverList(nsObserverList&& aOther) - : nsCharPtrHashKey(std::move(aOther)) - , mObservers(std::move(aOther.mObservers)) - { - } - ~nsObserverList() { MOZ_COUNT_DTOR(nsObserverList); diff --git a/xpcom/ds/nsPointerHashKeys.h b/xpcom/ds/nsPointerHashKeys.h index 88e35116e4f2..1d3f2d3d695d 100644 --- a/xpcom/ds/nsPointerHashKeys.h +++ b/xpcom/ds/nsPointerHashKeys.h @@ -27,10 +27,7 @@ public: typedef const T* KeyTypePointer; explicit nsPtrHashKey(const T* aKey) : mKey(const_cast(aKey)) {} - nsPtrHashKey(nsPtrHashKey&& aToMove) - : PLDHashEntryHdr(std::move(aToMove)) - , mKey(std::move(aToMove.mKey)) - {} + nsPtrHashKey(const nsPtrHashKey& aToCopy) : mKey(aToCopy.mKey) {} ~nsPtrHashKey() {} KeyType GetKey() const { return mKey; }