| OLD | NEW | 
|---|
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #include "chrome/common/notification_service.h" | 5 #include "chrome/common/notification_service.h" | 
| 6 | 6 | 
| 7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" | 
| 8 #include "base/thread_local.h" | 8 #include "base/thread_local.h" | 
| 9 #include "chrome/common/notification_observer.h" | 9 #include "chrome/common/notification_observer.h" | 
| 10 | 10 | 
| 11 static base::LazyInstance<base::ThreadLocalPointer<NotificationService> > | 11 static base::LazyInstance<base::ThreadLocalPointer<NotificationService> > | 
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 125 | 125 | 
| 126 | 126 | 
| 127 NotificationService::~NotificationService() { | 127 NotificationService::~NotificationService() { | 
| 128   lazy_tls_ptr.Pointer()->Set(NULL); | 128   lazy_tls_ptr.Pointer()->Set(NULL); | 
| 129 | 129 | 
| 130 #ifndef NDEBUG | 130 #ifndef NDEBUG | 
| 131   for (int i = 0; i < NotificationType::NOTIFICATION_TYPE_COUNT; i++) { | 131   for (int i = 0; i < NotificationType::NOTIFICATION_TYPE_COUNT; i++) { | 
| 132     if (observer_counts_[i] > 0) { | 132     if (observer_counts_[i] > 0) { | 
| 133       // This may not be completely fixable -- see | 133       // This may not be completely fixable -- see | 
| 134       // http://code.google.com/p/chromium/issues/detail?id=11010 . | 134       // http://code.google.com/p/chromium/issues/detail?id=11010 . | 
| 135 | 135       VLOG(1) << observer_counts_[i] << " notification observer(s) leaked " | 
| 136       // It would be nice to track new leaks, but this currently | 136                  " of notification type " << i; | 
| 137       // spams the console too much to be useful, making it hard to track |  | 
| 138       // down other problems. |  | 
| 139       // LOG(INFO) << observer_counts_[i] << " notification observer(s) leaked" |  | 
| 140       //    << " of notification type " << i; |  | 
| 141     } | 137     } | 
| 142   } | 138   } | 
| 143 #endif | 139 #endif | 
| 144 | 140 | 
| 145   for (int i = 0; i < NotificationType::NOTIFICATION_TYPE_COUNT; i++) { | 141   for (int i = 0; i < NotificationType::NOTIFICATION_TYPE_COUNT; i++) { | 
| 146     NotificationSourceMap omap = observers_[i]; | 142     NotificationSourceMap omap = observers_[i]; | 
| 147     for (NotificationSourceMap::iterator it = omap.begin(); | 143     for (NotificationSourceMap::iterator it = omap.begin(); | 
| 148          it != omap.end(); ++it) { | 144          it != omap.end(); ++it) | 
| 149       delete it->second; | 145       delete it->second; | 
| 150     } |  | 
| 151   } | 146   } | 
| 152 } | 147 } | 
| 153 | 148 | 
| 154 NotificationObserver::NotificationObserver() {} | 149 NotificationObserver::NotificationObserver() {} | 
| 155 | 150 | 
| 156 NotificationObserver::~NotificationObserver() {} | 151 NotificationObserver::~NotificationObserver() {} | 
| OLD | NEW | 
|---|