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

Unified Diff: net/http/http_cache.cc

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/http/http_cache.h ('k') | net/http/http_cache_transaction.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/http/http_cache.cc
diff --git a/net/http/http_cache.cc b/net/http/http_cache.cc
index a071baad0d9a9611601529928cb983c1156cbe4d..ed362003b00739ad4e4a542aee06a5740a03bd62 100644
--- a/net/http/http_cache.cc
+++ b/net/http/http_cache.cc
@@ -29,6 +29,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/threading/worker_pool.h"
+#include "base/time/default_clock.h"
#include "base/time/time.h"
#include "net/base/cache_type.h"
#include "net/base/io_buffer.h"
@@ -361,7 +362,7 @@ void HttpCache::AsyncValidation::Start(const BoundNetLog& net_log,
DCHECK_EQ(0, request_.load_flags & LOAD_ASYNC_REVALIDATION);
request_.load_flags |= LOAD_ASYNC_REVALIDATION;
- start_time_ = base::Time::Now();
+ start_time_ = cache_->clock()->Now();
// This use of base::Unretained is safe because |transaction_| is owned by
// this object.
read_callback_ = base::Bind(&AsyncValidation::OnRead, base::Unretained(this));
@@ -439,7 +440,7 @@ void HttpCache::AsyncValidation::Terminate(int result) {
// anyway.
cache_->DoomEntry(transaction_->key(), transaction_.get());
}
- base::TimeDelta duration = base::Time::Now() - start_time_;
+ base::TimeDelta duration = cache_->clock()->Now() - start_time_;
UMA_HISTOGRAM_TIMES("HttpCache.AsyncValidationDuration", duration);
transaction_->net_log().EndEventWithNetErrorCode(
NetLog::TYPE_ASYNC_REVALIDATION, result);
@@ -458,6 +459,7 @@ HttpCache::HttpCache(const net::HttpNetworkSession::Params& params,
use_stale_while_revalidate_(params.use_stale_while_revalidate),
mode_(NORMAL),
network_layer_(new HttpNetworkLayer(new HttpNetworkSession(params))),
+ clock_(new base::DefaultClock()),
weak_factory_(this) {
SetupQuicServerInfoFactory(network_layer_->GetSession());
}
@@ -475,6 +477,7 @@ HttpCache::HttpCache(HttpNetworkSession* session,
use_stale_while_revalidate_(session->params().use_stale_while_revalidate),
mode_(NORMAL),
network_layer_(new HttpNetworkLayer(session)),
+ clock_(new base::DefaultClock()),
weak_factory_(this) {
}
@@ -489,6 +492,7 @@ HttpCache::HttpCache(HttpTransactionFactory* network_layer,
use_stale_while_revalidate_(false),
mode_(NORMAL),
network_layer_(network_layer),
+ clock_(new base::DefaultClock()),
weak_factory_(this) {
SetupQuicServerInfoFactory(network_layer_->GetSession());
HttpNetworkSession* session = network_layer_->GetSession();
« no previous file with comments | « net/http/http_cache.h ('k') | net/http/http_cache_transaction.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698