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

Unified Diff: net/http/http_cache.h

Issue 851503003: Update from https://crrev.com/311076 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/filter/sdch_filter_unittest.cc ('k') | net/http/http_cache.cc » ('j') | no next file with comments »
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 8fa1640174abb8db6afcb9a9870a52174020d8e4..33b89f382cd47114181f65d2b6d6b3821378939c 100644
--- a/net/http/http_cache.h
+++ b/net/http/http_cache.h
@@ -25,6 +25,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "base/threading/non_thread_safe.h"
+#include "base/time/clock.h"
#include "base/time/time.h"
#include "net/base/cache_type.h"
#include "net/base/completion_callback.h"
@@ -126,6 +127,10 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory,
scoped_refptr<base::SingleThreadTaskRunner> thread_;
};
+ // The number of minutes after a resource is prefetched that it can be used
+ // again without validation.
+ static const int kPrefetchReuseMins = 5;
+
// The disk cache is initialized lazily (by CreateTransaction) in this case.
// The HttpCache takes ownership of the |backend_factory|.
HttpCache(const net::HttpNetworkSession::Params& params,
@@ -181,6 +186,12 @@ class NET_EXPORT HttpCache : public HttpTransactionFactory,
void set_mode(Mode value) { mode_ = value; }
Mode mode() { return mode_; }
+ // Get/Set the cache's clock. These are public only for testing.
+ void SetClockForTesting(scoped_ptr<base::Clock> clock) {
+ clock_.reset(clock.release());
+ }
+ base::Clock* clock() const { return clock_.get(); }
+
// Close currently active sockets so that fresh page loads will not use any
// recycled connections. For sockets currently in use, they may not close
// immediately, but they will not be reusable. This is for debugging.
@@ -462,6 +473,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 | « net/filter/sdch_filter_unittest.cc ('k') | net/http/http_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698