mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 1641090, part 6 - Make ReplaceWithID compatible with nsTHashtable's Put. r=nika
This method is the same as Put(), except that it asserts that the item is not already present. It also puts the key second. Make it compatible by hoisting out the assert and reversing the arguments. We can use the definition of Put() defined in an earlier patch. Differential Revision: https://phabricator.services.mozilla.com/D77167
This commit is contained in:
parent
7482de916e
commit
5fdbb56cfb
@ -47,11 +47,6 @@ class IDMap {
|
||||
}
|
||||
}
|
||||
|
||||
void ReplaceWithID(const T& data, int32_t id) {
|
||||
MOZ_ASSERT(Contains(id), "Only replace an existing ID");
|
||||
data_[id] = data;
|
||||
}
|
||||
|
||||
void Clear() { data_.clear(); }
|
||||
|
||||
T Lookup(int32_t id) const {
|
||||
|
@ -867,7 +867,8 @@ void IToplevelProtocol::ReplaceEventTargetForActor(
|
||||
MOZ_RELEASE_ASSERT(id != kNullActorId && id != kFreedActorId);
|
||||
|
||||
MutexAutoLock lock(mEventTargetMutex);
|
||||
mEventTargetMap.ReplaceWithID(aEventTarget, id);
|
||||
MOZ_ASSERT(mEventTargetMap.Contains(id), "Only replace an existing ID");
|
||||
mEventTargetMap.Put(id, aEventTarget);
|
||||
}
|
||||
|
||||
} // namespace ipc
|
||||
|
Loading…
Reference in New Issue
Block a user