Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(842)

Side by Side Diff: net/quic/core/quic_stream.cc

Issue 2480183002: Rename ReliableQuicStream to QuicStream. No behavior change, not protected. (Closed)
Patch Set: add missing files Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/core/quic_stream.h ('k') | net/quic/core/quic_stream_sequencer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/core/reliable_quic_stream.h" 5 #include "net/quic/core/quic_stream.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "net/quic/core/quic_bug_tracker.h" 8 #include "net/quic/core/quic_bug_tracker.h"
9 #include "net/quic/core/quic_flags.h" 9 #include "net/quic/core/quic_flags.h"
10 #include "net/quic/core/quic_flow_controller.h" 10 #include "net/quic/core/quic_flow_controller.h"
11 #include "net/quic/core/quic_session.h" 11 #include "net/quic/core/quic_session.h"
12 #include "net/quic/core/quic_write_blocked_list.h" 12 #include "net/quic/core/quic_write_blocked_list.h"
13 13
14 using base::StringPiece; 14 using base::StringPiece;
15 using std::min; 15 using std::min;
(...skipping 19 matching lines...) Expand all
35 size_t GetReceivedFlowControlWindow(QuicSession* session) { 35 size_t GetReceivedFlowControlWindow(QuicSession* session) {
36 if (session->config()->HasReceivedInitialStreamFlowControlWindowBytes()) { 36 if (session->config()->HasReceivedInitialStreamFlowControlWindowBytes()) {
37 return session->config()->ReceivedInitialStreamFlowControlWindowBytes(); 37 return session->config()->ReceivedInitialStreamFlowControlWindowBytes();
38 } 38 }
39 39
40 return kMinimumFlowControlSendWindow; 40 return kMinimumFlowControlSendWindow;
41 } 41 }
42 42
43 } // namespace 43 } // namespace
44 44
45 ReliableQuicStream::PendingData::PendingData( 45 QuicStream::PendingData::PendingData(string data_in,
46 string data_in, 46 QuicAckListenerInterface* ack_listener_in)
47 QuicAckListenerInterface* ack_listener_in)
48 : data(std::move(data_in)), offset(0), ack_listener(ack_listener_in) {} 47 : data(std::move(data_in)), offset(0), ack_listener(ack_listener_in) {}
49 48
50 ReliableQuicStream::PendingData::~PendingData() {} 49 QuicStream::PendingData::~PendingData() {}
51 50
52 ReliableQuicStream::ReliableQuicStream(QuicStreamId id, QuicSession* session) 51 QuicStream::QuicStream(QuicStreamId id, QuicSession* session)
53 : queued_data_bytes_(0), 52 : queued_data_bytes_(0),
54 sequencer_(this, session->connection()->clock()), 53 sequencer_(this, session->connection()->clock()),
55 id_(id), 54 id_(id),
56 session_(session), 55 session_(session),
57 stream_bytes_read_(0), 56 stream_bytes_read_(0),
58 stream_bytes_written_(0), 57 stream_bytes_written_(0),
59 stream_error_(QUIC_STREAM_NO_ERROR), 58 stream_error_(QUIC_STREAM_NO_ERROR),
60 connection_error_(QUIC_NO_ERROR), 59 connection_error_(QUIC_NO_ERROR),
61 read_side_closed_(false), 60 read_side_closed_(false),
62 write_side_closed_(false), 61 write_side_closed_(false),
63 fin_buffered_(false), 62 fin_buffered_(false),
64 fin_sent_(false), 63 fin_sent_(false),
65 fin_received_(false), 64 fin_received_(false),
66 rst_sent_(false), 65 rst_sent_(false),
67 rst_received_(false), 66 rst_received_(false),
68 perspective_(session_->perspective()), 67 perspective_(session_->perspective()),
69 flow_controller_(session_->connection(), 68 flow_controller_(session_->connection(),
70 id_, 69 id_,
71 perspective_, 70 perspective_,
72 GetReceivedFlowControlWindow(session), 71 GetReceivedFlowControlWindow(session),
73 GetInitialStreamFlowControlWindowToSend(session), 72 GetInitialStreamFlowControlWindowToSend(session),
74 session_->flow_controller()->auto_tune_receive_window()), 73 session_->flow_controller()->auto_tune_receive_window()),
75 connection_flow_controller_(session_->flow_controller()), 74 connection_flow_controller_(session_->flow_controller()),
76 stream_contributes_to_connection_flow_control_(true), 75 stream_contributes_to_connection_flow_control_(true),
77 busy_counter_(0) { 76 busy_counter_(0) {
78 SetFromConfig(); 77 SetFromConfig();
79 } 78 }
80 79
81 ReliableQuicStream::~ReliableQuicStream() {} 80 QuicStream::~QuicStream() {}
82 81
83 void ReliableQuicStream::SetFromConfig() {} 82 void QuicStream::SetFromConfig() {}
84 83
85 void ReliableQuicStream::OnStreamFrame(const QuicStreamFrame& frame) { 84 void QuicStream::OnStreamFrame(const QuicStreamFrame& frame) {
86 DCHECK_EQ(frame.stream_id, id_); 85 DCHECK_EQ(frame.stream_id, id_);
87 86
88 DCHECK(!(read_side_closed_ && write_side_closed_)); 87 DCHECK(!(read_side_closed_ && write_side_closed_));
89 88
90 if (frame.fin) { 89 if (frame.fin) {
91 fin_received_ = true; 90 fin_received_ = true;
92 if (fin_sent_) { 91 if (fin_sent_) {
93 session_->StreamDraining(id_); 92 session_->StreamDraining(id_);
94 } 93 }
95 } 94 }
(...skipping 20 matching lines...) Expand all
116 CloseConnectionWithDetails( 115 CloseConnectionWithDetails(
117 QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA, 116 QUIC_FLOW_CONTROL_RECEIVED_TOO_MUCH_DATA,
118 "Flow control violation after increasing offset"); 117 "Flow control violation after increasing offset");
119 return; 118 return;
120 } 119 }
121 } 120 }
122 121
123 sequencer_.OnStreamFrame(frame); 122 sequencer_.OnStreamFrame(frame);
124 } 123 }
125 124
126 int ReliableQuicStream::num_frames_received() const { 125 int QuicStream::num_frames_received() const {
127 return sequencer_.num_frames_received(); 126 return sequencer_.num_frames_received();
128 } 127 }
129 128
130 int ReliableQuicStream::num_duplicate_frames_received() const { 129 int QuicStream::num_duplicate_frames_received() const {
131 return sequencer_.num_duplicate_frames_received(); 130 return sequencer_.num_duplicate_frames_received();
132 } 131 }
133 132
134 void ReliableQuicStream::OnStreamReset(const QuicRstStreamFrame& frame) { 133 void QuicStream::OnStreamReset(const QuicRstStreamFrame& frame) {
135 rst_received_ = true; 134 rst_received_ = true;
136 MaybeIncreaseHighestReceivedOffset(frame.byte_offset); 135 MaybeIncreaseHighestReceivedOffset(frame.byte_offset);
137 136
138 stream_error_ = frame.error_code; 137 stream_error_ = frame.error_code;
139 CloseWriteSide(); 138 CloseWriteSide();
140 CloseReadSide(); 139 CloseReadSide();
141 } 140 }
142 141
143 void ReliableQuicStream::OnConnectionClosed(QuicErrorCode error, 142 void QuicStream::OnConnectionClosed(QuicErrorCode error,
144 ConnectionCloseSource /*source*/) { 143 ConnectionCloseSource /*source*/) {
145 if (read_side_closed_ && write_side_closed_) { 144 if (read_side_closed_ && write_side_closed_) {
146 return; 145 return;
147 } 146 }
148 if (error != QUIC_NO_ERROR) { 147 if (error != QUIC_NO_ERROR) {
149 stream_error_ = QUIC_STREAM_CONNECTION_ERROR; 148 stream_error_ = QUIC_STREAM_CONNECTION_ERROR;
150 connection_error_ = error; 149 connection_error_ = error;
151 } 150 }
152 151
153 CloseWriteSide(); 152 CloseWriteSide();
154 CloseReadSide(); 153 CloseReadSide();
155 } 154 }
156 155
157 void ReliableQuicStream::OnFinRead() { 156 void QuicStream::OnFinRead() {
158 DCHECK(sequencer_.IsClosed()); 157 DCHECK(sequencer_.IsClosed());
159 // OnFinRead can be called due to a FIN flag in a headers block, so there may 158 // OnFinRead can be called due to a FIN flag in a headers block, so there may
160 // have been no OnStreamFrame call with a FIN in the frame. 159 // have been no OnStreamFrame call with a FIN in the frame.
161 fin_received_ = true; 160 fin_received_ = true;
162 // If fin_sent_ is true, then CloseWriteSide has already been called, and the 161 // If fin_sent_ is true, then CloseWriteSide has already been called, and the
163 // stream will be destroyed by CloseReadSide, so don't need to call 162 // stream will be destroyed by CloseReadSide, so don't need to call
164 // StreamDraining. 163 // StreamDraining.
165 CloseReadSide(); 164 CloseReadSide();
166 } 165 }
167 166
168 void ReliableQuicStream::Reset(QuicRstStreamErrorCode error) { 167 void QuicStream::Reset(QuicRstStreamErrorCode error) {
169 stream_error_ = error; 168 stream_error_ = error;
170 // Sending a RstStream results in calling CloseStream. 169 // Sending a RstStream results in calling CloseStream.
171 session()->SendRstStream(id(), error, stream_bytes_written_); 170 session()->SendRstStream(id(), error, stream_bytes_written_);
172 rst_sent_ = true; 171 rst_sent_ = true;
173 } 172 }
174 173
175 void ReliableQuicStream::CloseConnectionWithDetails(QuicErrorCode error, 174 void QuicStream::CloseConnectionWithDetails(QuicErrorCode error,
176 const string& details) { 175 const string& details) {
177 session()->connection()->CloseConnection( 176 session()->connection()->CloseConnection(
178 error, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); 177 error, details, ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
179 } 178 }
180 179
181 void ReliableQuicStream::WriteOrBufferData( 180 void QuicStream::WriteOrBufferData(StringPiece data,
182 StringPiece data, 181 bool fin,
183 bool fin, 182 QuicAckListenerInterface* ack_listener) {
184 QuicAckListenerInterface* ack_listener) {
185 if (data.empty() && !fin) { 183 if (data.empty() && !fin) {
186 QUIC_BUG << "data.empty() && !fin"; 184 QUIC_BUG << "data.empty() && !fin";
187 return; 185 return;
188 } 186 }
189 187
190 if (fin_buffered_) { 188 if (fin_buffered_) {
191 QUIC_BUG << "Fin already buffered"; 189 QUIC_BUG << "Fin already buffered";
192 return; 190 return;
193 } 191 }
194 if (write_side_closed_) { 192 if (write_side_closed_) {
(...skipping 12 matching lines...) Expand all
207 205
208 // If there's unconsumed data or an unconsumed fin, queue it. 206 // If there's unconsumed data or an unconsumed fin, queue it.
209 if (consumed_data.bytes_consumed < data.length() || 207 if (consumed_data.bytes_consumed < data.length() ||
210 (fin && !consumed_data.fin_consumed)) { 208 (fin && !consumed_data.fin_consumed)) {
211 StringPiece remainder(data.substr(consumed_data.bytes_consumed)); 209 StringPiece remainder(data.substr(consumed_data.bytes_consumed));
212 queued_data_bytes_ += remainder.size(); 210 queued_data_bytes_ += remainder.size();
213 queued_data_.emplace_back(remainder.as_string(), ack_listener); 211 queued_data_.emplace_back(remainder.as_string(), ack_listener);
214 } 212 }
215 } 213 }
216 214
217 void ReliableQuicStream::OnCanWrite() { 215 void QuicStream::OnCanWrite() {
218 bool fin = false; 216 bool fin = false;
219 while (!queued_data_.empty()) { 217 while (!queued_data_.empty()) {
220 PendingData* pending_data = &queued_data_.front(); 218 PendingData* pending_data = &queued_data_.front();
221 QuicAckListenerInterface* ack_listener = pending_data->ack_listener.get(); 219 QuicAckListenerInterface* ack_listener = pending_data->ack_listener.get();
222 if (queued_data_.size() == 1 && fin_buffered_) { 220 if (queued_data_.size() == 1 && fin_buffered_) {
223 fin = true; 221 fin = true;
224 } 222 }
225 if (pending_data->offset > 0 && 223 if (pending_data->offset > 0 &&
226 pending_data->offset >= pending_data->data.size()) { 224 pending_data->offset >= pending_data->data.size()) {
227 // This should be impossible because offset tracks the amount of 225 // This should be impossible because offset tracks the amount of
(...skipping 13 matching lines...) Expand all
241 queued_data_.pop_front(); 239 queued_data_.pop_front();
242 } else { 240 } else {
243 if (consumed_data.bytes_consumed > 0) { 241 if (consumed_data.bytes_consumed > 0) {
244 pending_data->offset += consumed_data.bytes_consumed; 242 pending_data->offset += consumed_data.bytes_consumed;
245 } 243 }
246 break; 244 break;
247 } 245 }
248 } 246 }
249 } 247 }
250 248
251 void ReliableQuicStream::MaybeSendBlocked() { 249 void QuicStream::MaybeSendBlocked() {
252 flow_controller_.MaybeSendBlocked(); 250 flow_controller_.MaybeSendBlocked();
253 if (!stream_contributes_to_connection_flow_control_) { 251 if (!stream_contributes_to_connection_flow_control_) {
254 return; 252 return;
255 } 253 }
256 connection_flow_controller_->MaybeSendBlocked(); 254 connection_flow_controller_->MaybeSendBlocked();
257 // If the stream is blocked by connection-level flow control but not by 255 // If the stream is blocked by connection-level flow control but not by
258 // stream-level flow control, add the stream to the write blocked list so that 256 // stream-level flow control, add the stream to the write blocked list so that
259 // the stream will be given a chance to write when a connection-level 257 // the stream will be given a chance to write when a connection-level
260 // WINDOW_UPDATE arrives. 258 // WINDOW_UPDATE arrives.
261 if (connection_flow_controller_->IsBlocked() && 259 if (connection_flow_controller_->IsBlocked() &&
262 !flow_controller_.IsBlocked()) { 260 !flow_controller_.IsBlocked()) {
263 session_->MarkConnectionLevelWriteBlocked(id()); 261 session_->MarkConnectionLevelWriteBlocked(id());
264 } 262 }
265 } 263 }
266 264
267 QuicConsumedData ReliableQuicStream::WritevData( 265 QuicConsumedData QuicStream::WritevData(
268 const struct iovec* iov, 266 const struct iovec* iov,
269 int iov_count, 267 int iov_count,
270 bool fin, 268 bool fin,
271 QuicAckListenerInterface* ack_listener) { 269 QuicAckListenerInterface* ack_listener) {
272 if (write_side_closed_) { 270 if (write_side_closed_) {
273 DLOG(ERROR) << ENDPOINT << "Attempt to write when the write side is closed"; 271 DLOG(ERROR) << ENDPOINT << "Attempt to write when the write side is closed";
274 return QuicConsumedData(0, false); 272 return QuicConsumedData(0, false);
275 } 273 }
276 274
277 // How much data was provided. 275 // How much data was provided.
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 CloseWriteSide(); 336 CloseWriteSide();
339 } else if (fin && !consumed_data.fin_consumed) { 337 } else if (fin && !consumed_data.fin_consumed) {
340 session_->MarkConnectionLevelWriteBlocked(id()); 338 session_->MarkConnectionLevelWriteBlocked(id());
341 } 339 }
342 } else { 340 } else {
343 session_->MarkConnectionLevelWriteBlocked(id()); 341 session_->MarkConnectionLevelWriteBlocked(id());
344 } 342 }
345 return consumed_data; 343 return consumed_data;
346 } 344 }
347 345
348 QuicConsumedData ReliableQuicStream::WritevDataInner( 346 QuicConsumedData QuicStream::WritevDataInner(
349 QuicIOVector iov, 347 QuicIOVector iov,
350 QuicStreamOffset offset, 348 QuicStreamOffset offset,
351 bool fin, 349 bool fin,
352 QuicAckListenerInterface* ack_notifier_delegate) { 350 QuicAckListenerInterface* ack_notifier_delegate) {
353 return session()->WritevData(this, id(), iov, offset, fin, 351 return session()->WritevData(this, id(), iov, offset, fin,
354 ack_notifier_delegate); 352 ack_notifier_delegate);
355 } 353 }
356 354
357 void ReliableQuicStream::CloseReadSide() { 355 void QuicStream::CloseReadSide() {
358 if (read_side_closed_) { 356 if (read_side_closed_) {
359 return; 357 return;
360 } 358 }
361 DVLOG(1) << ENDPOINT << "Done reading from stream " << id(); 359 DVLOG(1) << ENDPOINT << "Done reading from stream " << id();
362 360
363 read_side_closed_ = true; 361 read_side_closed_ = true;
364 sequencer_.ReleaseBuffer(); 362 sequencer_.ReleaseBuffer();
365 363
366 if (write_side_closed_) { 364 if (write_side_closed_) {
367 DVLOG(1) << ENDPOINT << "Closing stream: " << id(); 365 DVLOG(1) << ENDPOINT << "Closing stream: " << id();
368 session_->CloseStream(id()); 366 session_->CloseStream(id());
369 } 367 }
370 } 368 }
371 369
372 void ReliableQuicStream::CloseWriteSide() { 370 void QuicStream::CloseWriteSide() {
373 if (write_side_closed_) { 371 if (write_side_closed_) {
374 return; 372 return;
375 } 373 }
376 DVLOG(1) << ENDPOINT << "Done writing to stream " << id(); 374 DVLOG(1) << ENDPOINT << "Done writing to stream " << id();
377 375
378 write_side_closed_ = true; 376 write_side_closed_ = true;
379 if (read_side_closed_) { 377 if (read_side_closed_) {
380 DVLOG(1) << ENDPOINT << "Closing stream: " << id(); 378 DVLOG(1) << ENDPOINT << "Closing stream: " << id();
381 session_->CloseStream(id()); 379 session_->CloseStream(id());
382 } 380 }
383 } 381 }
384 382
385 bool ReliableQuicStream::HasBufferedData() const { 383 bool QuicStream::HasBufferedData() const {
386 return !queued_data_.empty(); 384 return !queued_data_.empty();
387 } 385 }
388 386
389 QuicVersion ReliableQuicStream::version() const { 387 QuicVersion QuicStream::version() const {
390 return session_->connection()->version(); 388 return session_->connection()->version();
391 } 389 }
392 390
393 void ReliableQuicStream::StopReading() { 391 void QuicStream::StopReading() {
394 DVLOG(1) << ENDPOINT << "Stop reading from stream " << id(); 392 DVLOG(1) << ENDPOINT << "Stop reading from stream " << id();
395 sequencer_.StopReading(); 393 sequencer_.StopReading();
396 } 394 }
397 395
398 const IPEndPoint& ReliableQuicStream::PeerAddressOfLatestPacket() const { 396 const IPEndPoint& QuicStream::PeerAddressOfLatestPacket() const {
399 return session_->connection()->last_packet_source_address(); 397 return session_->connection()->last_packet_source_address();
400 } 398 }
401 399
402 void ReliableQuicStream::OnClose() { 400 void QuicStream::OnClose() {
403 CloseReadSide(); 401 CloseReadSide();
404 CloseWriteSide(); 402 CloseWriteSide();
405 403
406 if (!fin_sent_ && !rst_sent_) { 404 if (!fin_sent_ && !rst_sent_) {
407 // For flow control accounting, tell the peer how many bytes have been 405 // For flow control accounting, tell the peer how many bytes have been
408 // written on this stream before termination. Done here if needed, using a 406 // written on this stream before termination. Done here if needed, using a
409 // RST_STREAM frame. 407 // RST_STREAM frame.
410 DVLOG(1) << ENDPOINT << "Sending RST_STREAM in OnClose: " << id(); 408 DVLOG(1) << ENDPOINT << "Sending RST_STREAM in OnClose: " << id();
411 session_->SendRstStream(id(), QUIC_RST_ACKNOWLEDGEMENT, 409 session_->SendRstStream(id(), QUIC_RST_ACKNOWLEDGEMENT,
412 stream_bytes_written_); 410 stream_bytes_written_);
413 rst_sent_ = true; 411 rst_sent_ = true;
414 } 412 }
415 413
416 // The stream is being closed and will not process any further incoming bytes. 414 // The stream is being closed and will not process any further incoming bytes.
417 // As there may be more bytes in flight, to ensure that both endpoints have 415 // As there may be more bytes in flight, to ensure that both endpoints have
418 // the same connection level flow control state, mark all unreceived or 416 // the same connection level flow control state, mark all unreceived or
419 // buffered bytes as consumed. 417 // buffered bytes as consumed.
420 QuicByteCount bytes_to_consume = 418 QuicByteCount bytes_to_consume =
421 flow_controller_.highest_received_byte_offset() - 419 flow_controller_.highest_received_byte_offset() -
422 flow_controller_.bytes_consumed(); 420 flow_controller_.bytes_consumed();
423 AddBytesConsumed(bytes_to_consume); 421 AddBytesConsumed(bytes_to_consume);
424 } 422 }
425 423
426 void ReliableQuicStream::OnWindowUpdateFrame( 424 void QuicStream::OnWindowUpdateFrame(const QuicWindowUpdateFrame& frame) {
427 const QuicWindowUpdateFrame& frame) {
428 if (flow_controller_.UpdateSendWindowOffset(frame.byte_offset)) { 425 if (flow_controller_.UpdateSendWindowOffset(frame.byte_offset)) {
429 // Writing can be done again! 426 // Writing can be done again!
430 // TODO(rjshade): This does not respect priorities (e.g. multiple 427 // TODO(rjshade): This does not respect priorities (e.g. multiple
431 // outstanding POSTs are unblocked on arrival of 428 // outstanding POSTs are unblocked on arrival of
432 // SHLO with initial window). 429 // SHLO with initial window).
433 // As long as the connection is not flow control blocked, write on! 430 // As long as the connection is not flow control blocked, write on!
434 OnCanWrite(); 431 OnCanWrite();
435 } 432 }
436 } 433 }
437 434
438 bool ReliableQuicStream::MaybeIncreaseHighestReceivedOffset( 435 bool QuicStream::MaybeIncreaseHighestReceivedOffset(
439 QuicStreamOffset new_offset) { 436 QuicStreamOffset new_offset) {
440 uint64_t increment = 437 uint64_t increment =
441 new_offset - flow_controller_.highest_received_byte_offset(); 438 new_offset - flow_controller_.highest_received_byte_offset();
442 if (!flow_controller_.UpdateHighestReceivedOffset(new_offset)) { 439 if (!flow_controller_.UpdateHighestReceivedOffset(new_offset)) {
443 return false; 440 return false;
444 } 441 }
445 442
446 // If |new_offset| increased the stream flow controller's highest received 443 // If |new_offset| increased the stream flow controller's highest received
447 // offset, increase the connection flow controller's value by the incremental 444 // offset, increase the connection flow controller's value by the incremental
448 // difference. 445 // difference.
449 if (stream_contributes_to_connection_flow_control_) { 446 if (stream_contributes_to_connection_flow_control_) {
450 connection_flow_controller_->UpdateHighestReceivedOffset( 447 connection_flow_controller_->UpdateHighestReceivedOffset(
451 connection_flow_controller_->highest_received_byte_offset() + 448 connection_flow_controller_->highest_received_byte_offset() +
452 increment); 449 increment);
453 } 450 }
454 return true; 451 return true;
455 } 452 }
456 453
457 void ReliableQuicStream::AddBytesSent(QuicByteCount bytes) { 454 void QuicStream::AddBytesSent(QuicByteCount bytes) {
458 flow_controller_.AddBytesSent(bytes); 455 flow_controller_.AddBytesSent(bytes);
459 if (stream_contributes_to_connection_flow_control_) { 456 if (stream_contributes_to_connection_flow_control_) {
460 connection_flow_controller_->AddBytesSent(bytes); 457 connection_flow_controller_->AddBytesSent(bytes);
461 } 458 }
462 } 459 }
463 460
464 void ReliableQuicStream::AddBytesConsumed(QuicByteCount bytes) { 461 void QuicStream::AddBytesConsumed(QuicByteCount bytes) {
465 // Only adjust stream level flow controller if still reading. 462 // Only adjust stream level flow controller if still reading.
466 if (!read_side_closed_) { 463 if (!read_side_closed_) {
467 flow_controller_.AddBytesConsumed(bytes); 464 flow_controller_.AddBytesConsumed(bytes);
468 } 465 }
469 466
470 if (stream_contributes_to_connection_flow_control_) { 467 if (stream_contributes_to_connection_flow_control_) {
471 connection_flow_controller_->AddBytesConsumed(bytes); 468 connection_flow_controller_->AddBytesConsumed(bytes);
472 } 469 }
473 } 470 }
474 471
475 void ReliableQuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) { 472 void QuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) {
476 if (flow_controller_.UpdateSendWindowOffset(new_window)) { 473 if (flow_controller_.UpdateSendWindowOffset(new_window)) {
477 OnCanWrite(); 474 OnCanWrite();
478 } 475 }
479 } 476 }
480 477
481 } // namespace net 478 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/core/quic_stream.h ('k') | net/quic/core/quic_stream_sequencer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698