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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 STATE_HANDSHAKE_CONFIRMED = 2, | 85 STATE_HANDSHAKE_CONFIRMED = 2, |
86 STATE_FAILED = 3, | 86 STATE_FAILED = 3, |
87 NUM_HANDSHAKE_STATES = 4 | 87 NUM_HANDSHAKE_STATES = 4 |
88 }; | 88 }; |
89 | 89 |
90 void RecordHandshakeState(HandshakeState state) { | 90 void RecordHandshakeState(HandshakeState state) { |
91 UMA_HISTOGRAM_ENUMERATION("Net.QuicHandshakeState", state, | 91 UMA_HISTOGRAM_ENUMERATION("Net.QuicHandshakeState", state, |
92 NUM_HANDSHAKE_STATES); | 92 NUM_HANDSHAKE_STATES); |
93 } | 93 } |
94 | 94 |
| 95 base::Value* NetLogQuicClientSessionCallback( |
| 96 const QuicServerId* server_id, |
| 97 bool require_confirmation, |
| 98 NetLog::LogLevel /* log_level */) { |
| 99 base::DictionaryValue* dict = new base::DictionaryValue(); |
| 100 dict->SetString("host", server_id->host()); |
| 101 dict->SetInteger("port", server_id->port()); |
| 102 dict->SetBoolean("is_https", server_id->is_https()); |
| 103 dict->SetBoolean("require_confirmation", require_confirmation); |
| 104 return dict; |
| 105 } |
| 106 |
95 } // namespace | 107 } // namespace |
96 | 108 |
97 QuicClientSession::StreamRequest::StreamRequest() : stream_(nullptr) {} | 109 QuicClientSession::StreamRequest::StreamRequest() : stream_(nullptr) {} |
98 | 110 |
99 QuicClientSession::StreamRequest::~StreamRequest() { | 111 QuicClientSession::StreamRequest::~StreamRequest() { |
100 CancelRequest(); | 112 CancelRequest(); |
101 } | 113 } |
102 | 114 |
103 int QuicClientSession::StreamRequest::StartRequest( | 115 int QuicClientSession::StreamRequest::StartRequest( |
104 const base::WeakPtr<QuicClientSession>& session, | 116 const base::WeakPtr<QuicClientSession>& session, |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 server_host_port_ = server_id.host_port_pair(); | 179 server_host_port_ = server_id.host_port_pair(); |
168 crypto_stream_.reset( | 180 crypto_stream_.reset( |
169 crypto_client_stream_factory ? | 181 crypto_client_stream_factory ? |
170 crypto_client_stream_factory->CreateQuicCryptoClientStream( | 182 crypto_client_stream_factory->CreateQuicCryptoClientStream( |
171 server_id, this, crypto_config) : | 183 server_id, this, crypto_config) : |
172 new QuicCryptoClientStream(server_id, this, | 184 new QuicCryptoClientStream(server_id, this, |
173 new ProofVerifyContextChromium(net_log_), | 185 new ProofVerifyContextChromium(net_log_), |
174 crypto_config)); | 186 crypto_config)); |
175 QuicClientSessionBase::InitializeSession(); | 187 QuicClientSessionBase::InitializeSession(); |
176 // TODO(rch): pass in full host port proxy pair | 188 // TODO(rch): pass in full host port proxy pair |
177 net_log_.BeginEvent( | 189 net_log_.BeginEvent(NetLog::TYPE_QUIC_SESSION, |
178 NetLog::TYPE_QUIC_SESSION, | 190 base::Bind(NetLogQuicClientSessionCallback, |
179 NetLog::StringCallback("host", &server_id.host())); | 191 &server_id, |
| 192 require_confirmation_)); |
180 } | 193 } |
181 | 194 |
182 QuicClientSession::~QuicClientSession() { | 195 QuicClientSession::~QuicClientSession() { |
183 if (!streams()->empty()) | 196 if (!streams()->empty()) |
184 RecordUnexpectedOpenStreams(DESTRUCTOR); | 197 RecordUnexpectedOpenStreams(DESTRUCTOR); |
185 if (!observers_.empty()) | 198 if (!observers_.empty()) |
186 RecordUnexpectedObservers(DESTRUCTOR); | 199 RecordUnexpectedObservers(DESTRUCTOR); |
187 if (!going_away_) | 200 if (!going_away_) |
188 RecordUnexpectedNotGoingAway(DESTRUCTOR); | 201 RecordUnexpectedNotGoingAway(DESTRUCTOR); |
189 | 202 |
(...skipping 673 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
863 return; | 876 return; |
864 | 877 |
865 // TODO(rch): re-enable this code once beta is cut. | 878 // TODO(rch): re-enable this code once beta is cut. |
866 // if (stream_factory_) | 879 // if (stream_factory_) |
867 // stream_factory_->OnSessionConnectTimeout(this); | 880 // stream_factory_->OnSessionConnectTimeout(this); |
868 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); | 881 // CloseAllStreams(ERR_QUIC_HANDSHAKE_FAILED); |
869 // DCHECK_EQ(0u, GetNumOpenStreams()); | 882 // DCHECK_EQ(0u, GetNumOpenStreams()); |
870 } | 883 } |
871 | 884 |
872 } // namespace net | 885 } // namespace net |
OLD | NEW |