author | Mats Palmgren <mats@mozilla.com> |
Tue, 13 Jan 2015 14:44:33 +0000 | |
changeset 223589 | 62bd58692f27a679873b43902b132c381dd7df5b |
parent 223588 | 324793f2a92b4b103ab22bbfb2e1ad15460a5637 |
child 223590 | 984560bfd1574a75b3c36ce44c588428091e28ce |
push id | 28098 |
push user | kwierso@gmail.com |
push date | Wed, 14 Jan 2015 00:52:19 +0000 |
treeherder | mozilla-central@e978b8bc5c45 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | nfroyd |
bugs | 1120198 |
milestone | 38.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/glue/nsTHashtable.h +++ b/xpcom/glue/nsTHashtable.h @@ -5,16 +5,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef nsTHashtable_h__ #define nsTHashtable_h__ #include "nscore.h" #include "pldhash.h" #include "nsDebug.h" +#include "mozilla/Assertions.h" #include "mozilla/MemoryChecking.h" #include "mozilla/MemoryReporting.h" #include "mozilla/Move.h" #include "mozilla/fallible.h" #include "mozilla/PodOperations.h" #include <new> @@ -284,16 +285,26 @@ public: * If the EntryType defines SizeOfExcludingThis, there's no need to define a new * SizeOfEntryExcludingThisFun. */ size_t SizeOfIncludingThis(mozilla::MallocSizeOf aMallocSizeOf) const { return SizeOfIncludingThis(BasicSizeOfEntryExcludingThisFun, aMallocSizeOf); } + /** + * Swap the elements in this hashtable with the elements in aOther. + */ + void SwapElements(nsTHashtable<EntryType>& aOther) + { + MOZ_ASSERT_IF(this->mTable.ops && aOther.mTable.ops, + this->mTable.ops == aOther.mTable.ops); + mozilla::Swap(this->mTable, aOther.mTable); + } + #ifdef DEBUG /** * Mark the table as constant after initialization. * * This will prevent assertions when a read-only hash is accessed on multiple * threads without synchronization. */ void MarkImmutable()