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

Side by Side Diff: net/dns/host_cache.h

Issue 2910473005: Deprecate NonThreadSafe in net/ in favor of SequenceChecker/ThreadChecker. (Closed)
Patch Set: rebase on r476634 Created 3 years, 6 months 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
« no previous file with comments | « net/dns/dns_transaction.cc ('k') | net/dns/host_cache.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) 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 #ifndef NET_DNS_HOST_CACHE_H_ 5 #ifndef NET_DNS_HOST_CACHE_H_
6 #define NET_DNS_HOST_CACHE_H_ 6 #define NET_DNS_HOST_CACHE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include <functional> 10 #include <functional>
11 #include <map> 11 #include <map>
12 #include <memory> 12 #include <memory>
13 #include <string> 13 #include <string>
14 #include <tuple> 14 #include <tuple>
15 15
16 #include "base/gtest_prod_util.h" 16 #include "base/gtest_prod_util.h"
17 #include "base/macros.h" 17 #include "base/macros.h"
18 #include "base/threading/non_thread_safe.h" 18 #include "base/threading/thread_checker.h"
19 #include "base/time/time.h" 19 #include "base/time/time.h"
20 #include "net/base/address_family.h" 20 #include "net/base/address_family.h"
21 #include "net/base/address_list.h" 21 #include "net/base/address_list.h"
22 #include "net/base/expiring_cache.h" 22 #include "net/base/expiring_cache.h"
23 #include "net/base/net_export.h" 23 #include "net/base/net_export.h"
24 #include "net/dns/dns_util.h" 24 #include "net/dns/dns_util.h"
25 25
26 namespace base { 26 namespace base {
27 class ListValue; 27 class ListValue;
28 } 28 }
29 29
30 namespace net { 30 namespace net {
31 31
32 // Cache used by HostResolver to map hostnames to their resolved result. 32 // Cache used by HostResolver to map hostnames to their resolved result.
33 class NET_EXPORT HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) { 33 class NET_EXPORT HostCache {
34 public: 34 public:
35 struct Key { 35 struct Key {
36 Key(const std::string& hostname, AddressFamily address_family, 36 Key(const std::string& hostname, AddressFamily address_family,
37 HostResolverFlags host_resolver_flags) 37 HostResolverFlags host_resolver_flags)
38 : hostname(hostname), 38 : hostname(hostname),
39 address_family(address_family), 39 address_family(address_family),
40 host_resolver_flags(host_resolver_flags) {} 40 host_resolver_flags(host_resolver_flags) {}
41 41
42 bool operator<(const Key& other) const { 42 bool operator<(const Key& other) const {
43 // The order of comparisons of |Key| fields is arbitrary, thus 43 // The order of comparisons of |Key| fields is arbitrary, thus
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
212 // Helper to insert an Entry into the cache. 212 // Helper to insert an Entry into the cache.
213 void AddEntry(const Key& key, const Entry& entry); 213 void AddEntry(const Key& key, const Entry& entry);
214 214
215 // Map from hostname (presumably in lowercase canonicalized format) to 215 // Map from hostname (presumably in lowercase canonicalized format) to
216 // a resolved result entry. 216 // a resolved result entry.
217 EntryMap entries_; 217 EntryMap entries_;
218 size_t max_entries_; 218 size_t max_entries_;
219 int network_changes_; 219 int network_changes_;
220 EvictionCallback eviction_callback_; 220 EvictionCallback eviction_callback_;
221 221
222 THREAD_CHECKER(thread_checker_);
223
222 DISALLOW_COPY_AND_ASSIGN(HostCache); 224 DISALLOW_COPY_AND_ASSIGN(HostCache);
223 }; 225 };
224 226
225 } // namespace net 227 } // namespace net
226 228
227 #endif // NET_DNS_HOST_CACHE_H_ 229 #endif // NET_DNS_HOST_CACHE_H_
OLDNEW
« no previous file with comments | « net/dns/dns_transaction.cc ('k') | net/dns/host_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698