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/chromium/quic_http_stream.h" | 5 #include "net/quic/chromium/quic_http_stream.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 next_state_ = STATE_SET_REQUEST_PRIORITY; | 303 next_state_ = STATE_SET_REQUEST_PRIORITY; |
304 rv = DoLoop(OK); | 304 rv = DoLoop(OK); |
305 } | 305 } |
306 | 306 |
307 if (rv == ERR_IO_PENDING) | 307 if (rv == ERR_IO_PENDING) |
308 callback_ = callback; | 308 callback_ = callback; |
309 | 309 |
310 return rv > 0 ? OK : rv; | 310 return rv > 0 ? OK : rv; |
311 } | 311 } |
312 | 312 |
313 UploadProgress QuicHttpStream::GetUploadProgress() const { | |
314 if (!request_body_stream_) | |
315 return UploadProgress(); | |
316 | |
317 return UploadProgress(request_body_stream_->position(), | |
318 request_body_stream_->size()); | |
319 } | |
320 | |
321 int QuicHttpStream::ReadResponseHeaders(const CompletionCallback& callback) { | 313 int QuicHttpStream::ReadResponseHeaders(const CompletionCallback& callback) { |
322 CHECK(callback_.is_null()); | 314 CHECK(callback_.is_null()); |
323 CHECK(!callback.is_null()); | 315 CHECK(!callback.is_null()); |
324 | 316 |
325 if (stream_ == nullptr) | 317 if (stream_ == nullptr) |
326 return response_status_; | 318 return response_status_; |
327 | 319 |
328 // Check if we already have the response headers. If so, return synchronously. | 320 // Check if we already have the response headers. If so, return synchronously. |
329 if (response_headers_received_) | 321 if (response_headers_received_) |
330 return OK; | 322 return OK; |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
836 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | 828 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
837 stream_ = nullptr; | 829 stream_ = nullptr; |
838 | 830 |
839 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 831 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
840 // read. | 832 // read. |
841 if (request_body_stream_) | 833 if (request_body_stream_) |
842 request_body_stream_->Reset(); | 834 request_body_stream_->Reset(); |
843 } | 835 } |
844 | 836 |
845 } // namespace net | 837 } // namespace net |
OLD | NEW |