Bug 1290614, part 7 - Further refactor XPCNativeSetKey::Hash. r=mrbkap

Now we can see what is really happening in Hash: first hash the
interfaces from the base set, if any, then hash the additional
interface, if any.

Note that this function is wrong when mBaseSet is null. This will be
fixed in bug 1290239.

MozReview-Commit-ID: KaxQ57ofO1D

--HG--
extra : rebase_source : 42012878839adb2e36580480abce7d9708288db4
This commit is contained in:
Andrew McCreight 2016-07-31 14:19:31 -07:00
parent bcc1ce175d
commit b9fe49e715

View File

@ -436,19 +436,16 @@ XPCNativeSetKey::Hash() const
{
PLDHashNumber h = 0;
if (!mBaseSet) {
MOZ_ASSERT(mAddition, "bad key");
h ^= HashPointer(mAddition);
} else {
if (mBaseSet) {
XPCNativeInterface** current = mBaseSet->GetInterfaceArray();
uint16_t count = mBaseSet->GetInterfaceCount();
for (uint16_t i = 0; i < count; i++) {
h ^= HashPointer(*(current++));
}
}
if (mAddition) {
h ^= HashPointer(mAddition);
}
if (mAddition) {
h ^= HashPointer(mAddition);
}
return h;