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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 break; | 622 break; |
623 } | 623 } |
624 } while (next_state_ != STATE_NONE && next_state_ != STATE_OPEN && | 624 } while (next_state_ != STATE_NONE && next_state_ != STATE_OPEN && |
625 rv != ERR_IO_PENDING); | 625 rv != ERR_IO_PENDING); |
626 | 626 |
627 return rv; | 627 return rv; |
628 } | 628 } |
629 | 629 |
630 int QuicHttpStream::DoRequestStream() { | 630 int QuicHttpStream::DoRequestStream() { |
631 next_state_ = STATE_REQUEST_STREAM_COMPLETE; | 631 next_state_ = STATE_REQUEST_STREAM_COMPLETE; |
632 return stream_request_.StartRequest( | 632 stream_request_ = session_->CreateStreamRequest(); |
633 session_, &stream_, | 633 return stream_request_->StartRequest( |
634 base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr())); | 634 base::Bind(&QuicHttpStream::OnIOComplete, weak_factory_.GetWeakPtr())); |
635 } | 635 } |
636 | 636 |
637 int QuicHttpStream::DoRequestStreamComplete(int rv) { | 637 int QuicHttpStream::DoRequestStreamComplete(int rv) { |
638 DCHECK(rv == OK || !stream_); | 638 DCHECK(rv == OK || !stream_); |
639 if (rv != OK) { | 639 if (rv != OK) { |
640 session_error_ = rv; | 640 session_error_ = rv; |
641 return GetResponseStatus(); | 641 return GetResponseStatus(); |
642 } | 642 } |
643 | 643 |
| 644 stream_ = stream_request_->ReleaseStream(); |
| 645 stream_request_.reset(); |
644 stream_->SetDelegate(this); | 646 stream_->SetDelegate(this); |
645 if (request_info_->load_flags & LOAD_DISABLE_CONNECTION_MIGRATION) { | 647 if (request_info_->load_flags & LOAD_DISABLE_CONNECTION_MIGRATION) { |
646 stream_->DisableConnectionMigration(); | 648 stream_->DisableConnectionMigration(); |
647 } | 649 } |
648 | 650 |
649 if (response_info_) { | 651 if (response_info_) { |
650 // This happens in the case of a asynchronous push rendezvous | 652 // This happens in the case of a asynchronous push rendezvous |
651 // that ultimately fails (e.g. vary failure). |response_info_| | 653 // that ultimately fails (e.g. vary failure). |response_info_| |
652 // non-null implies that |DoRequestStream()| was called via | 654 // non-null implies that |DoRequestStream()| was called via |
653 // |SendRequest()|. | 655 // |SendRequest()|. |
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
888 quic_stream_error_ != QUIC_STREAM_CONNECTION_ERROR) { | 890 quic_stream_error_ != QUIC_STREAM_CONNECTION_ERROR) { |
889 return ERR_QUIC_PROTOCOL_ERROR; | 891 return ERR_QUIC_PROTOCOL_ERROR; |
890 } | 892 } |
891 | 893 |
892 DCHECK_NE(QUIC_HANDSHAKE_TIMEOUT, quic_connection_error_); | 894 DCHECK_NE(QUIC_HANDSHAKE_TIMEOUT, quic_connection_error_); |
893 | 895 |
894 return ERR_QUIC_PROTOCOL_ERROR; | 896 return ERR_QUIC_PROTOCOL_ERROR; |
895 } | 897 } |
896 | 898 |
897 } // namespace net | 899 } // namespace net |
OLD | NEW |