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

Unified Diff: net/quic/quic_http_stream.cc

Issue 2140673006: Add CHECK to make sure QuicHttpStream does not get destroyed during DoLoop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/quic/quic_http_stream.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/quic_http_stream.cc
diff --git a/net/quic/quic_http_stream.cc b/net/quic/quic_http_stream.cc
index 5009a2edf6d22c2576a4dffda433d3e31c94619c..1097feea2365331d4ff8173b163e77731554e330 100644
--- a/net/quic/quic_http_stream.cc
+++ b/net/quic/quic_http_stream.cc
@@ -6,6 +6,7 @@
#include <utility>
+#include "base/auto_reset.h"
#include "base/callback_helpers.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/string_split.h"
@@ -62,12 +63,14 @@ QuicHttpStream::QuicHttpStream(
port_migration_detected_(false),
found_promise_(false),
push_handle_(nullptr),
+ in_loop_(false),
weak_factory_(this) {
DCHECK(session_);
session_->AddObserver(this);
}
QuicHttpStream::~QuicHttpStream() {
+ CHECK(!in_loop_);
Close(false);
if (session_)
session_->RemoveObserver(this);
@@ -555,6 +558,7 @@ void QuicHttpStream::OnIOComplete(int rv) {
void QuicHttpStream::DoCallback(int rv) {
CHECK_NE(rv, ERR_IO_PENDING);
CHECK(!callback_.is_null());
+ CHECK(!in_loop_);
// The client callback can do anything, including destroying this class,
// so any pending callback must be issued after everything else is done.
@@ -562,6 +566,8 @@ void QuicHttpStream::DoCallback(int rv) {
}
int QuicHttpStream::DoLoop(int rv) {
+ CHECK(!in_loop_);
+ base::AutoReset<bool> auto_reset_in_loop(&in_loop_, true);
do {
State state = next_state_;
next_state_ = STATE_NONE;
« no previous file with comments | « net/quic/quic_http_stream.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698