| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/bidirectional_stream_spdy_impl.h" | 5 #include "net/spdy/bidirectional_stream_spdy_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 253 } |
| 254 ResetStream(); | 254 ResetStream(); |
| 255 // Complete any remaining read, as all data has been buffered. | 255 // Complete any remaining read, as all data has been buffered. |
| 256 // If user has not called ReadData (i.e |read_buffer_| is nullptr), this will | 256 // If user has not called ReadData (i.e |read_buffer_| is nullptr), this will |
| 257 // do nothing. | 257 // do nothing. |
| 258 timer_->Stop(); | 258 timer_->Stop(); |
| 259 DoBufferedRead(); | 259 DoBufferedRead(); |
| 260 } | 260 } |
| 261 | 261 |
| 262 int BidirectionalStreamSpdyImpl::SendRequestHeadersHelper() { | 262 int BidirectionalStreamSpdyImpl::SendRequestHeadersHelper() { |
| 263 std::unique_ptr<SpdyHeaderBlock> headers(new SpdyHeaderBlock); | 263 SpdyHeaderBlock headers; |
| 264 HttpRequestInfo http_request_info; | 264 HttpRequestInfo http_request_info; |
| 265 http_request_info.url = request_info_->url; | 265 http_request_info.url = request_info_->url; |
| 266 http_request_info.method = request_info_->method; | 266 http_request_info.method = request_info_->method; |
| 267 http_request_info.extra_headers = request_info_->extra_headers; | 267 http_request_info.extra_headers = request_info_->extra_headers; |
| 268 | 268 |
| 269 CreateSpdyHeadersFromHttpRequest( | 269 CreateSpdyHeadersFromHttpRequest( |
| 270 http_request_info, http_request_info.extra_headers, true, headers.get()); | 270 http_request_info, http_request_info.extra_headers, true, &headers); |
| 271 return stream_->SendRequestHeaders(std::move(headers), | 271 return stream_->SendRequestHeaders(std::move(headers), |
| 272 request_info_->end_stream_on_headers | 272 request_info_->end_stream_on_headers |
| 273 ? NO_MORE_DATA_TO_SEND | 273 ? NO_MORE_DATA_TO_SEND |
| 274 : MORE_DATA_TO_SEND); | 274 : MORE_DATA_TO_SEND); |
| 275 } | 275 } |
| 276 | 276 |
| 277 void BidirectionalStreamSpdyImpl::OnStreamInitialized(int rv) { | 277 void BidirectionalStreamSpdyImpl::OnStreamInitialized(int rv) { |
| 278 DCHECK_NE(ERR_IO_PENDING, rv); | 278 DCHECK_NE(ERR_IO_PENDING, rv); |
| 279 if (rv == OK) { | 279 if (rv == OK) { |
| 280 stream_ = stream_request_.ReleaseStream(); | 280 stream_ = stream_request_.ReleaseStream(); |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 | 355 |
| 356 bool BidirectionalStreamSpdyImpl::ShouldWaitForMoreBufferedData() const { | 356 bool BidirectionalStreamSpdyImpl::ShouldWaitForMoreBufferedData() const { |
| 357 if (stream_closed_) | 357 if (stream_closed_) |
| 358 return false; | 358 return false; |
| 359 DCHECK_GT(read_buffer_len_, 0); | 359 DCHECK_GT(read_buffer_len_, 0); |
| 360 return read_data_queue_.GetTotalSize() < | 360 return read_data_queue_.GetTotalSize() < |
| 361 static_cast<size_t>(read_buffer_len_); | 361 static_cast<size_t>(read_buffer_len_); |
| 362 } | 362 } |
| 363 | 363 |
| 364 } // namespace net | 364 } // namespace net |
| OLD | NEW |