| 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 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 DCHECK(connection()->connected()); | 736 DCHECK(connection()->connected()); |
| 737 QuicChromiumClientStream* stream = | 737 QuicChromiumClientStream* stream = |
| 738 new QuicChromiumClientStream(id, this, net_log_); | 738 new QuicChromiumClientStream(id, this, net_log_); |
| 739 stream->CloseWriteSide(); | 739 stream->CloseWriteSide(); |
| 740 ActivateStream(base::WrapUnique(stream)); | 740 ActivateStream(base::WrapUnique(stream)); |
| 741 ++num_total_streams_; | 741 ++num_total_streams_; |
| 742 return stream; | 742 return stream; |
| 743 } | 743 } |
| 744 | 744 |
| 745 void QuicChromiumClientSession::CloseStream(QuicStreamId stream_id) { | 745 void QuicChromiumClientSession::CloseStream(QuicStreamId stream_id) { |
| 746 ReliableQuicStream* stream = GetOrCreateStream(stream_id); | 746 QuicStream* stream = GetOrCreateStream(stream_id); |
| 747 if (stream) { | 747 if (stream) { |
| 748 logger_->UpdateReceivedFrameCounts(stream_id, stream->num_frames_received(), | 748 logger_->UpdateReceivedFrameCounts(stream_id, stream->num_frames_received(), |
| 749 stream->num_duplicate_frames_received()); | 749 stream->num_duplicate_frames_received()); |
| 750 if (stream_id % 2 == 0) { | 750 if (stream_id % 2 == 0) { |
| 751 // Stream with even stream is initiated by server for PUSH. | 751 // Stream with even stream is initiated by server for PUSH. |
| 752 bytes_pushed_count_ += stream->stream_bytes_read(); | 752 bytes_pushed_count_ += stream->stream_bytes_read(); |
| 753 } | 753 } |
| 754 } | 754 } |
| 755 QuicSpdySession::CloseStream(stream_id); | 755 QuicSpdySession::CloseStream(stream_id); |
| 756 OnClosedStream(); | 756 OnClosedStream(); |
| 757 } | 757 } |
| 758 | 758 |
| 759 void QuicChromiumClientSession::SendRstStream(QuicStreamId id, | 759 void QuicChromiumClientSession::SendRstStream(QuicStreamId id, |
| 760 QuicRstStreamErrorCode error, | 760 QuicRstStreamErrorCode error, |
| 761 QuicStreamOffset bytes_written) { | 761 QuicStreamOffset bytes_written) { |
| 762 ReliableQuicStream* stream = GetOrCreateStream(id); | 762 QuicStream* stream = GetOrCreateStream(id); |
| 763 if (stream) { | 763 if (stream) { |
| 764 if (id % 2 == 0) { | 764 if (id % 2 == 0) { |
| 765 // Stream with even stream is initiated by server for PUSH. | 765 // Stream with even stream is initiated by server for PUSH. |
| 766 bytes_pushed_count_ += stream->stream_bytes_read(); | 766 bytes_pushed_count_ += stream->stream_bytes_read(); |
| 767 } | 767 } |
| 768 } | 768 } |
| 769 QuicSpdySession::SendRstStream(id, error, bytes_written); | 769 QuicSpdySession::SendRstStream(id, error, bytes_written); |
| 770 OnClosedStream(); | 770 OnClosedStream(); |
| 771 } | 771 } |
| 772 | 772 |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1232 NetLog::IntCallback("net_error", net_error)); | 1232 NetLog::IntCallback("net_error", net_error)); |
| 1233 | 1233 |
| 1234 if (connection()->connected()) | 1234 if (connection()->connected()) |
| 1235 connection()->CloseConnection(quic_error, "net error", | 1235 connection()->CloseConnection(quic_error, "net error", |
| 1236 ConnectionCloseBehavior::SILENT_CLOSE); | 1236 ConnectionCloseBehavior::SILENT_CLOSE); |
| 1237 DCHECK(!connection()->connected()); | 1237 DCHECK(!connection()->connected()); |
| 1238 } | 1238 } |
| 1239 | 1239 |
| 1240 void QuicChromiumClientSession::CloseAllStreams(int net_error) { | 1240 void QuicChromiumClientSession::CloseAllStreams(int net_error) { |
| 1241 while (!dynamic_streams().empty()) { | 1241 while (!dynamic_streams().empty()) { |
| 1242 ReliableQuicStream* stream = dynamic_streams().begin()->second.get(); | 1242 QuicStream* stream = dynamic_streams().begin()->second.get(); |
| 1243 QuicStreamId id = stream->id(); | 1243 QuicStreamId id = stream->id(); |
| 1244 static_cast<QuicChromiumClientStream*>(stream)->OnError(net_error); | 1244 static_cast<QuicChromiumClientStream*>(stream)->OnError(net_error); |
| 1245 CloseStream(id); | 1245 CloseStream(id); |
| 1246 } | 1246 } |
| 1247 } | 1247 } |
| 1248 | 1248 |
| 1249 void QuicChromiumClientSession::CloseAllObservers(int net_error) { | 1249 void QuicChromiumClientSession::CloseAllObservers(int net_error) { |
| 1250 while (!observers_.empty()) { | 1250 while (!observers_.empty()) { |
| 1251 Observer* observer = *observers_.begin(); | 1251 Observer* observer = *observers_.begin(); |
| 1252 observers_.erase(observer); | 1252 observers_.erase(observer); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1455 } | 1455 } |
| 1456 | 1456 |
| 1457 const LoadTimingInfo::ConnectTiming& | 1457 const LoadTimingInfo::ConnectTiming& |
| 1458 QuicChromiumClientSession::GetConnectTiming() { | 1458 QuicChromiumClientSession::GetConnectTiming() { |
| 1459 connect_timing_.ssl_start = connect_timing_.connect_start; | 1459 connect_timing_.ssl_start = connect_timing_.connect_start; |
| 1460 connect_timing_.ssl_end = connect_timing_.connect_end; | 1460 connect_timing_.ssl_end = connect_timing_.connect_end; |
| 1461 return connect_timing_; | 1461 return connect_timing_; |
| 1462 } | 1462 } |
| 1463 | 1463 |
| 1464 } // namespace net | 1464 } // namespace net |
| OLD | NEW |