Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(528)

Side by Side Diff: net/quic/chromium/quic_http_stream.cc

Issue 2341033002: Revert of Implement QuicHttpStream::GetLoadTimingInfo (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/chromium/quic_http_stream.h ('k') | net/quic/chromium/quic_http_stream_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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_is_first_stream_(false),
62 user_buffer_len_(0), 61 user_buffer_len_(0),
63 quic_connection_error_(QUIC_NO_ERROR), 62 quic_connection_error_(QUIC_NO_ERROR),
64 port_migration_detected_(false), 63 port_migration_detected_(false),
65 found_promise_(false), 64 found_promise_(false),
66 push_handle_(nullptr), 65 push_handle_(nullptr),
67 in_loop_(false), 66 in_loop_(false),
68 weak_factory_(this) { 67 weak_factory_(this) {
69 DCHECK(session_); 68 DCHECK(session_);
70 session_->AddObserver(this); 69 session_->AddObserver(this);
71 } 70 }
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
410 int64_t total_sent_bytes = headers_bytes_sent_; 409 int64_t total_sent_bytes = headers_bytes_sent_;
411 if (stream_) { 410 if (stream_) {
412 total_sent_bytes += stream_->stream_bytes_written(); 411 total_sent_bytes += stream_->stream_bytes_written();
413 } else { 412 } else {
414 total_sent_bytes += closed_stream_sent_bytes_; 413 total_sent_bytes += closed_stream_sent_bytes_;
415 } 414 }
416 return total_sent_bytes; 415 return total_sent_bytes;
417 } 416 }
418 417
419 bool QuicHttpStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const { 418 bool QuicHttpStream::GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const {
420 bool is_first_stream = closed_is_first_stream_; 419 // TODO(mmenke): Figure out what to do here.
421 if (stream_)
422 is_first_stream = stream_->IsFirstStream();
423 if (is_first_stream) {
424 load_timing_info->socket_reused = false;
425 load_timing_info->connect_timing = connect_timing_;
426 } else {
427 load_timing_info->socket_reused = true;
428 }
429 return true; 420 return true;
430 } 421 }
431 422
432 void QuicHttpStream::GetSSLInfo(SSLInfo* ssl_info) { 423 void QuicHttpStream::GetSSLInfo(SSLInfo* ssl_info) {
433 *ssl_info = ssl_info_; 424 *ssl_info = ssl_info_;
434 } 425 }
435 426
436 void QuicHttpStream::GetSSLCertRequestInfo( 427 void QuicHttpStream::GetSSLCertRequestInfo(
437 SSLCertRequestInfo* cert_request_info) { 428 SSLCertRequestInfo* cert_request_info) {
438 DCHECK(stream_); 429 DCHECK(stream_);
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
797 response_info_->connection_info = 788 response_info_->connection_info =
798 HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3; 789 HttpResponseInfo::CONNECTION_INFO_QUIC1_SPDY3;
799 response_info_->vary_data.Init(*request_info_, 790 response_info_->vary_data.Init(*request_info_,
800 *response_info_->headers.get()); 791 *response_info_->headers.get());
801 response_info_->was_npn_negotiated = true; 792 response_info_->was_npn_negotiated = true;
802 response_info_->npn_negotiated_protocol = "quic/1+spdy/3"; 793 response_info_->npn_negotiated_protocol = "quic/1+spdy/3";
803 response_info_->response_time = base::Time::Now(); 794 response_info_->response_time = base::Time::Now();
804 response_info_->request_time = request_time_; 795 response_info_->request_time = request_time_;
805 response_headers_received_ = true; 796 response_headers_received_ = true;
806 797
807 // Populate |connect_timing_| when response headers are received. This should
808 // take care of 0-RTT where request is sent before handshake is confirmed.
809 connect_timing_ = session_->GetConnectTiming();
810 return OK; 798 return OK;
811 } 799 }
812 800
813 int QuicHttpStream::ReadAvailableData(IOBuffer* buf, int buf_len) { 801 int QuicHttpStream::ReadAvailableData(IOBuffer* buf, int buf_len) {
814 int rv = stream_->Read(buf, buf_len); 802 int rv = stream_->Read(buf, buf_len);
815 // TODO(rtenneti): Temporary fix for crbug.com/585591. Added a check for null 803 // TODO(rtenneti): Temporary fix for crbug.com/585591. Added a check for null
816 // |stream_| to fix crash bug. Delete |stream_| check and histogram after fix 804 // |stream_| to fix crash bug. Delete |stream_| check and histogram after fix
817 // is merged. 805 // is merged.
818 bool null_stream = stream_ == nullptr; 806 bool null_stream = stream_ == nullptr;
819 UMA_HISTOGRAM_BOOLEAN("Net.QuicReadAvailableData.NullStream", null_stream); 807 UMA_HISTOGRAM_BOOLEAN("Net.QuicReadAvailableData.NullStream", null_stream);
820 if (null_stream) 808 if (null_stream)
821 return rv; 809 return rv;
822 if (stream_->IsDoneReading()) { 810 if (stream_->IsDoneReading()) {
823 stream_->SetDelegate(nullptr); 811 stream_->SetDelegate(nullptr);
824 stream_->OnFinRead(); 812 stream_->OnFinRead();
825 ResetStream(); 813 ResetStream();
826 } 814 }
827 return rv; 815 return rv;
828 } 816 }
829 817
830 void QuicHttpStream::ResetStream() { 818 void QuicHttpStream::ResetStream() {
831 if (push_handle_) { 819 if (push_handle_) {
832 push_handle_->Cancel(); 820 push_handle_->Cancel();
833 push_handle_ = nullptr; 821 push_handle_ = nullptr;
834 } 822 }
835 if (!stream_) 823 if (!stream_)
836 return; 824 return;
837 closed_stream_received_bytes_ = stream_->stream_bytes_read(); 825 closed_stream_received_bytes_ = stream_->stream_bytes_read();
838 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); 826 closed_stream_sent_bytes_ = stream_->stream_bytes_written();
839 closed_is_first_stream_ = stream_->IsFirstStream();
840 stream_ = nullptr; 827 stream_ = nullptr;
841 828
842 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress 829 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress
843 // read. 830 // read.
844 if (request_body_stream_) 831 if (request_body_stream_)
845 request_body_stream_->Reset(); 832 request_body_stream_->Reset();
846 } 833 }
847 834
848 } // namespace net 835 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/chromium/quic_http_stream.h ('k') | net/quic/chromium/quic_http_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698