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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 // Clears hosts matching |host_filter| from the cache. | 164 // Clears hosts matching |host_filter| from the cache. |
165 void ClearForHosts( | 165 void ClearForHosts( |
166 const base::Callback<bool(const std::string&)>& host_filter); | 166 const base::Callback<bool(const std::string&)>& host_filter); |
167 | 167 |
168 // Returns the contents of the cache represented as a base::ListValue for | 168 // Returns the contents of the cache represented as a base::ListValue for |
169 // serialization. | 169 // serialization. |
170 std::unique_ptr<base::ListValue> GetAsListValue(bool include_staleness) const; | 170 std::unique_ptr<base::ListValue> GetAsListValue(bool include_staleness) const; |
171 // Takes a base::ListValue representing cache entries and stores them in the | 171 // Takes a base::ListValue representing cache entries and stores them in the |
172 // cache, skipping any that already have entries. Returns true on success, | 172 // cache, skipping any that already have entries. Returns true on success, |
173 // false on failure. | 173 // false on failure. |
174 bool RestoreFromListValue(base::ListValue& old_cache); | 174 bool RestoreFromListValue(const base::ListValue& old_cache); |
175 | 175 |
176 // Returns the number of entries in the cache. | 176 // Returns the number of entries in the cache. |
177 size_t size() const; | 177 size_t size() const; |
178 | 178 |
179 // Following are used by net_internals UI. | 179 // Following are used by net_internals UI. |
180 size_t max_entries() const; | 180 size_t max_entries() const; |
181 int network_changes() const { return network_changes_; } | 181 int network_changes() const { return network_changes_; } |
182 const EntryMap& entries() const { return entries_; } | 182 const EntryMap& entries() const { return entries_; } |
183 | 183 |
184 // Creates a default cache. | 184 // Creates a default cache. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 EvictionCallback eviction_callback_; | 220 EvictionCallback eviction_callback_; |
221 | 221 |
222 THREAD_CHECKER(thread_checker_); | 222 THREAD_CHECKER(thread_checker_); |
223 | 223 |
224 DISALLOW_COPY_AND_ASSIGN(HostCache); | 224 DISALLOW_COPY_AND_ASSIGN(HostCache); |
225 }; | 225 }; |
226 | 226 |
227 } // namespace net | 227 } // namespace net |
228 | 228 |
229 #endif // NET_DNS_HOST_CACHE_H_ | 229 #endif // NET_DNS_HOST_CACHE_H_ |
OLD | NEW |