OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/browser/notification_service_impl.h" | 5 #include "content/browser/notification_service_impl.h" |
6 | 6 |
7 #include "base/lazy_instance.h" | 7 #include "base/lazy_instance.h" |
8 #include "base/threading/thread_local.h" | 8 #include "base/threading/thread_local.h" |
9 #include "content/public/browser/notification_observer.h" | 9 #include "content/public/browser/notification_observer.h" |
10 #include "content/public/browser/notification_types.h" | 10 #include "content/public/browser/notification_types.h" |
11 | 11 |
12 namespace content { | 12 namespace content { |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 base::LazyInstance<base::ThreadLocalPointer<NotificationServiceImpl> > | 16 base::LazyInstance<base::ThreadLocalPointer<NotificationServiceImpl>>:: |
17 lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER; | 17 DestructorAtExit lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER; |
18 | 18 |
19 } // namespace | 19 } // namespace |
20 | 20 |
21 // static | 21 // static |
22 NotificationServiceImpl* NotificationServiceImpl::current() { | 22 NotificationServiceImpl* NotificationServiceImpl::current() { |
23 return lazy_tls_ptr.Pointer()->Get(); | 23 return lazy_tls_ptr.Pointer()->Get(); |
24 } | 24 } |
25 | 25 |
26 // static | 26 // static |
27 NotificationService* NotificationService::current() { | 27 NotificationService* NotificationService::current() { |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 | 146 |
147 for (int i = 0; i < static_cast<int>(observers_.size()); i++) { | 147 for (int i = 0; i < static_cast<int>(observers_.size()); i++) { |
148 NotificationSourceMap omap = observers_[i]; | 148 NotificationSourceMap omap = observers_[i]; |
149 for (NotificationSourceMap::iterator it = omap.begin(); | 149 for (NotificationSourceMap::iterator it = omap.begin(); |
150 it != omap.end(); ++it) | 150 it != omap.end(); ++it) |
151 delete it->second; | 151 delete it->second; |
152 } | 152 } |
153 } | 153 } |
154 | 154 |
155 } // namespace content | 155 } // namespace content |
OLD | NEW |