OLD | NEW |
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/quic/quic_client_session.h" | 5 #include "net/quic/quic_client_session.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
10 #include "base/metrics/sparse_histogram.h" | 10 #include "base/metrics/sparse_histogram.h" |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 ssl_info->client_cert_sent = false; | 428 ssl_info->client_cert_sent = false; |
429 ssl_info->channel_id_sent = false; | 429 ssl_info->channel_id_sent = false; |
430 ssl_info->security_bits = security_bits; | 430 ssl_info->security_bits = security_bits; |
431 ssl_info->handshake_type = SSLInfo::HANDSHAKE_FULL; | 431 ssl_info->handshake_type = SSLInfo::HANDSHAKE_FULL; |
432 return true; | 432 return true; |
433 } | 433 } |
434 | 434 |
435 int QuicClientSession::CryptoConnect(bool require_confirmation, | 435 int QuicClientSession::CryptoConnect(bool require_confirmation, |
436 const CompletionCallback& callback) { | 436 const CompletionCallback& callback) { |
437 require_confirmation_ = require_confirmation; | 437 require_confirmation_ = require_confirmation; |
| 438 handshake_start_ = base::TimeTicks::Now(); |
438 RecordHandshakeState(STATE_STARTED); | 439 RecordHandshakeState(STATE_STARTED); |
439 if (!crypto_stream_->CryptoConnect()) { | 440 if (!crypto_stream_->CryptoConnect()) { |
440 // TODO(wtc): change crypto_stream_.CryptoConnect() to return a | 441 // TODO(wtc): change crypto_stream_.CryptoConnect() to return a |
441 // QuicErrorCode and map it to a net error code. | 442 // QuicErrorCode and map it to a net error code. |
442 return ERR_CONNECTION_FAILED; | 443 return ERR_CONNECTION_FAILED; |
443 } | 444 } |
444 | 445 |
445 if (IsCryptoHandshakeConfirmed()) | 446 if (IsCryptoHandshakeConfirmed()) |
446 return OK; | 447 return OK; |
447 | 448 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 void QuicClientSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { | 538 void QuicClientSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { |
538 if (!callback_.is_null() && | 539 if (!callback_.is_null() && |
539 (!require_confirmation_ || event == HANDSHAKE_CONFIRMED)) { | 540 (!require_confirmation_ || event == HANDSHAKE_CONFIRMED)) { |
540 // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_ | 541 // TODO(rtenneti): Currently for all CryptoHandshakeEvent events, callback_ |
541 // could be called because there are no error events in CryptoHandshakeEvent | 542 // could be called because there are no error events in CryptoHandshakeEvent |
542 // enum. If error events are added to CryptoHandshakeEvent, then the | 543 // enum. If error events are added to CryptoHandshakeEvent, then the |
543 // following code needs to changed. | 544 // following code needs to changed. |
544 base::ResetAndReturn(&callback_).Run(OK); | 545 base::ResetAndReturn(&callback_).Run(OK); |
545 } | 546 } |
546 if (event == HANDSHAKE_CONFIRMED) { | 547 if (event == HANDSHAKE_CONFIRMED) { |
| 548 UMA_HISTOGRAM_TIMES("Net.QuicSession.HandshakeConfirmedTime", |
| 549 base::TimeTicks::Now() - handshake_start_); |
547 ObserverSet::iterator it = observers_.begin(); | 550 ObserverSet::iterator it = observers_.begin(); |
548 while (it != observers_.end()) { | 551 while (it != observers_.end()) { |
549 Observer* observer = *it; | 552 Observer* observer = *it; |
550 ++it; | 553 ++it; |
551 observer->OnCryptoHandshakeConfirmed(); | 554 observer->OnCryptoHandshakeConfirmed(); |
552 } | 555 } |
553 } | 556 } |
554 QuicSession::OnCryptoHandshakeEvent(event); | 557 QuicSession::OnCryptoHandshakeEvent(event); |
555 } | 558 } |
556 | 559 |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
835 | 838 |
836 if (IsCryptoHandshakeConfirmed()) | 839 if (IsCryptoHandshakeConfirmed()) |
837 return; | 840 return; |
838 | 841 |
839 if (stream_factory_) | 842 if (stream_factory_) |
840 stream_factory_->OnSessionConnectTimeout(this); | 843 stream_factory_->OnSessionConnectTimeout(this); |
841 CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); | 844 CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); |
842 } | 845 } |
843 | 846 |
844 } // namespace net | 847 } // namespace net |
OLD | NEW |