| 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 762 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 773 pinning_failure_log_ = verify_details_chromium->pinning_failure_log; | 773 pinning_failure_log_ = verify_details_chromium->pinning_failure_log; |
| 774 logger_->OnCertificateVerified(*cert_verify_result_); | 774 logger_->OnCertificateVerified(*cert_verify_result_); |
| 775 } | 775 } |
| 776 | 776 |
| 777 void QuicClientSession::StartReading() { | 777 void QuicClientSession::StartReading() { |
| 778 packet_reader_.StartReading(); | 778 packet_reader_.StartReading(); |
| 779 } | 779 } |
| 780 | 780 |
| 781 void QuicClientSession::CloseSessionOnError(int error, | 781 void QuicClientSession::CloseSessionOnError(int error, |
| 782 QuicErrorCode quic_error) { | 782 QuicErrorCode quic_error) { |
| 783 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.CloseSessionOnError", -error); | 783 RecordAndCloseSessionOnError(error, quic_error); |
| 784 CloseSessionOnErrorInner(error, quic_error); | |
| 785 NotifyFactoryOfSessionClosed(); | 784 NotifyFactoryOfSessionClosed(); |
| 786 } | 785 } |
| 787 | 786 |
| 787 void QuicClientSession::CloseSessionOnErrorAndNotifyFactoryLater( |
| 788 int error, |
| 789 QuicErrorCode quic_error) { |
| 790 RecordAndCloseSessionOnError(error, quic_error); |
| 791 NotifyFactoryOfSessionClosedLater(); |
| 792 } |
| 793 |
| 794 void QuicClientSession::RecordAndCloseSessionOnError(int error, |
| 795 QuicErrorCode quic_error) { |
| 796 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.CloseSessionOnError", -error); |
| 797 CloseSessionOnErrorInner(error, quic_error); |
| 798 } |
| 799 |
| 788 void QuicClientSession::CloseSessionOnErrorInner(int net_error, | 800 void QuicClientSession::CloseSessionOnErrorInner(int net_error, |
| 789 QuicErrorCode quic_error) { | 801 QuicErrorCode quic_error) { |
| 790 if (!callback_.is_null()) { | 802 if (!callback_.is_null()) { |
| 791 base::ResetAndReturn(&callback_).Run(net_error); | 803 base::ResetAndReturn(&callback_).Run(net_error); |
| 792 } | 804 } |
| 793 CloseAllStreams(net_error); | 805 CloseAllStreams(net_error); |
| 794 CloseAllObservers(net_error); | 806 CloseAllObservers(net_error); |
| 795 net_log_.AddEvent( | 807 net_log_.AddEvent( |
| 796 NetLog::TYPE_QUIC_SESSION_CLOSE_ON_ERROR, | 808 NetLog::TYPE_QUIC_SESSION_CLOSE_ON_ERROR, |
| 797 NetLog::IntegerCallback("net_error", net_error)); | 809 NetLog::IntegerCallback("net_error", net_error)); |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 921 return; | 933 return; |
| 922 | 934 |
| 923 // TODO(rch): re-enable this code once beta is cut. | 935 // TODO(rch): re-enable this code once beta is cut. |
| 924 // if (stream_factory_) | 936 // if (stream_factory_) |
| 925 // stream_factory_->OnSessionConnectTimeout(this); | 937 // stream_factory_->OnSessionConnectTimeout(this); |
| 926 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); | 938 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); |
| 927 // DCHECK_EQ(0u, GetNumOpenStreams()); | 939 // DCHECK_EQ(0u, GetNumOpenStreams()); |
| 928 } | 940 } |
| 929 | 941 |
| 930 } // namespace net | 942 } // namespace net |
| OLD | NEW |