зеркало из 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);
|
||||
nsCOMPtr<nsIMessageBroadcaster> messageManager =
|
||||
myself->mGroupMessageManagers.Get(aGroup);
|
||||
|
||||
if (!messageManager) {
|
||||
nsFrameMessageManager* parent =
|
||||
static_cast<nsFrameMessageManager*>(GetMessageManager(aError));
|
||||
|
||||
messageManager = new nsFrameMessageManager(nullptr,
|
||||
parent,
|
||||
MM_CHROME | MM_BROADCASTER);
|
||||
myself->mGroupMessageManagers.Put(aGroup, messageManager);
|
||||
}
|
||||
myself->mGroupMessageManagers.LookupForAdd(aGroup).OrInsert(
|
||||
[this, &aError] () {
|
||||
nsFrameMessageManager* parent =
|
||||
static_cast<nsFrameMessageManager*>(GetMessageManager(aError));
|
||||
|
||||
return new nsFrameMessageManager(nullptr,
|
||||
parent,
|
||||
MM_CHROME | MM_BROADCASTER);
|
||||
});
|
||||
return messageManager;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче