| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_flow_controller.h" | 5 #include "net/quic/quic_flow_controller.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "net/quic/quic_connection.h" | 8 #include "net/quic/quic_connection.h" |
| 9 #include "net/quic/quic_flags.h" | 9 #include "net/quic/quic_flags.h" |
| 10 #include "net/quic/quic_protocol.h" | 10 #include "net/quic/quic_protocol.h" |
| 11 | 11 |
| 12 namespace net { | 12 namespace net { |
| 13 | 13 |
| 14 #define ENDPOINT (is_server_ ? "Server: " : " Client: ") | 14 #define ENDPOINT \ |
| 15 (perspective_ == Perspective::IS_SERVER ? "Server: " : "Client: ") |
| 15 | 16 |
| 16 QuicFlowController::QuicFlowController(QuicConnection* connection, | 17 QuicFlowController::QuicFlowController(QuicConnection* connection, |
| 17 QuicStreamId id, | 18 QuicStreamId id, |
| 18 bool is_server, | 19 Perspective perspective, |
| 19 QuicStreamOffset send_window_offset, | 20 QuicStreamOffset send_window_offset, |
| 20 QuicStreamOffset receive_window_offset, | 21 QuicStreamOffset receive_window_offset, |
| 21 QuicByteCount max_receive_window) | 22 QuicByteCount max_receive_window) |
| 22 : connection_(connection), | 23 : connection_(connection), |
| 23 id_(id), | 24 id_(id), |
| 24 is_server_(is_server), | 25 perspective_(perspective), |
| 25 bytes_consumed_(0), | 26 bytes_consumed_(0), |
| 26 highest_received_byte_offset_(0), | 27 highest_received_byte_offset_(0), |
| 27 bytes_sent_(0), | 28 bytes_sent_(0), |
| 28 send_window_offset_(send_window_offset), | 29 send_window_offset_(send_window_offset), |
| 29 receive_window_offset_(receive_window_offset), | 30 receive_window_offset_(receive_window_offset), |
| 30 max_receive_window_(max_receive_window), | 31 max_receive_window_(max_receive_window), |
| 31 last_blocked_send_window_offset_(0) { | 32 last_blocked_send_window_offset_(0) { |
| 32 DVLOG(1) << ENDPOINT << "Created flow controller for stream " << id_ | 33 DVLOG(1) << ENDPOINT << "Created flow controller for stream " << id_ |
| 33 << ", setting initial receive window offset to: " | 34 << ", setting initial receive window offset to: " |
| 34 << receive_window_offset_ | 35 << receive_window_offset_ |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 } | 150 } |
| 150 | 151 |
| 151 uint64 QuicFlowController::SendWindowSize() const { | 152 uint64 QuicFlowController::SendWindowSize() const { |
| 152 if (bytes_sent_ > send_window_offset_) { | 153 if (bytes_sent_ > send_window_offset_) { |
| 153 return 0; | 154 return 0; |
| 154 } | 155 } |
| 155 return send_window_offset_ - bytes_sent_; | 156 return send_window_offset_ - bytes_sent_; |
| 156 } | 157 } |
| 157 | 158 |
| 158 } // namespace net | 159 } // namespace net |
| OLD | NEW |