зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1688833 - Migrate LookupForAdd to WithEntryHandle in dom/broadcastchannel. r=baku
Differential Revision: https://phabricator.services.mozilla.com/D104230
This commit is contained in:
Родитель
8ae4e0da81
Коммит
2a318a3a15
|
@ -81,9 +81,13 @@ void BroadcastChannelService::RegisterActor(
|
|||
AssertIsOnBackgroundThread();
|
||||
MOZ_ASSERT(aParent);
|
||||
|
||||
const auto& parents = mAgents.LookupForAdd(aOriginChannelKey).OrInsert([]() {
|
||||
return new nsTArray<BroadcastChannelParent*>();
|
||||
});
|
||||
auto* const parents =
|
||||
mAgents.WithEntryHandle(aOriginChannelKey, [](auto&& entry) {
|
||||
return entry
|
||||
.OrInsertWith(
|
||||
[] { return new nsTArray<BroadcastChannelParent*>(); })
|
||||
.get();
|
||||
});
|
||||
|
||||
MOZ_ASSERT(!parents->Contains(aParent));
|
||||
parents->AppendElement(aParent);
|
||||
|
|
Загрузка…
Ссылка в новой задаче