OLD | NEW |
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 CHECK(stream_); | 104 CHECK(stream_); |
105 CHECK(!request_body_stream_); | 105 CHECK(!request_body_stream_); |
106 CHECK(!response_info_); | 106 CHECK(!response_info_); |
107 CHECK(!callback.is_null()); | 107 CHECK(!callback.is_null()); |
108 CHECK(response); | 108 CHECK(response); |
109 | 109 |
110 QuicPriority priority = ConvertRequestPriorityToQuicPriority(priority_); | 110 QuicPriority priority = ConvertRequestPriorityToQuicPriority(priority_); |
111 stream_->set_priority(priority); | 111 stream_->set_priority(priority); |
112 // Store the serialized request headers. | 112 // Store the serialized request headers. |
113 CreateSpdyHeadersFromHttpRequest(*request_info_, request_headers, | 113 CreateSpdyHeadersFromHttpRequest(*request_info_, request_headers, |
114 &request_headers_, SPDY3, /*direct=*/true); | 114 SPDY3, /*direct=*/true, &request_headers_); |
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 // Use 10 packets as the body buffer size to give enough space to | 124 // Use 10 packets as the body buffer size to give enough space to |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 | 546 |
547 void QuicHttpStream::BufferResponseBody(const char* data, int length) { | 547 void QuicHttpStream::BufferResponseBody(const char* data, int length) { |
548 if (length == 0) | 548 if (length == 0) |
549 return; | 549 return; |
550 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); | 550 IOBufferWithSize* io_buffer = new IOBufferWithSize(length); |
551 memcpy(io_buffer->data(), data, length); | 551 memcpy(io_buffer->data(), data, length); |
552 response_body_.push_back(make_scoped_refptr(io_buffer)); | 552 response_body_.push_back(make_scoped_refptr(io_buffer)); |
553 } | 553 } |
554 | 554 |
555 } // namespace net | 555 } // namespace net |
OLD | NEW |