Bug 1452202 - Clean up PLDHashTable move operator. r=froydnj

--HG--
extra : rebase_source : 2fe44e09de738ffa827b8c7fd51162eaa8c53890
This commit is contained in:
Eric Rahm 2018-04-09 11:01:59 -07:00
Родитель f8584a9107
Коммит 098e642086
1 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -224,17 +224,17 @@ PLDHashTable::operator=(PLDHashTable&& aOther)
return *this;
}
// Destruct |this|.
this->~PLDHashTable();
// |mOps| and |mEntrySize| are const so we can't assign them. Instead, we
// require that they are equal. The justification for this is that they're
// |mOps| and |mEntrySize| are required to stay the same, they're
// conceptually part of the type -- indeed, if PLDHashTable was a templated
// type like nsTHashtable, they *would* be part of the type -- so it only
// makes sense to assign in cases where they match.
MOZ_RELEASE_ASSERT(mOps == aOther.mOps);
MOZ_RELEASE_ASSERT(mEntrySize == aOther.mEntrySize);
// Reconstruct |this|.
this->~PLDHashTable();
new (KnownNotNull, this) PLDHashTable(aOther.mOps, aOther.mEntrySize, 0);
// Move non-const pieces over.
mHashShift = Move(aOther.mHashShift);
mEntryCount = Move(aOther.mEntryCount);