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 "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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 // We use thread local storage to identify which ReloadState to interact with. | 95 // We use thread local storage to identify which ReloadState to interact with. |
96 static base::ThreadLocalStorage::StaticSlot tls_index_; | 96 static base::ThreadLocalStorage::StaticSlot 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::StaticSlot DnsReloader::tls_index_ = TLS_INITIALIZER; | 103 base::ThreadLocalStorage::StaticSlot DnsReloader::tls_index_ = TLS_INITIALIZER; |
104 | 104 |
105 base::LazyInstance<DnsReloader>::Leaky | 105 base::LazyInstance<DnsReloader>::Leaky g_dns_reloader = |
106 g_dns_reloader = LAZY_INSTANCE_INITIALIZER; | 106 LAZY_INSTANCE_INITIALIZER; |
107 | 107 |
108 } // namespace | 108 } // namespace |
109 | 109 |
110 namespace net { | 110 namespace net { |
111 | 111 |
112 void EnsureDnsReloaderInit() { | 112 void EnsureDnsReloaderInit() { |
113 DnsReloader* t ALLOW_UNUSED = g_dns_reloader.Pointer(); | 113 DnsReloader* t ALLOW_UNUSED = g_dns_reloader.Pointer(); |
114 } | 114 } |
115 | 115 |
116 void DnsReloaderMaybeReload() { | 116 void DnsReloaderMaybeReload() { |
117 // This routine can be called by any of the DNS worker threads. | 117 // This routine can be called by any of the DNS worker threads. |
118 DnsReloader* dns_reloader = g_dns_reloader.Pointer(); | 118 DnsReloader* dns_reloader = g_dns_reloader.Pointer(); |
119 dns_reloader->MaybeReload(); | 119 dns_reloader->MaybeReload(); |
120 } | 120 } |
121 | 121 |
122 } // namespace net | 122 } // namespace net |
123 | 123 |
124 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && | 124 #endif // defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_OPENBSD) && |
125 // !defined(OS_ANDROID) | 125 // !defined(OS_ANDROID) |
OLD | NEW |