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

Unified Diff: net/socket/ssl_client_socket_pool.cc

Issue 11428150: LoadTiming implementation in net, part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix a header or two Created 7 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/socket/ssl_client_socket_pool.h ('k') | net/socket/ssl_client_socket_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/ssl_client_socket_pool.cc
===================================================================
--- net/socket/ssl_client_socket_pool.cc (revision 175289)
+++ net/socket/ssl_client_socket_pool.cc (working copy)
@@ -129,7 +129,7 @@
transport_socket_handle_.release());
}
handle->set_ssl_error_response_info(error_response_info_);
- if (!ssl_connect_start_time_.is_null())
+ if (!connect_timing_.ssl_start.is_null())
handle->set_is_ssl_error(true);
}
@@ -259,8 +259,23 @@
next_state_ = STATE_SSL_CONNECT_COMPLETE;
// Reset the timeout to just the time allowed for the SSL handshake.
ResetTimer(base::TimeDelta::FromSeconds(kSSLHandshakeTimeoutInSeconds));
- ssl_connect_start_time_ = base::TimeTicks::Now();
+ // If the handle has a fresh socket, get its connect start and DNS times.
+ // This should always be the case.
+ const LoadTimingInfo::ConnectTiming& socket_connect_timing =
+ transport_socket_handle_->connect_timing();
+ if (!transport_socket_handle_->is_reused() &&
+ !socket_connect_timing.connect_start.is_null()) {
+ // Overwriting |connect_start| serves two purposes - it adjusts timing so
+ // |connect_start| doesn't include dns times, and it adjusts the time so
+ // as not to include time spent waiting for an idle socket.
+ connect_timing_.connect_start = socket_connect_timing.connect_start;
+ connect_timing_.dns_start = socket_connect_timing.dns_start;
+ connect_timing_.dns_end = socket_connect_timing.dns_end;
+ }
+
+ connect_timing_.ssl_start = base::TimeTicks::Now();
+
ssl_socket_.reset(client_socket_factory_->CreateSSLClientSocket(
transport_socket_handle_.release(), params_->host_and_port(),
params_->ssl_config(), context_));
@@ -268,6 +283,8 @@
}
int SSLConnectJob::DoSSLConnectComplete(int result) {
+ connect_timing_.ssl_end = base::TimeTicks::Now();
+
SSLClientSocket::NextProtoStatus status =
SSLClientSocket::kNextProtoUnsupported;
std::string proto;
@@ -302,9 +319,9 @@
if (result == OK ||
ssl_socket_->IgnoreCertError(result, params_->load_flags())) {
- DCHECK(ssl_connect_start_time_ != base::TimeTicks());
+ DCHECK(!connect_timing_.ssl_start.is_null());
base::TimeDelta connect_duration =
- base::TimeTicks::Now() - ssl_connect_start_time_;
+ connect_timing_.ssl_end - connect_timing_.ssl_start;
if (using_spdy) {
UMA_HISTOGRAM_CUSTOM_TIMES("Net.SpdyConnectionLatency",
connect_duration,
« no previous file with comments | « net/socket/ssl_client_socket_pool.h ('k') | net/socket/ssl_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698