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

Side by Side Diff: net/quic/quic_session.cc

Issue 1472563002: Let QUIC streams write 16k before ceding. Behind FLAG_quic_batch_writes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@107581674
Patch Set: Created 5 years 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/quic_flags.cc ('k') | net/quic/quic_session_test.cc » ('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/quic_session.h" 5 #include "net/quic/quic_session.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "net/quic/crypto/proof_verifier.h" 8 #include "net/quic/crypto/proof_verifier.h"
9 #include "net/quic/quic_connection.h" 9 #include "net/quic/quic_connection.h"
10 #include "net/quic/quic_flags.h" 10 #include "net/quic/quic_flags.h"
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 } 256 }
257 if (!connection_->CanWriteStreamData()) { 257 if (!connection_->CanWriteStreamData()) {
258 return; 258 return;
259 } 259 }
260 QuicStreamId stream_id = write_blocked_streams_.PopFront(); 260 QuicStreamId stream_id = write_blocked_streams_.PopFront();
261 if (stream_id == kCryptoStreamId) { 261 if (stream_id == kCryptoStreamId) {
262 has_pending_handshake_ = false; // We just popped it. 262 has_pending_handshake_ = false; // We just popped it.
263 } 263 }
264 ReliableQuicStream* stream = GetStream(stream_id); 264 ReliableQuicStream* stream = GetStream(stream_id);
265 if (stream != nullptr && !stream->flow_controller()->IsBlocked()) { 265 if (stream != nullptr && !stream->flow_controller()->IsBlocked()) {
266 // If the stream can't write all bytes, it'll re-add itself to the blocked 266 // If the stream can't write all bytes it'll re-add itself to the blocked
267 // list. 267 // list.
268 stream->OnCanWrite(); 268 stream->OnCanWrite();
269 } 269 }
270 } 270 }
271 } 271 }
272 272
273 bool QuicSession::WillingAndAbleToWrite() const { 273 bool QuicSession::WillingAndAbleToWrite() const {
274 // If the crypto or headers streams are blocked, we want to schedule a write - 274 // If the crypto or headers streams are blocked, we want to schedule a write -
275 // they don't get blocked by connection level flow control. Otherwise only 275 // they don't get blocked by connection level flow control. Otherwise only
276 // schedule a write if we are not flow control blocked at the connection 276 // schedule a write if we are not flow control blocked at the connection
(...skipping 11 matching lines...) Expand all
288 return GetNumOpenStreams() > 0; 288 return GetNumOpenStreams() > 0;
289 } 289 }
290 290
291 QuicConsumedData QuicSession::WritevData( 291 QuicConsumedData QuicSession::WritevData(
292 QuicStreamId id, 292 QuicStreamId id,
293 QuicIOVector iov, 293 QuicIOVector iov,
294 QuicStreamOffset offset, 294 QuicStreamOffset offset,
295 bool fin, 295 bool fin,
296 FecProtection fec_protection, 296 FecProtection fec_protection,
297 QuicAckListenerInterface* ack_notifier_delegate) { 297 QuicAckListenerInterface* ack_notifier_delegate) {
298 return connection_->SendStreamData(id, iov, offset, fin, fec_protection, 298 QuicConsumedData data =
299 ack_notifier_delegate); 299 connection_->SendStreamData(id, iov, offset, fin, fec_protection,
300 ack_notifier_delegate);
301 write_blocked_streams_.UpdateBytesForStream(id, data.bytes_consumed);
302 return data;
300 } 303 }
301 304
302 void QuicSession::SendRstStream(QuicStreamId id, 305 void QuicSession::SendRstStream(QuicStreamId id,
303 QuicRstStreamErrorCode error, 306 QuicRstStreamErrorCode error,
304 QuicStreamOffset bytes_written) { 307 QuicStreamOffset bytes_written) {
305 if (ContainsKey(static_stream_map_, id)) { 308 if (ContainsKey(static_stream_map_, id)) {
306 LOG(DFATAL) << "Cannot send RST for a static stream with ID " << id; 309 LOG(DFATAL) << "Cannot send RST for a static stream with ID " << id;
307 return; 310 return;
308 } 311 }
309 312
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after
745 #endif 748 #endif
746 749
747 if (id == kCryptoStreamId) { 750 if (id == kCryptoStreamId) {
748 DCHECK(!has_pending_handshake_); 751 DCHECK(!has_pending_handshake_);
749 has_pending_handshake_ = true; 752 has_pending_handshake_ = true;
750 // TODO(jar): Be sure to use the highest priority for the crypto stream, 753 // TODO(jar): Be sure to use the highest priority for the crypto stream,
751 // perhaps by adding a "special" priority for it that is higher than 754 // perhaps by adding a "special" priority for it that is higher than
752 // kHighestPriority. 755 // kHighestPriority.
753 priority = kHighestPriority; 756 priority = kHighestPriority;
754 } 757 }
755 write_blocked_streams_.PushBack(id, priority); 758 write_blocked_streams_.AddStream(id, priority);
756 } 759 }
757 760
758 bool QuicSession::HasDataToWrite() const { 761 bool QuicSession::HasDataToWrite() const {
759 return write_blocked_streams_.HasWriteBlockedCryptoOrHeadersStream() || 762 return write_blocked_streams_.HasWriteBlockedCryptoOrHeadersStream() ||
760 write_blocked_streams_.HasWriteBlockedDataStreams() || 763 write_blocked_streams_.HasWriteBlockedDataStreams() ||
761 connection_->HasQueuedData(); 764 connection_->HasQueuedData();
762 } 765 }
763 766
764 void QuicSession::PostProcessAfterData() { 767 void QuicSession::PostProcessAfterData() {
765 STLDeleteElements(&closed_streams_); 768 STLDeleteElements(&closed_streams_);
(...skipping 12 matching lines...) Expand all
778 } 781 }
779 for (auto const& kv : dynamic_stream_map_) { 782 for (auto const& kv : dynamic_stream_map_) {
780 if (kv.second->flow_controller()->IsBlocked()) { 783 if (kv.second->flow_controller()->IsBlocked()) {
781 return true; 784 return true;
782 } 785 }
783 } 786 }
784 return false; 787 return false;
785 } 788 }
786 789
787 } // namespace net 790 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_flags.cc ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698