| 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/dns/dns_reloader.h" | 5 #include "net/dns/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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 tls_index_.Initialize(SlotReturnFunction); | 85 tls_index_.Initialize(SlotReturnFunction); |
| 86 NetworkChangeNotifier::AddDNSObserver(this); | 86 NetworkChangeNotifier::AddDNSObserver(this); |
| 87 } | 87 } |
| 88 | 88 |
| 89 ~DnsReloader() override { | 89 ~DnsReloader() override { |
| 90 NOTREACHED(); // LeakyLazyInstance is not destructed. | 90 NOTREACHED(); // LeakyLazyInstance is not destructed. |
| 91 } | 91 } |
| 92 | 92 |
| 93 base::Lock lock_; // Protects resolver_generation_. | 93 base::Lock lock_; // Protects resolver_generation_. |
| 94 int resolver_generation_; | 94 int resolver_generation_; |
| 95 friend struct base::DefaultLazyInstanceTraits<DnsReloader>; | 95 friend struct base::LazyInstanceTraitsBase<DnsReloader>; |
| 96 | 96 |
| 97 // We use thread local storage to identify which ReloadState to interact with. | 97 // We use thread local storage to identify which ReloadState to interact with. |
| 98 static base::ThreadLocalStorage::StaticSlot tls_index_; | 98 static base::ThreadLocalStorage::StaticSlot tls_index_; |
| 99 | 99 |
| 100 DISALLOW_COPY_AND_ASSIGN(DnsReloader); | 100 DISALLOW_COPY_AND_ASSIGN(DnsReloader); |
| 101 }; | 101 }; |
| 102 | 102 |
| 103 // A TLS slot to the ReloadState for the current thread. | 103 // A TLS slot to the ReloadState for the current thread. |
| 104 // static | 104 // static |
| 105 base::ThreadLocalStorage::StaticSlot DnsReloader::tls_index_ = TLS_INITIALIZER; | 105 base::ThreadLocalStorage::StaticSlot DnsReloader::tls_index_ = TLS_INITIALIZER; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 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 |