| 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 #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> |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 base::TimeTicks now, | 139 base::TimeTicks now, |
| 140 base::TimeDelta ttl); | 140 base::TimeDelta ttl); |
| 141 | 141 |
| 142 // Marks all entries as stale on account of a network change. | 142 // Marks all entries as stale on account of a network change. |
| 143 void OnNetworkChange(); | 143 void OnNetworkChange(); |
| 144 | 144 |
| 145 void set_eviction_callback(const EvictionCallback& callback) { | 145 void set_eviction_callback(const EvictionCallback& callback) { |
| 146 eviction_callback_ = callback; | 146 eviction_callback_ = callback; |
| 147 } | 147 } |
| 148 | 148 |
| 149 // Empties the cache | 149 // Empties the cache. |
| 150 void clear(); | 150 void clear(); |
| 151 | 151 |
| 152 // Clears hosts matching |host_filter| from the cache. |
| 153 void ClearForHosts( |
| 154 const base::Callback<bool(const std::string&)>& host_filter); |
| 155 |
| 152 // Returns the number of entries in the cache. | 156 // Returns the number of entries in the cache. |
| 153 size_t size() const; | 157 size_t size() const; |
| 154 | 158 |
| 155 // Following are used by net_internals UI. | 159 // Following are used by net_internals UI. |
| 156 size_t max_entries() const; | 160 size_t max_entries() const; |
| 157 | 161 |
| 158 const EntryMap& entries() const { return entries_; } | 162 const EntryMap& entries() const { return entries_; } |
| 159 | 163 |
| 160 // Creates a default cache. | 164 // Creates a default cache. |
| 161 static std::unique_ptr<HostCache> CreateDefaultCache(); | 165 static std::unique_ptr<HostCache> CreateDefaultCache(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 192 size_t max_entries_; | 196 size_t max_entries_; |
| 193 int network_changes_; | 197 int network_changes_; |
| 194 EvictionCallback eviction_callback_; | 198 EvictionCallback eviction_callback_; |
| 195 | 199 |
| 196 DISALLOW_COPY_AND_ASSIGN(HostCache); | 200 DISALLOW_COPY_AND_ASSIGN(HostCache); |
| 197 }; | 201 }; |
| 198 | 202 |
| 199 } // namespace net | 203 } // namespace net |
| 200 | 204 |
| 201 #endif // NET_DNS_HOST_CACHE_H_ | 205 #endif // NET_DNS_HOST_CACHE_H_ |
| OLD | NEW |