| 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 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 |
| OLD | NEW |