Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: content/browser/notification_service_impl.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: willchan comments + rebase Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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 }
OLDNEW
« no previous file with comments | « content/browser/net/url_request_slow_download_job.cc ('k') | content/browser/renderer_host/image_transport_client.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698