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

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

Issue 7466031: AsyncHostResolver: integrated HostCache, temporarily, until we have RR cache. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed copyright year. Created 9 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « net/base/async_host_resolver_unittest.cc ('k') | net/base/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) 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 // Following are used by net_internals UI. 104 // Following are used by net_internals UI.
105 size_t max_entries() const; 105 size_t max_entries() const;
106 106
107 base::TimeDelta success_entry_ttl() const; 107 base::TimeDelta success_entry_ttl() const;
108 108
109 base::TimeDelta failure_entry_ttl() const; 109 base::TimeDelta failure_entry_ttl() const;
110 110
111 // Note that this map may contain expired entries. 111 // Note that this map may contain expired entries.
112 const EntryMap& entries() const; 112 const EntryMap& entries() const;
113 113
114 // Creates a default cache.
115 static HostCache* CreateDefaultCache();
116
114 private: 117 private:
115 FRIEND_TEST_ALL_PREFIXES(HostCacheTest, Compact); 118 FRIEND_TEST_ALL_PREFIXES(HostCacheTest, Compact);
116 FRIEND_TEST_ALL_PREFIXES(HostCacheTest, NoCache); 119 FRIEND_TEST_ALL_PREFIXES(HostCacheTest, NoCache);
117 120
118 // Returns true if this cache entry's result is valid at time |now|. 121 // Returns true if this cache entry's result is valid at time |now|.
119 static bool CanUseEntry(const Entry* entry, const base::TimeTicks now); 122 static bool CanUseEntry(const Entry* entry, const base::TimeTicks now);
120 123
121 // Prunes entries from the cache to bring it below max entry bound. Entries 124 // Prunes entries from the cache to bring it below max entry bound. Entries
122 // matching |pinned_entry| will NOT be pruned. 125 // matching |pinned_entry| will NOT be pruned.
123 void Compact(base::TimeTicks now, const Entry* pinned_entry); 126 void Compact(base::TimeTicks now, const Entry* pinned_entry);
(...skipping 13 matching lines...) Expand all
137 // Map from hostname (presumably in lowercase canonicalized format) to 140 // Map from hostname (presumably in lowercase canonicalized format) to
138 // a resolved result entry. 141 // a resolved result entry.
139 EntryMap entries_; 142 EntryMap entries_;
140 143
141 DISALLOW_COPY_AND_ASSIGN(HostCache); 144 DISALLOW_COPY_AND_ASSIGN(HostCache);
142 }; 145 };
143 146
144 } // namespace net 147 } // namespace net
145 148
146 #endif // NET_BASE_HOST_CACHE_H_ 149 #endif // NET_BASE_HOST_CACHE_H_
OLDNEW
« no previous file with comments | « net/base/async_host_resolver_unittest.cc ('k') | net/base/host_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698