| 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 758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 769 ResetStream(); | 769 ResetStream(); |
| 770 } | 770 } |
| 771 return rv; | 771 return rv; |
| 772 } | 772 } |
| 773 | 773 |
| 774 void QuicHttpStream::ResetStream() { | 774 void QuicHttpStream::ResetStream() { |
| 775 if (push_handle_) { | 775 if (push_handle_) { |
| 776 push_handle_->Cancel(); | 776 push_handle_->Cancel(); |
| 777 push_handle_ = nullptr; | 777 push_handle_ = nullptr; |
| 778 } | 778 } |
| 779 |
| 780 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
| 781 // read. |
| 782 if (request_body_stream_) |
| 783 request_body_stream_->Reset(); |
| 784 |
| 779 if (!stream_) | 785 if (!stream_) |
| 780 return; | 786 return; |
| 781 DCHECK_LE(stream_->NumBytesConsumed(), stream_->stream_bytes_read()); | 787 DCHECK_LE(stream_->NumBytesConsumed(), stream_->stream_bytes_read()); |
| 782 // Only count the uniquely received bytes. | 788 // Only count the uniquely received bytes. |
| 783 closed_stream_received_bytes_ = stream_->NumBytesConsumed(); | 789 closed_stream_received_bytes_ = stream_->NumBytesConsumed(); |
| 784 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | 790 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
| 785 closed_is_first_stream_ = stream_->IsFirstStream(); | 791 closed_is_first_stream_ = stream_->IsFirstStream(); |
| 786 stream_->ClearDelegate(); | 792 stream_->ClearDelegate(); |
| 787 stream_ = nullptr; | 793 stream_ = nullptr; |
| 788 | |
| 789 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | |
| 790 // read. | |
| 791 if (request_body_stream_) | |
| 792 request_body_stream_->Reset(); | |
| 793 } | 794 } |
| 794 | 795 |
| 795 int QuicHttpStream::GetResponseStatus() { | 796 int QuicHttpStream::GetResponseStatus() { |
| 796 SaveResponseStatus(); | 797 SaveResponseStatus(); |
| 797 return response_status_; | 798 return response_status_; |
| 798 } | 799 } |
| 799 | 800 |
| 800 void QuicHttpStream::SaveResponseStatus() { | 801 void QuicHttpStream::SaveResponseStatus() { |
| 801 if (!has_response_status_) | 802 if (!has_response_status_) |
| 802 SetResponseStatus(ComputeResponseStatus()); | 803 SetResponseStatus(ComputeResponseStatus()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 830 quic_stream_error_ != QUIC_STREAM_CONNECTION_ERROR) { | 831 quic_stream_error_ != QUIC_STREAM_CONNECTION_ERROR) { |
| 831 return ERR_QUIC_PROTOCOL_ERROR; | 832 return ERR_QUIC_PROTOCOL_ERROR; |
| 832 } | 833 } |
| 833 | 834 |
| 834 DCHECK_NE(QUIC_HANDSHAKE_TIMEOUT, quic_connection_error_); | 835 DCHECK_NE(QUIC_HANDSHAKE_TIMEOUT, quic_connection_error_); |
| 835 | 836 |
| 836 return ERR_QUIC_PROTOCOL_ERROR; | 837 return ERR_QUIC_PROTOCOL_ERROR; |
| 837 } | 838 } |
| 838 | 839 |
| 839 } // namespace net | 840 } // namespace net |
| OLD | NEW |