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

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

Issue 2557403005: Avoid reentrancy in QuicHttpStream::HasSendHeadersComplete. (Closed)
Patch Set: Created 4 years 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 | « no previous file | no next file » | 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/chromium/quic_http_stream.h" 5 #include "net/quic/chromium/quic_http_stream.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 DoCallback(response_status_); 490 DoCallback(response_status_);
491 } 491 }
492 492
493 bool QuicHttpStream::HasSendHeadersComplete() { 493 bool QuicHttpStream::HasSendHeadersComplete() {
494 return next_state_ > STATE_SEND_HEADERS_COMPLETE; 494 return next_state_ > STATE_SEND_HEADERS_COMPLETE;
495 } 495 }
496 496
497 void QuicHttpStream::OnCryptoHandshakeConfirmed() { 497 void QuicHttpStream::OnCryptoHandshakeConfirmed() {
498 was_handshake_confirmed_ = true; 498 was_handshake_confirmed_ = true;
499 if (next_state_ == STATE_WAIT_FOR_CONFIRMATION_COMPLETE) { 499 if (next_state_ == STATE_WAIT_FOR_CONFIRMATION_COMPLETE) {
500 int rv = DoLoop(OK); 500 // Post a task to avoid reentrant calls into the session.
501 501 base::ThreadTaskRunnerHandle::Get()->PostTask(
502 if (rv != ERR_IO_PENDING && !callback_.is_null()) { 502 FROM_HERE, base::Bind(&QuicHttpStream::OnIOComplete,
503 DoCallback(rv); 503 weak_factory_.GetWeakPtr(), OK));
504 }
505 } 504 }
506 } 505 }
507 506
508 void QuicHttpStream::OnSuccessfulVersionNegotiation( 507 void QuicHttpStream::OnSuccessfulVersionNegotiation(
509 const QuicVersion& version) { 508 const QuicVersion& version) {
510 quic_version_ = version; 509 quic_version_ = version;
511 } 510 }
512 511
513 void QuicHttpStream::OnSessionClosed(int error, bool port_migration_detected) { 512 void QuicHttpStream::OnSessionClosed(int error, bool port_migration_detected) {
514 Close(false); 513 Close(false);
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
813 closed_is_first_stream_ = stream_->IsFirstStream(); 812 closed_is_first_stream_ = stream_->IsFirstStream();
814 stream_ = nullptr; 813 stream_ = nullptr;
815 814
816 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress 815 // If |request_body_stream_| is non-NULL, Reset it, to abort any in progress
817 // read. 816 // read.
818 if (request_body_stream_) 817 if (request_body_stream_)
819 request_body_stream_->Reset(); 818 request_body_stream_->Reset();
820 } 819 }
821 820
822 } // namespace net 821 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698