mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1120198 part 1 - Introduce nsTHashtable::SwapElements for a fast way to swap the elements of two hashtables. r=nfroyd
This commit is contained in:
parent
bab8720286
commit
68aa3fcdaa
@ -10,6 +10,7 @@
|
||||
#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"
|
||||
@ -289,6 +290,16 @@ public:
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user