Chromium Code Reviews| Index: net/http/http_cache.h |
| diff --git a/net/http/http_cache.h b/net/http/http_cache.h |
| index 1c1338b0d75d8019b82a5964609008b58d85ae0d..7d8224c6f98673f2fa788f5ddc361e3f7896778b 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 set_clock_for_test(scoped_ptr<base::Clock> clock) { |
|
rvargas (doing something else)
2014/12/24 02:15:24
I doubt the script recognizes hacker_names... besi
jkarlin
2015/01/08 16:13:03
Done.
|
| + 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. |
| @@ -455,6 +466,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); |