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/quic_http_stream.h" | 5 #include "net/quic/quic_http_stream.h" |
6 | 6 |
7 #include "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/metrics/histogram_macros.h" | 8 #include "base/metrics/histogram_macros.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
661 int QuicHttpStream::DoReadRequestBody() { | 661 int QuicHttpStream::DoReadRequestBody() { |
662 next_state_ = STATE_READ_REQUEST_BODY_COMPLETE; | 662 next_state_ = STATE_READ_REQUEST_BODY_COMPLETE; |
663 return request_body_stream_->Read( | 663 return request_body_stream_->Read( |
664 raw_request_body_buf_.get(), raw_request_body_buf_->size(), | 664 raw_request_body_buf_.get(), raw_request_body_buf_->size(), |
665 base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr())); | 665 base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr())); |
666 } | 666 } |
667 | 667 |
668 int QuicHttpStream::DoReadRequestBodyComplete(int rv) { | 668 int QuicHttpStream::DoReadRequestBodyComplete(int rv) { |
669 // |rv| is the result of read from the request body from the last call to | 669 // |rv| is the result of read from the request body from the last call to |
670 // DoSendBody(). | 670 // DoSendBody(). |
671 if (rv < 0) | 671 if (rv < 0) { |
672 if (!callback_.is_null()) | |
673 DoCallback(rv); | |
mmenke
2016/06/02 15:17:58
I don't think you need to invoke the callback here
maksims (do not use this acc)
2016/06/03 09:40:31
Done.
| |
674 stream_->Reset(QUIC_ERROR_PROCESSING_STREAM); | |
672 return rv; | 675 return rv; |
676 } | |
673 | 677 |
674 // If the stream is already closed, don't continue. | 678 // If the stream is already closed, don't continue. |
675 if (!stream_) | 679 if (!stream_) |
676 return response_status_; | 680 return response_status_; |
mmenke
2016/06/02 15:17:58
This should go before the rv check - if this happe
maksims (do not use this acc)
2016/06/03 09:40:31
Done.
| |
677 | 681 |
678 request_body_buf_ = new DrainableIOBuffer(raw_request_body_buf_.get(), rv); | 682 request_body_buf_ = new DrainableIOBuffer(raw_request_body_buf_.get(), rv); |
679 if (rv == 0) { // Reached the end. | 683 if (rv == 0) { // Reached the end. |
680 DCHECK(request_body_stream_->IsEOF()); | 684 DCHECK(request_body_stream_->IsEOF()); |
681 } | 685 } |
682 | 686 |
683 next_state_ = STATE_SEND_BODY; | 687 next_state_ = STATE_SEND_BODY; |
684 return OK; | 688 return OK; |
685 } | 689 } |
686 | 690 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
772 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | 776 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
773 stream_ = nullptr; | 777 stream_ = nullptr; |
774 | 778 |
775 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 779 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
776 // read. | 780 // read. |
777 if (request_body_stream_) | 781 if (request_body_stream_) |
778 request_body_stream_->Reset(); | 782 request_body_stream_->Reset(); |
779 } | 783 } |
780 | 784 |
781 } // namespace net | 785 } // namespace net |
OLD | NEW |