Chromium Code Reviews| 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..a23fc241a3df5950dbab4614736c8aa5d6f5db89 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,15 @@ 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; |
| + observer_list = NULL; |
|
jam
2012/06/06 16:48:05
nit: unnecessary
lengG
2012/06/07 14:08:51
Done.
|
| + } |
| #ifndef NDEBUG |
| --observer_counts_[type]; |
| #endif |
| } |
| - |
| - // TODO(jhughes): Remove observer list from map if empty? |
| } |
| void NotificationServiceImpl::Notify( |