OLD | NEW |
1 // Copyright (c) 2010 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 "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 static base::LazyInstance<base::ThreadLocalPointer<NotificationServiceImpl> > | 12 static base::LazyInstance<base::ThreadLocalPointer<NotificationServiceImpl> > |
13 lazy_tls_ptr(base::LINKER_INITIALIZED); | 13 lazy_tls_ptr = LAZY_INSTANCE_INITIALIZER; |
14 | 14 |
15 // static | 15 // static |
16 NotificationServiceImpl* NotificationServiceImpl::current() { | 16 NotificationServiceImpl* NotificationServiceImpl::current() { |
17 return lazy_tls_ptr.Pointer()->Get(); | 17 return lazy_tls_ptr.Pointer()->Get(); |
18 } | 18 } |
19 | 19 |
20 // static | 20 // static |
21 content::NotificationService* content::NotificationService::current() { | 21 content::NotificationService* content::NotificationService::current() { |
22 return NotificationServiceImpl::current(); | 22 return NotificationServiceImpl::current(); |
23 } | 23 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 } | 138 } |
139 #endif | 139 #endif |
140 | 140 |
141 for (int i = 0; i < static_cast<int>(observers_.size()); i++) { | 141 for (int i = 0; i < static_cast<int>(observers_.size()); i++) { |
142 NotificationSourceMap omap = observers_[i]; | 142 NotificationSourceMap omap = observers_[i]; |
143 for (NotificationSourceMap::iterator it = omap.begin(); | 143 for (NotificationSourceMap::iterator it = omap.begin(); |
144 it != omap.end(); ++it) | 144 it != omap.end(); ++it) |
145 delete it->second; | 145 delete it->second; |
146 } | 146 } |
147 } | 147 } |
OLD | NEW |