| 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 <memory> | 9 #include <memory> |
| 10 #include <string> | |
| 11 #include <utility> | 10 #include <utility> |
| 12 | 11 |
| 13 #include "base/bind.h" | 12 #include "base/bind.h" |
| 14 #include "base/callback_helpers.h" | 13 #include "base/callback_helpers.h" |
| 15 #include "base/location.h" | 14 #include "base/location.h" |
| 16 #include "base/logging.h" | 15 #include "base/logging.h" |
| 17 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 18 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "base/values.h" | 18 #include "base/values.h" |
| 20 #include "net/base/host_port_pair.h" | 19 #include "net/base/host_port_pair.h" |
| 21 #include "net/base/upload_data_stream.h" | 20 #include "net/base/upload_data_stream.h" |
| 22 #include "net/http/http_request_headers.h" | 21 #include "net/http/http_request_headers.h" |
| 23 #include "net/http/http_request_info.h" | 22 #include "net/http/http_request_info.h" |
| 24 #include "net/http/http_response_info.h" | 23 #include "net/http/http_response_info.h" |
| 25 #include "net/log/net_log_event_type.h" | 24 #include "net/log/net_log_event_type.h" |
| 26 #include "net/log/net_log_with_source.h" | 25 #include "net/log/net_log_with_source.h" |
| 26 #include "net/spdy/platform/api/spdy_string.h" |
| 27 #include "net/spdy/spdy_header_block.h" | 27 #include "net/spdy/spdy_header_block.h" |
| 28 #include "net/spdy/spdy_http_utils.h" | 28 #include "net/spdy/spdy_http_utils.h" |
| 29 #include "net/spdy/spdy_protocol.h" | 29 #include "net/spdy/spdy_protocol.h" |
| 30 #include "net/spdy/spdy_session.h" | 30 #include "net/spdy/spdy_session.h" |
| 31 | 31 |
| 32 namespace net { | 32 namespace net { |
| 33 | 33 |
| 34 const size_t SpdyHttpStream::kRequestBodyBufferSize = 1 << 14; // 16KB | 34 const size_t SpdyHttpStream::kRequestBodyBufferSize = 1 << 14; // 16KB |
| 35 | 35 |
| 36 SpdyHttpStream::SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session, | 36 SpdyHttpStream::SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session, |
| (...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 OnRequestBodyReadCompleted(rv); | 438 OnRequestBodyReadCompleted(rv); |
| 439 } | 439 } |
| 440 | 440 |
| 441 void SpdyHttpStream::InitializeStreamHelper() { | 441 void SpdyHttpStream::InitializeStreamHelper() { |
| 442 stream_->SetDelegate(this); | 442 stream_->SetDelegate(this); |
| 443 was_alpn_negotiated_ = stream_->WasAlpnNegotiated(); | 443 was_alpn_negotiated_ = stream_->WasAlpnNegotiated(); |
| 444 } | 444 } |
| 445 | 445 |
| 446 void SpdyHttpStream::ResetStreamInternal() { | 446 void SpdyHttpStream::ResetStreamInternal() { |
| 447 spdy_session_->ResetStream(stream()->stream_id(), ERROR_CODE_INTERNAL_ERROR, | 447 spdy_session_->ResetStream(stream()->stream_id(), ERROR_CODE_INTERNAL_ERROR, |
| 448 std::string()); | 448 SpdyString()); |
| 449 } | 449 } |
| 450 | 450 |
| 451 void SpdyHttpStream::OnRequestBodyReadCompleted(int status) { | 451 void SpdyHttpStream::OnRequestBodyReadCompleted(int status) { |
| 452 if (status < 0) { | 452 if (status < 0) { |
| 453 DCHECK_NE(ERR_IO_PENDING, status); | 453 DCHECK_NE(ERR_IO_PENDING, status); |
| 454 // Post |request_callback_| with received error. This should be posted | 454 // Post |request_callback_| with received error. This should be posted |
| 455 // before ResetStreamInternal, because the latter would call | 455 // before ResetStreamInternal, because the latter would call |
| 456 // |request_callback_| via OnClose with an error code potentially different | 456 // |request_callback_| via OnClose with an error code potentially different |
| 457 // from |status|. | 457 // from |status|. |
| 458 MaybePostRequestCallback(status); | 458 MaybePostRequestCallback(status); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP2; | 581 details->connection_info = HttpResponseInfo::CONNECTION_INFO_HTTP2; |
| 582 return; | 582 return; |
| 583 } | 583 } |
| 584 | 584 |
| 585 void SpdyHttpStream::SetPriority(RequestPriority priority) { | 585 void SpdyHttpStream::SetPriority(RequestPriority priority) { |
| 586 // TODO(akalin): Plumb this through to |stream_request_| and | 586 // TODO(akalin): Plumb this through to |stream_request_| and |
| 587 // |stream_|. | 587 // |stream_|. |
| 588 } | 588 } |
| 589 | 589 |
| 590 } // namespace net | 590 } // namespace net |
| OLD | NEW |