perf: avoid a double-map lookup in NotificationPresenter::RemoveNotification()
(#46356)
perf: avoid a double-map lokup in NotificationPresenter::RemoveNotification() Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
parent
b51d9976d0
commit
a842911215
1 changed files with 2 additions and 7 deletions
|
@ -27,13 +27,8 @@ base::WeakPtr<Notification> NotificationPresenter::CreateNotification(
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationPresenter::RemoveNotification(Notification* notification) {
|
void NotificationPresenter::RemoveNotification(Notification* notification) {
|
||||||
auto it = notifications_.find(notification);
|
if (const auto nh = notifications_.extract(notification))
|
||||||
if (it == notifications_.end()) {
|
delete nh.value();
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
notifications_.erase(notification);
|
|
||||||
delete notification;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void NotificationPresenter::CloseNotificationWithId(
|
void NotificationPresenter::CloseNotificationWithId(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue