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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 request_info_(nullptr), | 51 request_info_(nullptr), |
52 request_body_stream_(nullptr), | 52 request_body_stream_(nullptr), |
53 priority_(MINIMUM_PRIORITY), | 53 priority_(MINIMUM_PRIORITY), |
54 response_info_(nullptr), | 54 response_info_(nullptr), |
55 response_status_(OK), | 55 response_status_(OK), |
56 response_headers_received_(false), | 56 response_headers_received_(false), |
57 headers_bytes_received_(0), | 57 headers_bytes_received_(0), |
58 headers_bytes_sent_(0), | 58 headers_bytes_sent_(0), |
59 closed_stream_received_bytes_(0), | 59 closed_stream_received_bytes_(0), |
60 closed_stream_sent_bytes_(0), | 60 closed_stream_sent_bytes_(0), |
61 closed_stream_id_(kInvalidStreamId), | |
61 user_buffer_len_(0), | 62 user_buffer_len_(0), |
62 quic_connection_error_(QUIC_NO_ERROR), | 63 quic_connection_error_(QUIC_NO_ERROR), |
63 port_migration_detected_(false), | 64 port_migration_detected_(false), |
64 found_promise_(false), | 65 found_promise_(false), |
65 push_handle_(nullptr), | 66 push_handle_(nullptr), |
66 in_loop_(false), | 67 in_loop_(false), |
67 weak_factory_(this) { | 68 weak_factory_(this) { |
68 DCHECK(session_); | 69 DCHECK(session_); |
69 session_->AddObserver(this); | 70 session_->AddObserver(this); |
70 } | 71 } |
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
409 int64_t total_sent_bytes = headers_bytes_sent_; | 410 int64_t total_sent_bytes = headers_bytes_sent_; |
410 if (stream_) { | 411 if (stream_) { |
411 total_sent_bytes += stream_->stream_bytes_written(); | 412 total_sent_bytes += stream_->stream_bytes_written(); |
412 } else { | 413 } else { |
413 total_sent_bytes += closed_stream_sent_bytes_; | 414 total_sent_bytes += closed_stream_sent_bytes_; |
414 } | 415 } |
415 return total_sent_bytes; | 416 return total_sent_bytes; |
416 } | 417 } |
417 | 418 |
418 bool QuicHttpStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const { | 419 bool QuicHttpStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const { |
419 // TODO(mmenke): Figure out what to do here. | 420 QuicStreamId stream_id = closed_stream_id_; |
421 if (stream_) | |
422 stream_id = stream_->id(); | |
423 // If stream failed to be negotiated, return false. | |
424 if (stream_id == kInvalidStreamId) | |
425 return false; | |
426 if (QuicChromiumClientStream::isFirstStream(stream_id)) { | |
427 load_timing_info->socket_reused = false; | |
428 load_timing_info->connect_timing = connect_timing_; | |
Ryan Hamilton
2016/09/09 22:05:39
I'm not sure what the semantics should be for conn
| |
429 } else { | |
430 load_timing_info->socket_reused = true; | |
431 } | |
420 return true; | 432 return true; |
421 } | 433 } |
422 | 434 |
423 void QuicHttpStream::GetSSLInfo(SSLInfo* ssl_info) { | 435 void QuicHttpStream::GetSSLInfo(SSLInfo* ssl_info) { |
424 *ssl_info = ssl_info_; | 436 *ssl_info = ssl_info_; |
425 } | 437 } |
426 | 438 |
427 void QuicHttpStream::GetSSLCertRequestInfo( | 439 void QuicHttpStream::GetSSLCertRequestInfo( |
428 SSLCertRequestInfo* cert_request_info) { | 440 SSLCertRequestInfo* cert_request_info) { |
429 DCHECK(stream_); | 441 DCHECK(stream_); |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
634 // TODO(rtenneti) Bug: b/28676259 - a temporary fix until we find out why | 646 // TODO(rtenneti) Bug: b/28676259 - a temporary fix until we find out why |
635 // |session_| could be a nullptr. Delete |null_session| check and histogram if | 647 // |session_| could be a nullptr. Delete |null_session| check and histogram if |
636 // session is never a nullptr. | 648 // session is never a nullptr. |
637 bool null_session = session_ == nullptr; | 649 bool null_session = session_ == nullptr; |
638 if (null_session) { | 650 if (null_session) { |
639 UMA_HISTOGRAM_BOOLEAN("Net.QuicHttpStream::DoStreamRequest.IsNullSession", | 651 UMA_HISTOGRAM_BOOLEAN("Net.QuicHttpStream::DoStreamRequest.IsNullSession", |
640 null_session); | 652 null_session); |
641 return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED | 653 return was_handshake_confirmed_ ? ERR_CONNECTION_CLOSED |
642 : ERR_QUIC_HANDSHAKE_FAILED; | 654 : ERR_QUIC_HANDSHAKE_FAILED; |
643 } | 655 } |
656 connect_timing_ = session_->GetConnectTiming(); | |
644 int rv = stream_request_.StartRequest( | 657 int rv = stream_request_.StartRequest( |
645 session_, &stream_, | 658 session_, &stream_, |
646 base::Bind(&QuicHttpStream::OnStreamReady, weak_factory_.GetWeakPtr())); | 659 base::Bind(&QuicHttpStream::OnStreamReady, weak_factory_.GetWeakPtr())); |
647 if (rv == OK) { | 660 if (rv == OK) { |
648 stream_->SetDelegate(this); | 661 stream_->SetDelegate(this); |
649 if (request_info_->load_flags & LOAD_DISABLE_CONNECTION_MIGRATION) { | 662 if (request_info_->load_flags & LOAD_DISABLE_CONNECTION_MIGRATION) { |
650 stream_->DisableConnectionMigration(); | 663 stream_->DisableConnectionMigration(); |
651 } | 664 } |
652 if (response_info_) { | 665 if (response_info_) { |
653 next_state_ = STATE_SET_REQUEST_PRIORITY; | 666 next_state_ = STATE_SET_REQUEST_PRIORITY; |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
827 | 840 |
828 void QuicHttpStream::ResetStream() { | 841 void QuicHttpStream::ResetStream() { |
829 if (push_handle_) { | 842 if (push_handle_) { |
830 push_handle_->Cancel(); | 843 push_handle_->Cancel(); |
831 push_handle_ = nullptr; | 844 push_handle_ = nullptr; |
832 } | 845 } |
833 if (!stream_) | 846 if (!stream_) |
834 return; | 847 return; |
835 closed_stream_received_bytes_ = stream_->stream_bytes_read(); | 848 closed_stream_received_bytes_ = stream_->stream_bytes_read(); |
836 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | 849 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
850 closed_stream_id_ = stream_->id(); | |
837 stream_ = nullptr; | 851 stream_ = nullptr; |
838 | 852 |
839 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 853 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
840 // read. | 854 // read. |
841 if (request_body_stream_) | 855 if (request_body_stream_) |
842 request_body_stream_->Reset(); | 856 request_body_stream_->Reset(); |
843 } | 857 } |
844 | 858 |
845 } // namespace net | 859 } // namespace net |
OLD | NEW |