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

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

Issue 343753003: Allocate a larger QUIC request body buffer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | « no previous file | no next file » | 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/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 &request_headers_, SPDY3, /*direct=*/true); 114 &request_headers_, SPDY3, /*direct=*/true);
115 115
116 // Store the request body. 116 // Store the request body.
117 request_body_stream_ = request_info_->upload_data_stream; 117 request_body_stream_ = request_info_->upload_data_stream;
118 if (request_body_stream_) { 118 if (request_body_stream_) {
119 // TODO(rch): Can we be more precise about when to allocate 119 // TODO(rch): Can we be more precise about when to allocate
120 // raw_request_body_buf_. Removed the following check. DoReadRequestBody() 120 // raw_request_body_buf_. Removed the following check. DoReadRequestBody()
121 // was being called even if we didn't yet allocate raw_request_body_buf_. 121 // was being called even if we didn't yet allocate raw_request_body_buf_.
122 // && (request_body_stream_->size() || 122 // && (request_body_stream_->size() ||
123 // request_body_stream_->is_chunked())) 123 // request_body_stream_->is_chunked()))
124 // 124 // Use 10 packets as the body buffer size to give enough space to
125 // Use kMaxPacketSize as the buffer size, since the request 125 // help ensure we don't often send out partial packets.
126 // body data is written with this size at a time. 126 raw_request_body_buf_ = new IOBufferWithSize(10 * kMaxPacketSize);
127 // TODO(rch): use a smarter value since we can't write an entire
128 // packet due to overhead.
129 raw_request_body_buf_ = new IOBufferWithSize(kMaxPacketSize);
130 // The request body buffer is empty at first. 127 // The request body buffer is empty at first.
131 request_body_buf_ = new DrainableIOBuffer(raw_request_body_buf_.get(), 0); 128 request_body_buf_ = new DrainableIOBuffer(raw_request_body_buf_.get(), 0);
132 } 129 }
133 130
134 // Store the response info. 131 // Store the response info.
135 response_info_ = response; 132 response_info_ = response;
136 133
137 next_state_ = STATE_SEND_HEADERS; 134 next_state_ = STATE_SEND_HEADERS;
138 int rv = DoLoop(OK); 135 int rv = DoLoop(OK);
139 if (rv == ERR_IO_PENDING) 136 if (rv == ERR_IO_PENDING)
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 546
550 void QuicHttpStream::BufferResponseBody(const char* data, int length) { 547 void QuicHttpStream::BufferResponseBody(const char* data, int length) {
551 if (length == 0) 548 if (length == 0)
552 return; 549 return;
553 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); 550 IOBufferWithSize* io_buffer = new IOBufferWithSize(length);
554 memcpy(io_buffer->data(), data, length); 551 memcpy(io_buffer->data(), data, length);
555 response_body_.push_back(make_scoped_refptr(io_buffer)); 552 response_body_.push_back(make_scoped_refptr(io_buffer));
556 } 553 }
557 554
558 } // namespace net 555 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698