Skip to content

Commit

Permalink
...
Browse files Browse the repository at this point in the history
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71331 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
agl@chromium.org committed Jan 13, 2011
1 parent b6d8126 commit 3194fec
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 1 deletion.
22 changes: 21 additions & 1 deletion net/socket/ssl_host_info.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ SSLHostInfo::State* SSLHostInfo::mutable_state() {
return &state_;
}

void SSLHostInfo::set_cert_verification_finished_time() {
#if defined(OS_LINUX)
if (dnsrr_resolver_ && dns_handle_ == DnsRRResolver::kInvalidHandle) {
// We have completed the DNS lookup already. Therefore, waiting for the DNS
// lookup would cause no delay.
UMA_HISTOGRAM_TIMES("Net.SSLHostInfoDNSLookupDelayMs", base::TimeDelta());
} else {
// The actual delay will be calculated when the DNS lookup finishes, in
// DnsComplete.
cert_verification_finished_time_ = base::TimeTicks::Now();
}
#endif
}

bool SSLHostInfo::Parse(const std::string& data) {
State* state = mutable_state();

Expand Down Expand Up @@ -224,10 +238,16 @@ void SSLHostInfo::DnsComplete(int rv) {
dns_callback_ = NULL;

const base::TimeTicks now = base::TimeTicks::Now();
const base::TimeDelta elapsed = now - dns_lookup_start_time_;
base::TimeDelta elapsed = now - dns_lookup_start_time_;
UMA_HISTOGRAM_TIMES("Net.SSLHostInfoDNSLookup", elapsed);

if (!cert_verification_finished_time_.is_null()) {
elapsed = now - cert_verification_finished_time_;
UMA_HISTOGRAM_TIMES("Net.SSLHostInfoDNSLookupDelayMs", elapsed);
}
}


SSLHostInfoFactory::~SSLHostInfoFactory() {}

} // namespace net
7 changes: 7 additions & 0 deletions net/socket/ssl_host_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ class SSLHostInfo {
return verification_end_time_;
}

// set_cert_verification_finished_time allows the SSL socket to tell us when
// it finished verifing the certificate. If the DNS request hasn't finished
// by this time then we record how long we would have had to have waited for
// it.
void set_cert_verification_finished_time();

protected:
// Parse parses an opaque blob of data and fills out the public member fields
// of this object. It returns true iff the parse was successful. The public
Expand Down Expand Up @@ -146,6 +152,7 @@ class SSLHostInfo {
DnsRRResolver::Handle dns_handle_;
RRResponse dns_response_;
base::TimeTicks dns_lookup_start_time_;
base::TimeTicks cert_verification_finished_time_;
};

class SSLHostInfoFactory {
Expand Down

0 comments on commit 3194fec

Please sign in to comment.