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/chromium/quic_chromium_client_session.h" | 5 #include "net/quic/chromium/quic_chromium_client_session.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1209 logger_->OnCertificateVerified(*cert_verify_result_); | 1209 logger_->OnCertificateVerified(*cert_verify_result_); |
1210 pkp_bypassed_ = verify_details_chromium->pkp_bypassed; | 1210 pkp_bypassed_ = verify_details_chromium->pkp_bypassed; |
1211 } | 1211 } |
1212 | 1212 |
1213 void QuicChromiumClientSession::StartReading() { | 1213 void QuicChromiumClientSession::StartReading() { |
1214 for (auto& packet_reader : packet_readers_) { | 1214 for (auto& packet_reader : packet_readers_) { |
1215 packet_reader->StartReading(); | 1215 packet_reader->StartReading(); |
1216 } | 1216 } |
1217 } | 1217 } |
1218 | 1218 |
1219 void QuicChromiumClientSession::CloseSessionOnError(int error, | 1219 void QuicChromiumClientSession::CloseSessionOnError(int net_error, |
1220 QuicErrorCode quic_error) { | 1220 QuicErrorCode quic_error) { |
1221 RecordAndCloseSessionOnError(error, quic_error); | 1221 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.CloseSessionOnError", |
1222 NotifyFactoryOfSessionClosed(); | 1222 -net_error); |
1223 } | |
1224 | 1223 |
1225 void QuicChromiumClientSession::RecordAndCloseSessionOnError( | |
1226 int error, | |
1227 QuicErrorCode quic_error) { | |
1228 UMA_HISTOGRAM_SPARSE_SLOWLY("Net.QuicSession.CloseSessionOnError", -error); | |
1229 CloseSessionOnErrorInner(error, quic_error); | |
1230 } | |
1231 | |
1232 void QuicChromiumClientSession::CloseSessionOnErrorInner( | |
1233 int net_error, | |
1234 QuicErrorCode quic_error) { | |
1235 if (!callback_.is_null()) { | 1224 if (!callback_.is_null()) { |
1236 base::ResetAndReturn(&callback_).Run(net_error); | 1225 base::ResetAndReturn(&callback_).Run(net_error); |
1237 } | 1226 } |
1238 CloseAllStreams(net_error); | 1227 CloseAllStreams(net_error); |
1239 CloseAllObservers(net_error); | 1228 CloseAllObservers(net_error); |
1240 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_CLOSE_ON_ERROR, | 1229 net_log_.AddEvent(NetLogEventType::QUIC_SESSION_CLOSE_ON_ERROR, |
1241 NetLog::IntCallback("net_error", net_error)); | 1230 NetLog::IntCallback("net_error", net_error)); |
1242 | 1231 |
1243 if (connection()->connected()) | 1232 if (connection()->connected()) |
1244 connection()->CloseConnection(quic_error, "net error", | 1233 connection()->CloseConnection(quic_error, "net error", |
1245 ConnectionCloseBehavior::SILENT_CLOSE); | 1234 ConnectionCloseBehavior::SILENT_CLOSE); |
1246 DCHECK(!connection()->connected()); | 1235 DCHECK(!connection()->connected()); |
| 1236 |
| 1237 NotifyFactoryOfSessionClosed(); |
1247 } | 1238 } |
1248 | 1239 |
1249 void QuicChromiumClientSession::CloseAllStreams(int net_error) { | 1240 void QuicChromiumClientSession::CloseAllStreams(int net_error) { |
1250 while (!dynamic_streams().empty()) { | 1241 while (!dynamic_streams().empty()) { |
1251 QuicStream* stream = dynamic_streams().begin()->second.get(); | 1242 QuicStream* stream = dynamic_streams().begin()->second.get(); |
1252 QuicStreamId id = stream->id(); | 1243 QuicStreamId id = stream->id(); |
1253 static_cast<QuicChromiumClientStream*>(stream)->OnError(net_error); | 1244 static_cast<QuicChromiumClientStream*>(stream)->OnError(net_error); |
1254 CloseStream(id); | 1245 CloseStream(id); |
1255 } | 1246 } |
1256 } | 1247 } |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1497 } | 1488 } |
1498 | 1489 |
1499 size_t QuicChromiumClientSession::EstimateMemoryUsage() const { | 1490 size_t QuicChromiumClientSession::EstimateMemoryUsage() const { |
1500 // TODO(xunjieli): Estimate |crypto_stream_|, QuicSpdySession's | 1491 // TODO(xunjieli): Estimate |crypto_stream_|, QuicSpdySession's |
1501 // QuicHeaderList, QuicSession's QuiCWriteBlockedList, open streams and | 1492 // QuicHeaderList, QuicSession's QuiCWriteBlockedList, open streams and |
1502 // unacked packet map. | 1493 // unacked packet map. |
1503 return base::trace_event::EstimateMemoryUsage(packet_readers_); | 1494 return base::trace_event::EstimateMemoryUsage(packet_readers_); |
1504 } | 1495 } |
1505 | 1496 |
1506 } // namespace net | 1497 } // namespace net |
OLD | NEW |