mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 1641090, part 2 - Inline IDMap::HasData. r=nika
It is only used in one place, so get rid of it. Also, iterate in a nicer way. Differential Revision: https://phabricator.services.mozilla.com/D77163
This commit is contained in:
parent
077aa3dc7e
commit
a00f6161a9
@ -66,13 +66,6 @@ class IDMap {
|
||||
|
||||
void Clear() { data_.clear(); }
|
||||
|
||||
bool HasData(const T& data) const {
|
||||
// XXX would like to use <algorithm> here ...
|
||||
for (const_iterator it = begin(); it != end(); ++it)
|
||||
if (data == it->second) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
T Lookup(int32_t id) const {
|
||||
const_iterator i = data_.find(id);
|
||||
if (i == data_.end()) return T();
|
||||
|
@ -715,7 +715,12 @@ Shmem::SharedMemory* IToplevelProtocol::LookupSharedMemory(Shmem::id_t aId) {
|
||||
}
|
||||
|
||||
bool IToplevelProtocol::IsTrackingSharedMemory(Shmem::SharedMemory* segment) {
|
||||
return mShmemMap.HasData(segment);
|
||||
for (const auto& iter : mShmemMap) {
|
||||
if (segment == iter.second) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool IToplevelProtocol::DestroySharedMemory(Shmem& shmem) {
|
||||
@ -741,9 +746,8 @@ bool IToplevelProtocol::DestroySharedMemory(Shmem& shmem) {
|
||||
}
|
||||
|
||||
void IToplevelProtocol::DeallocShmems() {
|
||||
for (IDMap<SharedMemory*>::const_iterator cit = mShmemMap.begin();
|
||||
cit != mShmemMap.end(); ++cit) {
|
||||
Shmem::Dealloc(Shmem::PrivateIPDLCaller(), cit->second);
|
||||
for (const auto& cit : mShmemMap) {
|
||||
Shmem::Dealloc(Shmem::PrivateIPDLCaller(), cit.second);
|
||||
}
|
||||
mShmemMap.Clear();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user