зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1372262 - Use LookupForAdd instead of Get+Put to avoid unnecessary hashtable lookups. r=froydnj
MozReview-Commit-ID: 5LmOqXRgo25
This commit is contained in:
Родитель
2c6dbe5497
Коммит
893dffd030
|
@ -14524,18 +14524,15 @@ nsGlobalWindow::GetGroupMessageManager(const nsAString& aGroup,
|
||||||
|
|
||||||
nsGlobalChromeWindow* myself = static_cast<nsGlobalChromeWindow*>(this);
|
nsGlobalChromeWindow* myself = static_cast<nsGlobalChromeWindow*>(this);
|
||||||
nsCOMPtr<nsIMessageBroadcaster> messageManager =
|
nsCOMPtr<nsIMessageBroadcaster> messageManager =
|
||||||
myself->mGroupMessageManagers.Get(aGroup);
|
myself->mGroupMessageManagers.LookupForAdd(aGroup).OrInsert(
|
||||||
|
[this, &aError] () {
|
||||||
if (!messageManager) {
|
nsFrameMessageManager* parent =
|
||||||
nsFrameMessageManager* parent =
|
static_cast<nsFrameMessageManager*>(GetMessageManager(aError));
|
||||||
static_cast<nsFrameMessageManager*>(GetMessageManager(aError));
|
|
||||||
|
|
||||||
messageManager = new nsFrameMessageManager(nullptr,
|
|
||||||
parent,
|
|
||||||
MM_CHROME | MM_BROADCASTER);
|
|
||||||
myself->mGroupMessageManagers.Put(aGroup, messageManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
return new nsFrameMessageManager(nullptr,
|
||||||
|
parent,
|
||||||
|
MM_CHROME | MM_BROADCASTER);
|
||||||
|
});
|
||||||
return messageManager;
|
return messageManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче