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

Side by Side Diff: net/base/dns_reloader.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
« no previous file with comments | « net/base/cert_database_nss_unittest.cc ('k') | net/base/ev_root_ca_metadata.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "net/base/dns_reloader.h" 5 #include "net/base/dns_reloader.h"
6 6
7 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) 7 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
8 8
9 #include <resolv.h> 9 #include <resolv.h>
10 10
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 DISALLOW_COPY_AND_ASSIGN(DnsReloader); 94 DISALLOW_COPY_AND_ASSIGN(DnsReloader);
95 }; 95 };
96 96
97 // A TLS slot to the ReloadState for the current thread. 97 // A TLS slot to the ReloadState for the current thread.
98 // static 98 // static
99 base::ThreadLocalStorage::Slot DnsReloader::tls_index_( 99 base::ThreadLocalStorage::Slot DnsReloader::tls_index_(
100 base::LINKER_INITIALIZED); 100 base::LINKER_INITIALIZED);
101 101
102 base::LazyInstance<DnsReloader, 102 base::LazyInstance<DnsReloader,
103 base::LeakyLazyInstanceTraits<DnsReloader> > 103 base::LeakyLazyInstanceTraits<DnsReloader> >
104 g_dns_reloader(base::LINKER_INITIALIZED); 104 g_dns_reloader = LAZY_INSTANCE_INITIALIZER;
105 105
106 } // namespace 106 } // namespace
107 107
108 namespace net { 108 namespace net {
109 109
110 void EnsureDnsReloaderInit() { 110 void EnsureDnsReloaderInit() {
111 DnsReloader* t ALLOW_UNUSED = g_dns_reloader.Pointer(); 111 DnsReloader* t ALLOW_UNUSED = g_dns_reloader.Pointer();
112 } 112 }
113 113
114 void DnsReloaderMaybeReload() { 114 void DnsReloaderMaybeReload() {
115 // This routine can be called by any of the DNS worker threads. 115 // This routine can be called by any of the DNS worker threads.
116 DnsReloader* dns_reloader = g_dns_reloader.Pointer(); 116 DnsReloader* dns_reloader = g_dns_reloader.Pointer();
117 dns_reloader->MaybeReload(); 117 dns_reloader->MaybeReload();
118 } 118 }
119 119
120 } // namespace net 120 } // namespace net
121 121
122 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) 122 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD)
OLDNEW
« no previous file with comments | « net/base/cert_database_nss_unittest.cc ('k') | net/base/ev_root_ca_metadata.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698