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

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

Issue 76723002: Land Recent QUIC Changes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compilation error Created 7 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/reliable_quic_stream.h ('k') | net/quic/reliable_quic_stream_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/reliable_quic_stream.h" 5 #include "net/quic/reliable_quic_stream.h"
6 6
7 #include "net/quic/quic_session.h" 7 #include "net/quic/quic_session.h"
8 #include "net/quic/quic_spdy_decompressor.h" 8 #include "net/quic/quic_spdy_decompressor.h"
9 #include "net/spdy/write_blocked_list.h" 9 #include "net/spdy/write_blocked_list.h"
10 10
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 queued_data_.front().erase(0, consumed_data.bytes_consumed); 248 queued_data_.front().erase(0, consumed_data.bytes_consumed);
249 break; 249 break;
250 } 250 }
251 } 251 }
252 } 252 }
253 253
254 QuicConsumedData ReliableQuicStream::WriteDataInternal( 254 QuicConsumedData ReliableQuicStream::WriteDataInternal(
255 StringPiece data, bool fin) { 255 StringPiece data, bool fin) {
256 struct iovec iov = {const_cast<char*>(data.data()), 256 struct iovec iov = {const_cast<char*>(data.data()),
257 static_cast<size_t>(data.size())}; 257 static_cast<size_t>(data.size())};
258 return WritevDataInternal(&iov, 1, fin); 258 return WritevDataInternal(&iov, 1, fin, NULL);
259 } 259 }
260 260
261 QuicConsumedData ReliableQuicStream::WritevDataInternal(const struct iovec* iov, 261 QuicConsumedData ReliableQuicStream::WritevDataInternal(
262 int iov_count, 262 const struct iovec* iov,
263 bool fin) { 263 int iov_count,
264 bool fin,
265 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) {
264 if (write_side_closed_) { 266 if (write_side_closed_) {
265 DLOG(ERROR) << ENDPOINT << "Attempt to write when the write side is closed"; 267 DLOG(ERROR) << ENDPOINT << "Attempt to write when the write side is closed";
266 return QuicConsumedData(0, false); 268 return QuicConsumedData(0, false);
267 } 269 }
268 270
269 size_t write_length = 0u; 271 size_t write_length = 0u;
270 for (int i = 0; i < iov_count; ++i) { 272 for (int i = 0; i < iov_count; ++i) {
271 write_length += iov[i].iov_len; 273 write_length += iov[i].iov_len;
272 } 274 }
273 QuicConsumedData consumed_data = 275 QuicConsumedData consumed_data = session()->WritevData(
274 session()->WritevData(id(), iov, iov_count, stream_bytes_written_, fin); 276 id(), iov, iov_count, stream_bytes_written_, fin, ack_notifier_delegate);
275 stream_bytes_written_ += consumed_data.bytes_consumed; 277 stream_bytes_written_ += consumed_data.bytes_consumed;
276 if (consumed_data.bytes_consumed == write_length) { 278 if (consumed_data.bytes_consumed == write_length) {
277 if (fin && consumed_data.fin_consumed) { 279 if (fin && consumed_data.fin_consumed) {
278 fin_sent_ = true; 280 fin_sent_ = true;
279 CloseWriteSide(); 281 CloseWriteSide();
280 } else if (fin && !consumed_data.fin_consumed) { 282 } else if (fin && !consumed_data.fin_consumed) {
281 session_->MarkWriteBlocked(id(), EffectivePriority()); 283 session_->MarkWriteBlocked(id(), EffectivePriority());
282 } 284 }
283 } else { 285 } else {
284 session_->MarkWriteBlocked(id(), EffectivePriority()); 286 session_->MarkWriteBlocked(id(), EffectivePriority());
(...skipping 23 matching lines...) Expand all
308 if (id() == kCryptoStreamId) { 310 if (id() == kCryptoStreamId) {
309 // The crypto stream does not use compression. 311 // The crypto stream does not use compression.
310 return ProcessData(data, data_len); 312 return ProcessData(data, data_len);
311 } 313 }
312 314
313 uint32 total_bytes_consumed = 0; 315 uint32 total_bytes_consumed = 0;
314 if (headers_id_ == 0u) { 316 if (headers_id_ == 0u) {
315 total_bytes_consumed += StripPriorityAndHeaderId(data, data_len); 317 total_bytes_consumed += StripPriorityAndHeaderId(data, data_len);
316 data += total_bytes_consumed; 318 data += total_bytes_consumed;
317 data_len -= total_bytes_consumed; 319 data_len -= total_bytes_consumed;
318 if (data_len == 0 || !session_->connection()->connected()) { 320 if (data_len == 0 || total_bytes_consumed == 0) {
319 return total_bytes_consumed; 321 return total_bytes_consumed;
320 } 322 }
321 } 323 }
322 DCHECK_NE(0u, headers_id_); 324 DCHECK_NE(0u, headers_id_);
323 325
324 // Once the headers are finished, we simply pass the data through. 326 // Once the headers are finished, we simply pass the data through.
325 if (headers_decompressed_) { 327 if (headers_decompressed_) {
326 // Some buffered header data remains. 328 // Some buffered header data remains.
327 if (!decompressed_headers_.empty()) { 329 if (!decompressed_headers_.empty()) {
328 ProcessHeaderData(); 330 ProcessHeaderData();
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 if (data_len > 0 && headers_id_ == 0u) { 519 if (data_len > 0 && headers_id_ == 0u) {
518 // The headers ID has not yet been read. Strip it from the beginning of 520 // The headers ID has not yet been read. Strip it from the beginning of
519 // the data stream. 521 // the data stream.
520 total_bytes_parsed += StripUint32( 522 total_bytes_parsed += StripUint32(
521 data, data_len, &headers_id_and_priority_buffer_, &headers_id_); 523 data, data_len, &headers_id_and_priority_buffer_, &headers_id_);
522 } 524 }
523 return total_bytes_parsed; 525 return total_bytes_parsed;
524 } 526 }
525 527
526 } // namespace net 528 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/reliable_quic_stream.h ('k') | net/quic/reliable_quic_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698