OLD | NEW |
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 !defined(OS_ANDROID) | 8 !defined(OS_ANDROID) |
9 | 9 |
10 #include <resolv.h> | 10 #include <resolv.h> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 static base::ThreadLocalStorage::Slot tls_index_ ; | 96 static base::ThreadLocalStorage::Slot tls_index_ ; |
97 | 97 |
98 DISALLOW_COPY_AND_ASSIGN(DnsReloader); | 98 DISALLOW_COPY_AND_ASSIGN(DnsReloader); |
99 }; | 99 }; |
100 | 100 |
101 // A TLS slot to the ReloadState for the current thread. | 101 // A TLS slot to the ReloadState for the current thread. |
102 // static | 102 // static |
103 base::ThreadLocalStorage::Slot DnsReloader::tls_index_( | 103 base::ThreadLocalStorage::Slot DnsReloader::tls_index_( |
104 base::LINKER_INITIALIZED); | 104 base::LINKER_INITIALIZED); |
105 | 105 |
106 base::LazyInstance<DnsReloader, | 106 base::LazyInstance<DnsReloader>::Leaky |
107 base::LeakyLazyInstanceTraits<DnsReloader> > | |
108 g_dns_reloader = LAZY_INSTANCE_INITIALIZER; | 107 g_dns_reloader = LAZY_INSTANCE_INITIALIZER; |
109 | 108 |
110 } // namespace | 109 } // namespace |
111 | 110 |
112 namespace net { | 111 namespace net { |
113 | 112 |
114 void EnsureDnsReloaderInit() { | 113 void EnsureDnsReloaderInit() { |
115 DnsReloader* t ALLOW_UNUSED = g_dns_reloader.Pointer(); | 114 DnsReloader* t ALLOW_UNUSED = g_dns_reloader.Pointer(); |
116 } | 115 } |
117 | 116 |
118 void DnsReloaderMaybeReload() { | 117 void DnsReloaderMaybeReload() { |
119 // This routine can be called by any of the DNS worker threads. | 118 // This routine can be called by any of the DNS worker threads. |
120 DnsReloader* dns_reloader = g_dns_reloader.Pointer(); | 119 DnsReloader* dns_reloader = g_dns_reloader.Pointer(); |
121 dns_reloader->MaybeReload(); | 120 dns_reloader->MaybeReload(); |
122 } | 121 } |
123 | 122 |
124 } // namespace net | 123 } // namespace net |
125 | 124 |
126 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && | 125 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && |
127 // !defined(OS_ANDROID) | 126 // !defined(OS_ANDROID) |
OLD | NEW |