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

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

Issue 2298173002: Implement host-based deletion for the hostname resolution cache. (Closed)
Patch Set: Take TimeTicks::Now() out of the loop Created 4 years, 3 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 | « chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.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>
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/gaia_screen_handler.cc ('k') | net/dns/host_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698