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

Unified Diff: net/url_request/url_request_http_job.cc

Issue 14625012: net: Return LoadTiming information in the case of a cache hit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Small fix Created 7 years, 7 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
Index: net/url_request/url_request_http_job.cc
===================================================================
--- net/url_request/url_request_http_job.cc (revision 199488)
+++ net/url_request/url_request_http_job.cc (working copy)
@@ -416,6 +416,7 @@
DoneWithRequest(ABORTED);
transaction_.reset();
response_info_ = NULL;
+ receive_headers_end_ = base::TimeTicks();
}
void URLRequestHttpJob::StartTransaction() {
@@ -819,6 +820,8 @@
if (!transaction_.get())
return;
+ receive_headers_end_ = base::TimeTicks::Now();
+
// Clear the IO_PENDING status
SetStatus(URLRequestStatus());
@@ -918,6 +921,7 @@
// These will be reset in OnStartCompleted.
response_info_ = NULL;
+ receive_headers_end_ = base::TimeTicks();
response_cookies_.clear();
ResetTimer();
@@ -982,8 +986,12 @@
void URLRequestHttpJob::GetLoadTimingInfo(
LoadTimingInfo* load_timing_info) const {
- if (transaction_)
- transaction_->GetLoadTimingInfo(load_timing_info);
+ // If haven't made it far enough to receive any headers, don't return
+ // anything. This makes for more consistent behavior in the case of errors.
+ if (!transaction_ || receive_headers_end_.is_null())
+ return;
+ if (transaction_->GetLoadTimingInfo(load_timing_info))
+ load_timing_info->receive_headers_end = receive_headers_end_;
}
bool URLRequestHttpJob::GetResponseCookies(std::vector<std::string>* cookies) {
@@ -1124,6 +1132,7 @@
// These will be reset in OnStartCompleted.
response_info_ = NULL;
+ receive_headers_end_ = base::TimeTicks::Now();
response_cookies_.clear();
ResetTimer();
@@ -1147,6 +1156,7 @@
DCHECK(transaction_.get());
DCHECK(!response_info_) << "should not have a response yet";
+ receive_headers_end_ = base::TimeTicks();
ResetTimer();
@@ -1172,6 +1182,7 @@
return;
DCHECK(!response_info_) << "should not have a response yet";
+ receive_headers_end_ = base::TimeTicks();
ResetTimer();

Powered by Google App Engine
This is Rietveld 408576698