Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1166)

Unified Diff: content/browser/notification_service_impl.cc

Issue 10546025: Delete empty NotificationObserverLists. Fixes leak. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: CR feedback: removed unnecessary = NULL. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/notification_service_impl.cc
diff --git a/content/browser/notification_service_impl.cc b/content/browser/notification_service_impl.cc
index 327e28fba5df2a221043966238832576ccb0d4d2..2c6fa06636517bc11fd2f40e4ebd7483d47db2aa 100644
--- a/content/browser/notification_service_impl.cc
+++ b/content/browser/notification_service_impl.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -79,12 +79,14 @@ void NotificationServiceImpl::RemoveObserver(
observers_[type][source.map_key()];
if (observer_list) {
observer_list->RemoveObserver(observer);
+ if (!observer_list->size()) {
+ observers_[type].erase(source.map_key());
+ delete observer_list;
+ }
#ifndef NDEBUG
--observer_counts_[type];
#endif
}
-
- // TODO(jhughes): Remove observer list from map if empty?
}
void NotificationServiceImpl::Notify(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698