| 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/reliable_quic_stream.h" | 5 #include "net/quic/reliable_quic_stream.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/quic/iovector.h" | 8 #include "net/quic/iovector.h" |
| 9 #include "net/quic/quic_flow_controller.h" | 9 #include "net/quic/quic_flow_controller.h" |
| 10 #include "net/quic/quic_session.h" | 10 #include "net/quic/quic_session.h" |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 // This count include duplicate data received. | 153 // This count include duplicate data received. |
| 154 stream_bytes_read_ += frame.data.TotalBufferSize(); | 154 stream_bytes_read_ += frame.data.TotalBufferSize(); |
| 155 | 155 |
| 156 bool accepted = sequencer_.OnStreamFrame(frame); | 156 bool accepted = sequencer_.OnStreamFrame(frame); |
| 157 | 157 |
| 158 if (flow_controller_.FlowControlViolation() || | 158 if (flow_controller_.FlowControlViolation() || |
| 159 connection_flow_controller_->FlowControlViolation()) { | 159 connection_flow_controller_->FlowControlViolation()) { |
| 160 session_->connection()->SendConnectionClose(QUIC_FLOW_CONTROL_ERROR); | 160 session_->connection()->SendConnectionClose(QUIC_FLOW_CONTROL_ERROR); |
| 161 return false; | 161 return false; |
| 162 } | 162 } |
| 163 MaybeSendWindowUpdate(); | |
| 164 | 163 |
| 165 return accepted; | 164 return accepted; |
| 166 } | 165 } |
| 167 | 166 |
| 168 void ReliableQuicStream::MaybeSendWindowUpdate() { | |
| 169 flow_controller_.MaybeSendWindowUpdate(session()->connection()); | |
| 170 connection_flow_controller_->MaybeSendWindowUpdate(session()->connection()); | |
| 171 } | |
| 172 | |
| 173 int ReliableQuicStream::num_frames_received() const { | 167 int ReliableQuicStream::num_frames_received() const { |
| 174 return sequencer_.num_frames_received(); | 168 return sequencer_.num_frames_received(); |
| 175 } | 169 } |
| 176 | 170 |
| 177 int ReliableQuicStream::num_duplicate_frames_received() const { | 171 int ReliableQuicStream::num_duplicate_frames_received() const { |
| 178 return sequencer_.num_duplicate_frames_received(); | 172 return sequencer_.num_duplicate_frames_received(); |
| 179 } | 173 } |
| 180 | 174 |
| 181 void ReliableQuicStream::OnStreamReset(const QuicRstStreamFrame& frame) { | 175 void ReliableQuicStream::OnStreamReset(const QuicRstStreamFrame& frame) { |
| 182 stream_error_ = frame.error_code; | 176 stream_error_ = frame.error_code; |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 void ReliableQuicStream::AddBytesSent(uint64 bytes) { | 447 void ReliableQuicStream::AddBytesSent(uint64 bytes) { |
| 454 if (flow_controller_.IsEnabled()) { | 448 if (flow_controller_.IsEnabled()) { |
| 455 flow_controller_.AddBytesSent(bytes); | 449 flow_controller_.AddBytesSent(bytes); |
| 456 connection_flow_controller_->AddBytesSent(bytes); | 450 connection_flow_controller_->AddBytesSent(bytes); |
| 457 } | 451 } |
| 458 } | 452 } |
| 459 | 453 |
| 460 void ReliableQuicStream::AddBytesConsumed(uint64 bytes) { | 454 void ReliableQuicStream::AddBytesConsumed(uint64 bytes) { |
| 461 if (flow_controller_.IsEnabled()) { | 455 if (flow_controller_.IsEnabled()) { |
| 462 flow_controller_.AddBytesConsumed(bytes); | 456 flow_controller_.AddBytesConsumed(bytes); |
| 457 flow_controller_.MaybeSendWindowUpdate(session()->connection()); |
| 458 |
| 463 connection_flow_controller_->AddBytesConsumed(bytes); | 459 connection_flow_controller_->AddBytesConsumed(bytes); |
| 460 connection_flow_controller_->MaybeSendWindowUpdate(session()->connection()); |
| 464 } | 461 } |
| 465 } | 462 } |
| 466 | 463 |
| 467 bool ReliableQuicStream::IsFlowControlBlocked() { | 464 bool ReliableQuicStream::IsFlowControlBlocked() { |
| 468 return flow_controller_.IsBlocked() || | 465 return flow_controller_.IsBlocked() || |
| 469 connection_flow_controller_->IsBlocked(); | 466 connection_flow_controller_->IsBlocked(); |
| 470 } | 467 } |
| 471 | 468 |
| 472 } // namespace net | 469 } // namespace net |
| OLD | NEW |