perf: avoid a double-map lookup in NotificationPresenter::RemoveNotification() (#46354)

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:
trop[bot] 2025-03-29 08:30:58 -05:00 committed by GitHub
parent b647c8935d
commit 45c78deff8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -27,13 +27,8 @@ base::WeakPtr<Notification> NotificationPresenter::CreateNotification(
}
void NotificationPresenter::RemoveNotification(Notification* notification) {
auto it = notifications_.find(notification);
if (it == notifications_.end()) {
return;
}
notifications_.erase(notification);
delete notification;
if (const auto nh = notifications_.extract(notification))
delete nh.value();
}
void NotificationPresenter::CloseNotificationWithId(