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

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

Issue 1769713002: Revert of "Revert 'QUIC - check for null stream_ before calling stream_'s IsDoneReading'" (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | tools/metrics/histograms/histograms.xml » ('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/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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after
701 response_info_->npn_negotiated_protocol = "quic/1+spdy/3"; 701 response_info_->npn_negotiated_protocol = "quic/1+spdy/3";
702 response_info_->response_time = base::Time::Now(); 702 response_info_->response_time = base::Time::Now();
703 response_info_->request_time = request_time_; 703 response_info_->request_time = request_time_;
704 response_headers_received_ = true; 704 response_headers_received_ = true;
705 705
706 return OK; 706 return OK;
707 } 707 }
708 708
709 int QuicHttpStream::ReadAvailableData(IOBuffer* buf, int buf_len) { 709 int QuicHttpStream::ReadAvailableData(IOBuffer* buf, int buf_len) {
710 int rv = stream_->Read(buf, buf_len); 710 int rv = stream_->Read(buf, buf_len);
711 // TODO(rtenneti): Temporary fix for crbug.com/585591. Added a check for null
712 // |stream_| to fix crash bug. Delete |stream_| check and histogram after fix
713 // is merged.
714 bool null_stream = stream_ == nullptr;
715 UMA_HISTOGRAM_BOOLEAN("Net.QuicReadAvailableData.NullStream", null_stream);
716 if (null_stream)
717 return rv;
711 if (stream_->IsDoneReading()) { 718 if (stream_->IsDoneReading()) {
712 stream_->SetDelegate(nullptr); 719 stream_->SetDelegate(nullptr);
713 stream_->OnFinRead(); 720 stream_->OnFinRead();
714 ResetStream(); 721 ResetStream();
715 } 722 }
716 return rv; 723 return rv;
717 } 724 }
718 725
719 void QuicHttpStream::ResetStream() { 726 void QuicHttpStream::ResetStream() {
720 if (push_handle_) { 727 if (push_handle_) {
721 push_handle_->Cancel(); 728 push_handle_->Cancel();
722 push_handle_ = nullptr; 729 push_handle_ = nullptr;
723 } 730 }
724 if (!stream_) 731 if (!stream_)
725 return; 732 return;
726 closed_stream_received_bytes_ = stream_->stream_bytes_read(); 733 closed_stream_received_bytes_ = stream_->stream_bytes_read();
727 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); 734 closed_stream_sent_bytes_ = stream_->stream_bytes_written();
728 stream_ = nullptr; 735 stream_ = nullptr;
729 736
730 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress 737 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress
731 // read. 738 // read.
732 if (request_body_stream_) 739 if (request_body_stream_)
733 request_body_stream_->Reset(); 740 request_body_stream_->Reset();
734 } 741 }
735 742
736 } // namespace net 743 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698