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/spdy/spdy_http_stream.h" | 5 #include "net/spdy/spdy_http_stream.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <list> | 8 #include <list> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/callback_helpers.h" | 12 #include "base/callback_helpers.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/strings/stringprintf.h" | 16 #include "base/strings/stringprintf.h" |
17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
18 #include "base/values.h" | 18 #include "base/values.h" |
19 #include "net/base/host_port_pair.h" | 19 #include "net/base/host_port_pair.h" |
20 #include "net/base/upload_data_stream.h" | 20 #include "net/base/upload_data_stream.h" |
21 #include "net/http/http_request_headers.h" | 21 #include "net/http/http_request_headers.h" |
22 #include "net/http/http_request_info.h" | 22 #include "net/http/http_request_info.h" |
23 #include "net/http/http_response_info.h" | 23 #include "net/http/http_response_info.h" |
24 #include "net/log/net_log.h" | 24 #include "net/log/net_log.h" |
| 25 #include "net/log/net_log_event_type.h" |
25 #include "net/spdy/spdy_header_block.h" | 26 #include "net/spdy/spdy_header_block.h" |
26 #include "net/spdy/spdy_http_utils.h" | 27 #include "net/spdy/spdy_http_utils.h" |
27 #include "net/spdy/spdy_protocol.h" | 28 #include "net/spdy/spdy_protocol.h" |
28 #include "net/spdy/spdy_session.h" | 29 #include "net/spdy/spdy_session.h" |
29 | 30 |
30 namespace net { | 31 namespace net { |
31 | 32 |
32 const size_t SpdyHttpStream::kRequestBodyBufferSize = 1 << 14; // 16KB | 33 const size_t SpdyHttpStream::kRequestBodyBufferSize = 1 << 14; // 16KB |
33 | 34 |
34 SpdyHttpStream::SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session, | 35 SpdyHttpStream::SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session, |
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 // response is received. | 274 // response is received. |
274 CHECK(response_callback_.is_null()); | 275 CHECK(response_callback_.is_null()); |
275 response_callback_ = callback; | 276 response_callback_ = callback; |
276 return ERR_IO_PENDING; | 277 return ERR_IO_PENDING; |
277 } | 278 } |
278 | 279 |
279 SpdyHeaderBlock headers; | 280 SpdyHeaderBlock headers; |
280 CreateSpdyHeadersFromHttpRequest(*request_info_, request_headers, direct_, | 281 CreateSpdyHeadersFromHttpRequest(*request_info_, request_headers, direct_, |
281 &headers); | 282 &headers); |
282 stream_->net_log().AddEvent( | 283 stream_->net_log().AddEvent( |
283 NetLog::TYPE_HTTP_TRANSACTION_HTTP2_SEND_REQUEST_HEADERS, | 284 NetLogEventType::HTTP_TRANSACTION_HTTP2_SEND_REQUEST_HEADERS, |
284 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers)); | 285 base::Bind(&SpdyHeaderBlockNetLogCallback, &headers)); |
285 result = stream_->SendRequestHeaders( | 286 result = stream_->SendRequestHeaders( |
286 std::move(headers), | 287 std::move(headers), |
287 HasUploadData() ? MORE_DATA_TO_SEND : NO_MORE_DATA_TO_SEND); | 288 HasUploadData() ? MORE_DATA_TO_SEND : NO_MORE_DATA_TO_SEND); |
288 | 289 |
289 if (result == ERR_IO_PENDING) { | 290 if (result == ERR_IO_PENDING) { |
290 CHECK(request_callback_.is_null()); | 291 CHECK(request_callback_.is_null()); |
291 request_callback_ = callback; | 292 request_callback_ = callback; |
292 } | 293 } |
293 return result; | 294 return result; |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP2; | 614 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP2; |
614 return; | 615 return; |
615 } | 616 } |
616 | 617 |
617 void SpdyHttpStream::SetPriority(RequestPriority priority) { | 618 void SpdyHttpStream::SetPriority(RequestPriority priority) { |
618 // TODO(akalin): Plumb this through to |stream_request_| and | 619 // TODO(akalin): Plumb this through to |stream_request_| and |
619 // |stream_|. | 620 // |stream_|. |
620 } | 621 } |
621 | 622 |
622 } // namespace net | 623 } // namespace net |
OLD | NEW |