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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
304 next_state_ = STATE_SET_REQUEST_PRIORITY; | 304 next_state_ = STATE_SET_REQUEST_PRIORITY; |
305 rv = DoLoop(OK); | 305 rv = DoLoop(OK); |
306 } | 306 } |
307 | 307 |
308 if (rv == ERR_IO_PENDING) | 308 if (rv == ERR_IO_PENDING) |
309 callback_ = callback; | 309 callback_ = callback; |
310 | 310 |
311 return rv > 0 ? OK : rv; | 311 return rv > 0 ? OK : rv; |
312 } | 312 } |
313 | 313 |
314 UploadProgress QuicHttpStream::GetUploadProgress() const { | |
315 if (!request_body_stream_) | |
316 return UploadProgress(); | |
317 | |
318 return UploadProgress(request_body_stream_->position(), | |
319 request_body_stream_->size()); | |
320 } | |
321 | |
322 int QuicHttpStream::ReadResponseHeaders(const CompletionCallback& callback) { | 314 int QuicHttpStream::ReadResponseHeaders(const CompletionCallback& callback) { |
323 CHECK(callback_.is_null()); | 315 CHECK(callback_.is_null()); |
324 CHECK(!callback.is_null()); | 316 CHECK(!callback.is_null()); |
325 | 317 |
326 if (stream_ == nullptr) | 318 if (stream_ == nullptr) |
327 return response_status_; | 319 return response_status_; |
328 | 320 |
329 // Check if we already have the response headers. If so, return synchronously. | 321 // Check if we already have the response headers. If so, return synchronously. |
330 if (response_headers_received_) | 322 if (response_headers_received_) |
331 return OK; | 323 return OK; |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
847 closed_is_first_stream_ = stream_->IsFirstStream(); | 839 closed_is_first_stream_ = stream_->IsFirstStream(); |
848 stream_ = nullptr; | 840 stream_ = nullptr; |
849 | 841 |
850 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 842 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
851 // read. | 843 // read. |
852 if (request_body_stream_) | 844 if (request_body_stream_) |
853 request_body_stream_->Reset(); | 845 request_body_stream_->Reset(); |
854 } | 846 } |
855 | 847 |
856 } // namespace net | 848 } // namespace net |
OLD | NEW |