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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 next_state_ = STATE_SET_REQUEST_PRIORITY; | 285 next_state_ = STATE_SET_REQUEST_PRIORITY; |
286 } | 286 } |
287 rv = DoLoop(OK); | 287 rv = DoLoop(OK); |
288 | 288 |
289 if (rv == ERR_IO_PENDING) | 289 if (rv == ERR_IO_PENDING) |
290 callback_ = callback; | 290 callback_ = callback; |
291 | 291 |
292 return rv > 0 ? OK : rv; | 292 return rv > 0 ? OK : rv; |
293 } | 293 } |
294 | 294 |
295 UploadProgress QuicHttpStream::GetUploadProgress() const { | |
296 if (!request_body_stream_) | |
297 return UploadProgress(); | |
298 | |
299 return UploadProgress(request_body_stream_->position(), | |
300 request_body_stream_->size()); | |
301 } | |
302 | |
303 int QuicHttpStream::ReadResponseHeaders(const CompletionCallback& callback) { | 295 int QuicHttpStream::ReadResponseHeaders(const CompletionCallback& callback) { |
304 CHECK(callback_.is_null()); | 296 CHECK(callback_.is_null()); |
305 CHECK(!callback.is_null()); | 297 CHECK(!callback.is_null()); |
306 | 298 |
307 if (stream_ == nullptr) | 299 if (stream_ == nullptr) |
308 return response_status_; | 300 return response_status_; |
309 | 301 |
310 // Check if we already have the response headers. If so, return synchronously. | 302 // Check if we already have the response headers. If so, return synchronously. |
311 if (response_headers_received_) | 303 if (response_headers_received_) |
312 return OK; | 304 return OK; |
(...skipping 518 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | 823 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
832 stream_ = nullptr; | 824 stream_ = nullptr; |
833 | 825 |
834 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 826 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
835 // read. | 827 // read. |
836 if (request_body_stream_) | 828 if (request_body_stream_) |
837 request_body_stream_->Reset(); | 829 request_body_stream_->Reset(); |
838 } | 830 } |
839 | 831 |
840 } // namespace net | 832 } // namespace net |
OLD | NEW |