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

Unified Diff: net/http/http_cache.h

Issue 793823002: Let prefetched resources skip cache revalidation once for a short duration. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleaning up Created 6 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | net/http/http_cache.cc » ('j') | net/http/http_cache.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache.h
diff --git a/net/http/http_cache.h b/net/http/http_cache.h
index 1c1338b0d75d8019b82a5964609008b58d85ae0d..fee61d81d0a0839f2a7d66ff627dfe24f659fac8 100644
--- a/net/http/http_cache.h
+++ b/net/http/http_cache.h
@@ -37,6 +37,7 @@
class GURL;
namespace base {
+class Clock;
class SingleThreadTaskRunner;
} // namespace base
@@ -52,6 +53,7 @@ class ChannelIDService;
class DiskBasedCertCache;
class HostResolver;
class HttpAuthHandlerFactory;
+class HttpCachePrefetchValidationTest;
class HttpNetworkSession;
class HttpResponseInfo;
class HttpServerProperties;
@@ -247,6 +249,7 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory,
class WorkItem;
friend class Transaction;
friend class ViewCacheHelper;
+ friend class HttpCachePrefetchValidationTest;
struct PendingOp; // Info for an entry under construction.
class AsyncValidation; // Encapsulates a single async revalidation.
@@ -271,6 +274,10 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory,
typedef std::set<ActiveEntry*> ActiveEntriesSet;
typedef base::hash_map<std::string, int> PlaybackCacheMap;
+ // The number of minutes after a resource is prefetched that it can be used
+ // again without validation.
+ static const int kPrefetchReuseMins = 5;
+
// Methods ------------------------------------------------------------------
// Creates the |backend| object and notifies the |callback| when the operation
@@ -455,6 +462,9 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory,
// The async validations currently in progress, keyed by URL.
AsyncValidationMap async_validations_;
+ // A clock that can be swapped out for testing.
+ scoped_ptr<base::Clock> clock_;
+
base::WeakPtrFactory<HttpCache> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(HttpCache);
« no previous file with comments | « no previous file | net/http/http_cache.cc » ('j') | net/http/http_cache.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698