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( |