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 // TODO(rtenneti): Temporary while investigating crbug.com/585591. | |
9 #include "base/debug/debugger.h" | |
10 #include "base/debug/dump_without_crashing.h" | |
8 #include "base/metrics/histogram_macros.h" | 11 #include "base/metrics/histogram_macros.h" |
9 #include "base/strings/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
10 #include "net/base/io_buffer.h" | 13 #include "net/base/io_buffer.h" |
11 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
12 #include "net/http/http_response_headers.h" | 15 #include "net/http/http_response_headers.h" |
13 #include "net/http/http_util.h" | 16 #include "net/http/http_util.h" |
14 #include "net/quic/quic_chromium_client_session.h" | 17 #include "net/quic/quic_chromium_client_session.h" |
15 #include "net/quic/quic_chromium_client_stream.h" | 18 #include "net/quic/quic_chromium_client_stream.h" |
16 #include "net/quic/quic_http_utils.h" | 19 #include "net/quic/quic_http_utils.h" |
17 #include "net/quic/quic_utils.h" | 20 #include "net/quic/quic_utils.h" |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
549 response_info_->was_npn_negotiated = true; | 552 response_info_->was_npn_negotiated = true; |
550 response_info_->npn_negotiated_protocol = "quic/1+spdy/3"; | 553 response_info_->npn_negotiated_protocol = "quic/1+spdy/3"; |
551 response_info_->response_time = base::Time::Now(); | 554 response_info_->response_time = base::Time::Now(); |
552 response_info_->request_time = request_time_; | 555 response_info_->request_time = request_time_; |
553 response_headers_received_ = true; | 556 response_headers_received_ = true; |
554 | 557 |
555 return OK; | 558 return OK; |
556 } | 559 } |
557 | 560 |
558 int QuicHttpStream::ReadAvailableData(IOBuffer* buf, int buf_len) { | 561 int QuicHttpStream::ReadAvailableData(IOBuffer* buf, int buf_len) { |
562 // TODO(rtenneti): Temporary until crbug.com/585591 is solved. | |
563 CHECK(!read_is_called_); | |
ramant (doing other things)
2016/02/11 19:45:46
Assuming Read() is not a recursive call. If it cou
eroman
2016/02/12 01:42:46
I don't know enough about this code to say if this
ramant (doing other things)
2016/02/12 02:47:09
Acknowledged.
If there is a recursion and if that
| |
564 read_is_called_ = true; | |
565 stream_->set_read_is_called(read_is_called_); | |
566 | |
559 int rv = stream_->Read(buf, buf_len); | 567 int rv = stream_->Read(buf, buf_len); |
eroman
2016/02/12 01:42:46
I suggest calling stream_->CrashIfInvalid() before
ramant (doing other things)
2016/02/12 02:47:09
Done.
| |
568 // TODO(rtenneti): Temporary until crbug.com/585591 is solved. | |
569 // CrashIfInvalid() may not be necessary. See if |stream_| became a nullptr | |
570 // due to memory corruptions. | |
571 read_is_called_ = false; | |
eroman
2016/02/12 01:42:46
Might want to add CHECK(read_is_called_) here too,
ramant (doing other things)
2016/02/12 02:47:09
Done.
| |
572 stream_->set_read_is_called(read_is_called_); | |
573 stream_->CrashIfInvalid(); | |
ramant (doing other things)
2016/02/11 19:45:46
Added this CrashIfInvalid() in case some one stomp
| |
574 | |
560 if (stream_->IsDoneReading()) { | 575 if (stream_->IsDoneReading()) { |
561 stream_->SetDelegate(nullptr); | 576 stream_->SetDelegate(nullptr); |
562 stream_->OnFinRead(); | 577 stream_->OnFinRead(); |
563 ResetStream(); | 578 ResetStream(); |
564 } | 579 } |
565 return rv; | 580 return rv; |
566 } | 581 } |
567 | 582 |
568 void QuicHttpStream::ResetStream() { | 583 void QuicHttpStream::ResetStream() { |
584 // TODO(rtenneti): Temporary until crbug.com/585591 is solved. | |
585 if (read_is_called_) { | |
586 // |stream_| is going away when Read is called. Capture the callstack. | |
587 #if defined(NDEBUG) | |
eroman
2016/02/12 01:42:46
I think you can just CHECK(false) here -- if this
ramant (doing other things)
2016/02/12 02:47:09
Done.
| |
588 base::debug::DumpWithoutCrashing(); | |
589 #else | |
590 // Should never happen?? | |
591 CHECK(false); | |
592 #endif | |
593 } | |
569 if (!stream_) | 594 if (!stream_) |
570 return; | 595 return; |
571 closed_stream_received_bytes_ = stream_->stream_bytes_read(); | 596 closed_stream_received_bytes_ = stream_->stream_bytes_read(); |
572 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); | 597 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); |
573 stream_ = nullptr; | 598 stream_ = nullptr; |
574 | 599 |
575 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress | 600 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress |
576 // read. | 601 // read. |
577 if (request_body_stream_) | 602 if (request_body_stream_) |
578 request_body_stream_->Reset(); | 603 request_body_stream_->Reset(); |
579 } | 604 } |
580 | 605 |
581 } // namespace net | 606 } // namespace net |
OLD | NEW |