Chromium Code Reviews| 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> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 base::TimeDelta failure_entry_ttl); | 81 base::TimeDelta failure_entry_ttl); |
| 82 | 82 |
| 83 ~HostCache(); | 83 ~HostCache(); |
| 84 | 84 |
| 85 // Returns a pointer to the entry for |key|, which is valid at time | 85 // Returns a pointer to the entry for |key|, which is valid at time |
| 86 // |now|. If there is no such entry, returns NULL. | 86 // |now|. If there is no such entry, returns NULL. |
| 87 const Entry* Lookup(const Key& key, base::TimeTicks now) const; | 87 const Entry* Lookup(const Key& key, base::TimeTicks now) const; |
| 88 | 88 |
| 89 // Overwrites or creates an entry for |key|. Returns the pointer to the | 89 // Overwrites or creates an entry for |key|. Returns the pointer to the |
| 90 // entry, or NULL on failure (fails if caching is disabled). | 90 // entry, or NULL on failure (fails if caching is disabled). |
| 91 // (|error|, |addrlist|) is the value to set, and |now| is the current | 91 // (|error|, |addrlist|) is the value to set, |ttl| is the "time to live", |
|
cbentzel
2012/01/13 01:06:14
How much work would it be to only allow this versi
szym
2012/01/14 16:30:54
(Excluding unittests) There are three calls to Hos
| |
| 92 // timestamp. | 92 // and |now| is the current timestamp. If |ttl| is zero, the default, |
| 93 // |success_entry_ttl| or |failure_entry_ttl| is used. | |
| 93 Entry* Set(const Key& key, | 94 Entry* Set(const Key& key, |
| 94 int error, | 95 int error, |
| 95 const AddressList& addrlist, | 96 const AddressList& addrlist, |
| 97 base::TimeDelta ttl, | |
| 98 base::TimeTicks now); | |
| 99 | |
| 100 // Same as |Set(key, error, addrlist, TimeDelta(), now)|. | |
| 101 Entry* Set(const Key& key, | |
| 102 int error, | |
| 103 const AddressList& addrlist, | |
| 96 base::TimeTicks now); | 104 base::TimeTicks now); |
| 97 | 105 |
| 98 // Empties the cache | 106 // Empties the cache |
| 99 void clear(); | 107 void clear(); |
| 100 | 108 |
| 101 // Returns the number of entries in the cache. | 109 // Returns the number of entries in the cache. |
| 102 size_t size() const; | 110 size_t size() const; |
| 103 | 111 |
| 104 // Following are used by net_internals UI. | 112 // Following are used by net_internals UI. |
| 105 size_t max_entries() const; | 113 size_t max_entries() const; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 // Map from hostname (presumably in lowercase canonicalized format) to | 148 // Map from hostname (presumably in lowercase canonicalized format) to |
| 141 // a resolved result entry. | 149 // a resolved result entry. |
| 142 EntryMap entries_; | 150 EntryMap entries_; |
| 143 | 151 |
| 144 DISALLOW_COPY_AND_ASSIGN(HostCache); | 152 DISALLOW_COPY_AND_ASSIGN(HostCache); |
| 145 }; | 153 }; |
| 146 | 154 |
| 147 } // namespace net | 155 } // namespace net |
| 148 | 156 |
| 149 #endif // NET_BASE_HOST_CACHE_H_ | 157 #endif // NET_BASE_HOST_CACHE_H_ |
| OLD | NEW |