| 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 "base/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "net/quic/iovector.h" | 9 #include "net/quic/iovector.h" |
| 10 #include "net/quic/quic_flow_controller.h" | 10 #include "net/quic/quic_flow_controller.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 // WriteOrBufferData can use to inform it that the write required | 49 // WriteOrBufferData can use to inform it that the write required |
| 50 // multiple WritevData calls or that only part of the data has been | 50 // multiple WritevData calls or that only part of the data has been |
| 51 // sent out by the time ACKs start arriving. | 51 // sent out by the time ACKs start arriving. |
| 52 class ReliableQuicStream::ProxyAckNotifierDelegate | 52 class ReliableQuicStream::ProxyAckNotifierDelegate |
| 53 : public QuicAckNotifier::DelegateInterface { | 53 : public QuicAckNotifier::DelegateInterface { |
| 54 public: | 54 public: |
| 55 explicit ProxyAckNotifierDelegate(DelegateInterface* delegate) | 55 explicit ProxyAckNotifierDelegate(DelegateInterface* delegate) |
| 56 : delegate_(delegate), | 56 : delegate_(delegate), |
| 57 pending_acks_(0), | 57 pending_acks_(0), |
| 58 wrote_last_data_(false), | 58 wrote_last_data_(false), |
| 59 num_original_packets_(0), | |
| 60 num_original_bytes_(0), | |
| 61 num_retransmitted_packets_(0), | 59 num_retransmitted_packets_(0), |
| 62 num_retransmitted_bytes_(0) { | 60 num_retransmitted_bytes_(0) { |
| 63 } | 61 } |
| 64 | 62 |
| 65 void OnAckNotification(int num_original_packets, | 63 void OnAckNotification(int num_retransmitted_packets, |
| 66 int num_original_bytes, | |
| 67 int num_retransmitted_packets, | |
| 68 int num_retransmitted_bytes, | 64 int num_retransmitted_bytes, |
| 69 QuicTime::Delta delta_largest_observed) override { | 65 QuicTime::Delta delta_largest_observed) override { |
| 70 DCHECK_LT(0, pending_acks_); | 66 DCHECK_LT(0, pending_acks_); |
| 71 --pending_acks_; | 67 --pending_acks_; |
| 72 num_original_packets_ += num_original_packets; | |
| 73 num_original_bytes_ += num_original_bytes; | |
| 74 num_retransmitted_packets_ += num_retransmitted_packets; | 68 num_retransmitted_packets_ += num_retransmitted_packets; |
| 75 num_retransmitted_bytes_ += num_retransmitted_bytes; | 69 num_retransmitted_bytes_ += num_retransmitted_bytes; |
| 76 | 70 |
| 77 if (wrote_last_data_ && pending_acks_ == 0) { | 71 if (wrote_last_data_ && pending_acks_ == 0) { |
| 78 delegate_->OnAckNotification(num_original_packets_, | 72 delegate_->OnAckNotification(num_retransmitted_packets_, |
| 79 num_original_bytes_, | |
| 80 num_retransmitted_packets_, | |
| 81 num_retransmitted_bytes_, | 73 num_retransmitted_bytes_, |
| 82 delta_largest_observed); | 74 delta_largest_observed); |
| 83 } | 75 } |
| 84 } | 76 } |
| 85 | 77 |
| 86 void WroteData(bool last_data) { | 78 void WroteData(bool last_data) { |
| 87 DCHECK(!wrote_last_data_); | 79 DCHECK(!wrote_last_data_); |
| 88 ++pending_acks_; | 80 ++pending_acks_; |
| 89 wrote_last_data_ = last_data; | 81 wrote_last_data_ = last_data; |
| 90 } | 82 } |
| (...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 528 | 520 |
| 529 bool ReliableQuicStream::IsFlowControlBlocked() { | 521 bool ReliableQuicStream::IsFlowControlBlocked() { |
| 530 if (flow_controller_.IsBlocked()) { | 522 if (flow_controller_.IsBlocked()) { |
| 531 return true; | 523 return true; |
| 532 } | 524 } |
| 533 return stream_contributes_to_connection_flow_control_ && | 525 return stream_contributes_to_connection_flow_control_ && |
| 534 connection_flow_controller_->IsBlocked(); | 526 connection_flow_controller_->IsBlocked(); |
| 535 } | 527 } |
| 536 | 528 |
| 537 } // namespace net | 529 } // namespace net |
| OLD | NEW |