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 #ifndef NET_BASE_HOST_CACHE_H_ | 5 #ifndef NET_BASE_HOST_CACHE_H_ |
6 #define NET_BASE_HOST_CACHE_H_ | 6 #define NET_BASE_HOST_CACHE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/threading/non_thread_safe.h" | 14 #include "base/threading/non_thread_safe.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "net/base/address_family.h" | 16 #include "net/base/address_family.h" |
17 #include "net/base/address_list.h" | 17 #include "net/base/address_list.h" |
| 18 #include "net/base/net_api.h" |
18 | 19 |
19 namespace net { | 20 namespace net { |
20 | 21 |
21 // Cache used by HostResolver to map hostnames to their resolved result. | 22 // Cache used by HostResolver to map hostnames to their resolved result. |
22 class HostCache : public base::NonThreadSafe { | 23 class NET_API HostCache : NON_EXPORTED_BASE(public base::NonThreadSafe) { |
23 public: | 24 public: |
24 // Stores the latest address list that was looked up for a hostname. | 25 // Stores the latest address list that was looked up for a hostname. |
25 struct Entry : public base::RefCounted<Entry> { | 26 struct Entry : public base::RefCounted<Entry> { |
26 Entry(int error, const AddressList& addrlist, base::TimeTicks expiration); | 27 Entry(int error, const AddressList& addrlist, base::TimeTicks expiration); |
27 | 28 |
28 // The resolve results for this entry. | 29 // The resolve results for this entry. |
29 int error; | 30 int error; |
30 AddressList addrlist; | 31 AddressList addrlist; |
31 | 32 |
32 // The time when this entry expires. | 33 // The time when this entry expires. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // Map from hostname (presumably in lowercase canonicalized format) to | 137 // Map from hostname (presumably in lowercase canonicalized format) to |
137 // a resolved result entry. | 138 // a resolved result entry. |
138 EntryMap entries_; | 139 EntryMap entries_; |
139 | 140 |
140 DISALLOW_COPY_AND_ASSIGN(HostCache); | 141 DISALLOW_COPY_AND_ASSIGN(HostCache); |
141 }; | 142 }; |
142 | 143 |
143 } // namespace net | 144 } // namespace net |
144 | 145 |
145 #endif // NET_BASE_HOST_CACHE_H_ | 146 #endif // NET_BASE_HOST_CACHE_H_ |
OLD | NEW |