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/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
550 response_info_->npn_negotiated_protocol = "quic/1+spdy/3"; | 550 response_info_->npn_negotiated_protocol = "quic/1+spdy/3"; |
551 response_info_->response_time = base::Time::Now(); | 551 response_info_->response_time = base::Time::Now(); |
552 response_info_->request_time = request_time_; | 552 response_info_->request_time = request_time_; |
553 response_headers_received_ = true; | 553 response_headers_received_ = true; |
554 | 554 |
555 return OK; | 555 return OK; |
556 } | 556 } |
557 | 557 |
558 int QuicHttpStream::ReadAvailableData(IOBuffer* buf, int buf_len) { | 558 int QuicHttpStream::ReadAvailableData(IOBuffer* buf, int buf_len) { |
559 int rv = stream_->Read(buf, buf_len); | 559 int rv = stream_->Read(buf, buf_len); |
| 560 // TODO(rtenneti): Temporary fix for crbug.com/585591. Added a check for null |
| 561 // |stream_| to fix crash bug. Delete |stream_| check and histogram after fix |
| 562 // is merged. |
| 563 bool null_stream = stream_ == nullptr; |
| 564 UMA_HISTOGRAM_BOOLEAN("Net.QuicReadAvailableData.NullStream", null_stream); |
| 565 if (null_stream) |
| 566 return rv; |
560 if (stream_->IsDoneReading()) { | 567 if (stream_->IsDoneReading()) { |
561 stream_->SetDelegate(nullptr); | 568 stream_->SetDelegate(nullptr); |
562 stream_->OnFinRead(); | 569 stream_->OnFinRead(); |
563 ResetStream(); | 570 ResetStream(); |
564 } | 571 } |
565 return rv; | 572 return rv; |
566 } | 573 } |
567 | 574 |
568 void QuicHttpStream::ResetStream() { | 575 void QuicHttpStream::ResetStream() { |
569 if (!stream_) | 576 if (!stream_) |
570 return; | 577 return; |
571 closed_stream_received_bytes_ = stream_->stream_bytes_read(); | 578 closed_stream_received_bytes_ = stream_->stream_bytes_read(); |
572 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | 579 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
573 stream_ = nullptr; | 580 stream_ = nullptr; |
574 | 581 |
575 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 582 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
576 // read. | 583 // read. |
577 if (request_body_stream_) | 584 if (request_body_stream_) |
578 request_body_stream_->Reset(); | 585 request_body_stream_->Reset(); |
579 } | 586 } |
580 | 587 |
581 } // namespace net | 588 } // namespace net |
OLD | NEW |