| 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 | 8 |
| 9 #include <resolv.h> | 9 #include <resolv.h> |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) |
| OLD | NEW |