Bug 1187115 - Replace nsBaseHashtable::EnumerateRead() calls in dom/{bluetooth,messagechannel}/ with iterators. r=khuey.

--HG--
extra : rebase_source : 1c02cc79902eff27686904e8fa139175756446de
This commit is contained in:
Nicholas Nethercote 2015-11-18 19:38:55 -08:00
Родитель 8edfb62b0c
Коммит d137133367
2 изменённых файлов: 8 добавлений и 23 удалений

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

@ -2281,7 +2281,9 @@ public:
} }
// unref stored DBusMessages before clearing the hashtable // unref stored DBusMessages before clearing the hashtable
sPairingReqTable->EnumerateRead(UnrefDBusMessage, nullptr); for (auto iter = sPairingReqTable->Iter(); !iter.Done(); iter.Next()) {
dbus_message_unref(iter.UserData());
}
sPairingReqTable->Clear(); sPairingReqTable->Clear();
sIsPairing = 0; sIsPairing = 0;
@ -2299,14 +2301,6 @@ public:
BT_WARNING("Failed to dispatch to BT thread!"); BT_WARNING("Failed to dispatch to BT thread!");
} }
} }
private:
static PLDHashOperator
UnrefDBusMessage(const BluetoothAddress& key, DBusMessage* value, void* arg)
{
dbus_message_unref(value);
return PL_DHASH_NEXT;
}
}; };
class StopBluetoothRunnable final : public nsRunnable class StopBluetoothRunnable final : public nsRunnable

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

@ -1,4 +1,5 @@
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public /* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this * License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
@ -263,18 +264,6 @@ MessagePortService::ClosePort(MessagePortParent* aParent)
return true; return true;
} }
#ifdef DEBUG
PLDHashOperator
MessagePortService::CloseAllDebugCheck(const nsID& aID,
MessagePortServiceData* aData,
void* aPtr)
{
nsID* id = static_cast<nsID*>(aPtr);
MOZ_ASSERT(!id->Equals(aID));
return PL_DHASH_NEXT;
}
#endif
void void
MessagePortService::CloseAll(const nsID& aUUID, bool aForced) MessagePortService::CloseAll(const nsID& aUUID, bool aForced)
{ {
@ -319,7 +308,9 @@ MessagePortService::CloseAll(const nsID& aUUID, bool aForced)
} }
#ifdef DEBUG #ifdef DEBUG
mPorts.EnumerateRead(CloseAllDebugCheck, const_cast<nsID*>(&aUUID)); for (auto iter = mPorts.Iter(); !iter.Done(); iter.Next()) {
MOZ_ASSERT(!aUUID.Equals(iter.Key()));
}
#endif #endif
MaybeShutdown(); MaybeShutdown();