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

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

Issue 1688003005: QUIC - instrumentation for testing null QuicSpdyStream. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 10 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 | « net/quic/quic_http_stream.h ('k') | net/quic/quic_spdy_stream.h » ('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/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
(...skipping 538 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 response_info_->was_npn_negotiated = true; 549 response_info_->was_npn_negotiated = true;
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 // TODO(rtenneti): Temporary until crbug.com/585591 is solved.
560 CHECK(!read_in_progress_);
561 read_in_progress_ = true;
562 stream_->CrashIfInvalid();
563 stream_->set_read_in_progress(read_in_progress_);
564
559 int rv = stream_->Read(buf, buf_len); 565 int rv = stream_->Read(buf, buf_len);
566 // TODO(rtenneti): Temporary until crbug.com/585591 is solved.
567 CHECK(read_in_progress_);
568 read_in_progress_ = false;
569 stream_->set_read_in_progress(read_in_progress_);
570 // CrashIfInvalid() may not be necessary. See if |stream_| became a nullptr
571 // due to memory corruptions.
572 stream_->CrashIfInvalid();
573
560 if (stream_->IsDoneReading()) { 574 if (stream_->IsDoneReading()) {
561 stream_->SetDelegate(nullptr); 575 stream_->SetDelegate(nullptr);
562 stream_->OnFinRead(); 576 stream_->OnFinRead();
563 ResetStream(); 577 ResetStream();
564 } 578 }
565 return rv; 579 return rv;
566 } 580 }
567 581
568 void QuicHttpStream::ResetStream() { 582 void QuicHttpStream::ResetStream() {
583 // TODO(rtenneti): Temporary until crbug.com/585591 is solved.
584 if (read_in_progress_) {
585 // |stream_| is going away when Read is called. Should never happen??
586 CHECK(false);
587 }
569 if (!stream_) 588 if (!stream_)
570 return; 589 return;
571 closed_stream_received_bytes_ = stream_->stream_bytes_read(); 590 closed_stream_received_bytes_ = stream_->stream_bytes_read();
572 closed_stream_sent_bytes_ = stream_->stream_bytes_written(); 591 closed_stream_sent_bytes_ = stream_->stream_bytes_written();
573 stream_ = nullptr; 592 stream_ = nullptr;
574 593
575 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress 594 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress
576 // read. 595 // read.
577 if (request_body_stream_) 596 if (request_body_stream_)
578 request_body_stream_->Reset(); 597 request_body_stream_->Reset();
579 } 598 }
580 599
581 } // namespace net 600 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_http_stream.h ('k') | net/quic/quic_spdy_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698