| 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; | |
| 567 if (stream_->IsDoneReading()) { | 560 if (stream_->IsDoneReading()) { |
| 568 stream_->SetDelegate(nullptr); | 561 stream_->SetDelegate(nullptr); |
| 569 stream_->OnFinRead(); | 562 stream_->OnFinRead(); |
| 570 ResetStream(); | 563 ResetStream(); |
| 571 } | 564 } |
| 572 return rv; | 565 return rv; |
| 573 } | 566 } |
| 574 | 567 |
| 575 void QuicHttpStream::ResetStream() { | 568 void QuicHttpStream::ResetStream() { |
| 576 if (!stream_) | 569 if (!stream_) |
| 577 return; | 570 return; |
| 578 closed_stream_received_bytes_ = stream_->stream_bytes_read(); | 571 closed_stream_received_bytes_ = stream_->stream_bytes_read(); |
| 579 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | 572 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
| 580 stream_ = nullptr; | 573 stream_ = nullptr; |
| 581 | 574 |
| 582 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 575 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
| 583 // read. | 576 // read. |
| 584 if (request_body_stream_) | 577 if (request_body_stream_) |
| 585 request_body_stream_->Reset(); | 578 request_body_stream_->Reset(); |
| 586 } | 579 } |
| 587 | 580 |
| 588 } // namespace net | 581 } // namespace net |
| OLD | NEW |