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

Side by Side Diff: net/http/http_network_transaction.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: Missed a couple spots 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/http/http_network_transaction.h" 5 #include "net/http/http_network_transaction.h"
6 6
7 #include <set> 7 #include <set>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 bool HttpNetworkTransaction::GetLoadTimingInfo( 390 bool HttpNetworkTransaction::GetLoadTimingInfo(
391 LoadTimingInfo* load_timing_info) const { 391 LoadTimingInfo* load_timing_info) const {
392 if (!stream_ || !stream_->GetLoadTimingInfo(load_timing_info)) 392 if (!stream_ || !stream_->GetLoadTimingInfo(load_timing_info))
393 return false; 393 return false;
394 394
395 load_timing_info->proxy_resolve_start = 395 load_timing_info->proxy_resolve_start =
396 proxy_info_.proxy_resolve_start_time(); 396 proxy_info_.proxy_resolve_start_time();
397 load_timing_info->proxy_resolve_end = proxy_info_.proxy_resolve_end_time(); 397 load_timing_info->proxy_resolve_end = proxy_info_.proxy_resolve_end_time();
398 load_timing_info->send_start = send_start_time_; 398 load_timing_info->send_start = send_start_time_;
399 load_timing_info->send_end = send_end_time_; 399 load_timing_info->send_end = send_end_time_;
400 load_timing_info->receive_headers_end = receive_headers_end_;
401 return true; 400 return true;
402 } 401 }
403 402
404 void HttpNetworkTransaction::SetPriority(RequestPriority priority) { 403 void HttpNetworkTransaction::SetPriority(RequestPriority priority) {
405 priority_ = priority; 404 priority_ = priority;
406 // TODO(akalin): Plumb this through to |stream_request_| and 405 // TODO(akalin): Plumb this through to |stream_request_| and
407 // |stream_|. 406 // |stream_|.
408 } 407 }
409 408
410 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config, 409 void HttpNetworkTransaction::OnStreamReady(const SSLConfig& used_ssl_config,
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
839 if (!response_.headers && !stream_->IsConnectionReused()) { 838 if (!response_.headers && !stream_->IsConnectionReused()) {
840 // The connection was closed before any data was sent. Likely an error 839 // The connection was closed before any data was sent. Likely an error
841 // rather than empty HTTP/0.9 response. 840 // rather than empty HTTP/0.9 response.
842 return ERR_EMPTY_RESPONSE; 841 return ERR_EMPTY_RESPONSE;
843 } 842 }
844 843
845 return OK; 844 return OK;
846 } 845 }
847 846
848 int HttpNetworkTransaction::DoReadHeadersComplete(int result) { 847 int HttpNetworkTransaction::DoReadHeadersComplete(int result) {
849 receive_headers_end_ = base::TimeTicks::Now();
850
851 // We can get a certificate error or ERR_SSL_CLIENT_AUTH_CERT_NEEDED here 848 // We can get a certificate error or ERR_SSL_CLIENT_AUTH_CERT_NEEDED here
852 // due to SSL renegotiation. 849 // due to SSL renegotiation.
853 if (IsCertificateError(result)) { 850 if (IsCertificateError(result)) {
854 // We don't handle a certificate error during SSL renegotiation, so we 851 // We don't handle a certificate error during SSL renegotiation, so we
855 // have to return an error that's not in the certificate error range 852 // have to return an error that's not in the certificate error range
856 // (-2xx). 853 // (-2xx).
857 LOG(ERROR) << "Got a server certificate with error " << result 854 LOG(ERROR) << "Got a server certificate with error " << result
858 << " during SSL renegotiation"; 855 << " during SSL renegotiation";
859 result = ERR_CERT_ERROR_IN_SSL_RENEGOTIATION; 856 result = ERR_CERT_ERROR_IN_SSL_RENEGOTIATION;
860 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) { 857 } else if (result == ERR_SSL_CLIENT_AUTH_CERT_NEEDED) {
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1288 } 1285 }
1289 1286
1290 void HttpNetworkTransaction::ResetStateForRestart() { 1287 void HttpNetworkTransaction::ResetStateForRestart() {
1291 ResetStateForAuthRestart(); 1288 ResetStateForAuthRestart();
1292 stream_.reset(); 1289 stream_.reset();
1293 } 1290 }
1294 1291
1295 void HttpNetworkTransaction::ResetStateForAuthRestart() { 1292 void HttpNetworkTransaction::ResetStateForAuthRestart() {
1296 send_start_time_ = base::TimeTicks(); 1293 send_start_time_ = base::TimeTicks();
1297 send_end_time_ = base::TimeTicks(); 1294 send_end_time_ = base::TimeTicks();
1298 receive_headers_end_ = base::TimeTicks();
1299 1295
1300 pending_auth_target_ = HttpAuth::AUTH_NONE; 1296 pending_auth_target_ = HttpAuth::AUTH_NONE;
1301 read_buf_ = NULL; 1297 read_buf_ = NULL;
1302 read_buf_len_ = 0; 1298 read_buf_len_ = 0;
1303 headers_valid_ = false; 1299 headers_valid_ = false;
1304 request_headers_.Clear(); 1300 request_headers_.Clear();
1305 response_ = HttpResponseInfo(); 1301 response_ = HttpResponseInfo();
1306 establishing_tunnel_ = false; 1302 establishing_tunnel_ = false;
1307 } 1303 }
1308 1304
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
1427 description = base::StringPrintf("Unknown state 0x%08X (%u)", state, 1423 description = base::StringPrintf("Unknown state 0x%08X (%u)", state,
1428 state); 1424 state);
1429 break; 1425 break;
1430 } 1426 }
1431 return description; 1427 return description;
1432 } 1428 }
1433 1429
1434 #undef STATE_CASE 1430 #undef STATE_CASE
1435 1431
1436 } // namespace net 1432 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698