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

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

Issue 185203003: Killing off QUICv12, including cleaning out all of the code for handling (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Deleted unused StripUint32 Created 6 years, 9 months 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/quic_headers_stream.cc ('k') | net/quic/quic_http_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/quic_http_stream.h" 5 #include "net/quic/quic_http_stream.h"
6 6
7 #include "base/callback_helpers.h" 7 #include "base/callback_helpers.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 } while (next_state_ != STATE_NONE && next_state_ != STATE_OPEN && 405 } while (next_state_ != STATE_NONE && next_state_ != STATE_OPEN &&
406 rv != ERR_IO_PENDING); 406 rv != ERR_IO_PENDING);
407 407
408 return rv; 408 return rv;
409 } 409 }
410 410
411 int QuicHttpStream::DoSendHeaders() { 411 int QuicHttpStream::DoSendHeaders() {
412 if (!stream_) 412 if (!stream_)
413 return ERR_UNEXPECTED; 413 return ERR_UNEXPECTED;
414 414
415 if (stream_->version() <= QUIC_VERSION_12) {
416 if (request_.empty() && !stream_->CanWrite(
417 base::Bind(&QuicHttpStream::OnIOComplete,
418 weak_factory_.GetWeakPtr()))) {
419 // Do not compress headers unless it is likely that they can be sent.
420 next_state_ = STATE_SEND_HEADERS;
421 return ERR_IO_PENDING;
422 }
423 request_ = stream_->compressor()->CompressHeadersWithPriority(
424 ConvertRequestPriorityToQuicPriority(priority_), request_headers_);
425 }
426 // Log the actual request with the URL Request's net log. 415 // Log the actual request with the URL Request's net log.
427 stream_net_log_.AddEvent( 416 stream_net_log_.AddEvent(
428 NetLog::TYPE_HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS, 417 NetLog::TYPE_HTTP_TRANSACTION_QUIC_SEND_REQUEST_HEADERS,
429 base::Bind(&QuicRequestNetLogCallback, &request_headers_, priority_)); 418 base::Bind(&QuicRequestNetLogCallback, &request_headers_, priority_));
430 // Also log to the QuicSession's net log. 419 // Also log to the QuicSession's net log.
431 stream_->net_log().AddEvent( 420 stream_->net_log().AddEvent(
432 NetLog::TYPE_QUIC_HTTP_STREAM_SEND_REQUEST_HEADERS, 421 NetLog::TYPE_QUIC_HTTP_STREAM_SEND_REQUEST_HEADERS,
433 base::Bind(&QuicRequestNetLogCallback, &request_headers_, priority_)); 422 base::Bind(&QuicRequestNetLogCallback, &request_headers_, priority_));
434 423
435 bool has_upload_data = request_body_stream_ != NULL; 424 bool has_upload_data = request_body_stream_ != NULL;
436 425
437 next_state_ = STATE_SEND_HEADERS_COMPLETE; 426 next_state_ = STATE_SEND_HEADERS_COMPLETE;
438 int rv = (stream_->version() > QUIC_VERSION_12) ? 427 int rv = stream_->WriteHeaders(request_headers_, !has_upload_data);
439 stream_->WriteHeaders(request_headers_, !has_upload_data) :
440 stream_->WriteStreamData(request_, !has_upload_data,
441 base::Bind(&QuicHttpStream::OnIOComplete,
442 weak_factory_.GetWeakPtr()));
443 request_headers_.clear(); 428 request_headers_.clear();
444 return rv; 429 return rv;
445 } 430 }
446 431
447 int QuicHttpStream::DoSendHeadersComplete(int rv) { 432 int QuicHttpStream::DoSendHeadersComplete(int rv) {
448 if (rv < 0) 433 if (rv < 0)
449 return rv; 434 return rv;
450 435
451 next_state_ = request_body_stream_ ? 436 next_state_ = request_body_stream_ ?
452 STATE_READ_REQUEST_BODY : STATE_OPEN; 437 STATE_READ_REQUEST_BODY : STATE_OPEN;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 541
557 void QuicHttpStream::BufferResponseBody(const char* data, int length) { 542 void QuicHttpStream::BufferResponseBody(const char* data, int length) {
558 if (length == 0) 543 if (length == 0)
559 return; 544 return;
560 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); 545 IOBufferWithSize* io_buffer = new IOBufferWithSize(length);
561 memcpy(io_buffer->data(), data, length); 546 memcpy(io_buffer->data(), data, length);
562 response_body_.push_back(make_scoped_refptr(io_buffer)); 547 response_body_.push_back(make_scoped_refptr(io_buffer));
563 } 548 }
564 549
565 } // namespace net 550 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_headers_stream.cc ('k') | net/quic/quic_http_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698