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

Unified Diff: net/spdy/spdy_write_queue.cc

Issue 265093004: SPDY: Add a bunch of CHECKs into SpdyWriteQueue to detect re-entrancy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add more removing_writes_. Created 6 years, 8 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/spdy/spdy_write_queue.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_write_queue.cc
diff --git a/net/spdy/spdy_write_queue.cc b/net/spdy/spdy_write_queue.cc
index 3a4eef5fea67df0a6975104b05c21e2b3e929171..1d6937449c5d9bea39b88b6e5d122267d07c9e28 100644
--- a/net/spdy/spdy_write_queue.cc
+++ b/net/spdy/spdy_write_queue.cc
@@ -26,7 +26,7 @@ SpdyWriteQueue::PendingWrite::PendingWrite(
SpdyWriteQueue::PendingWrite::~PendingWrite() {}
-SpdyWriteQueue::SpdyWriteQueue() {}
+SpdyWriteQueue::SpdyWriteQueue() : removing_writes_(false) {}
SpdyWriteQueue::~SpdyWriteQueue() {
Clear();
@@ -55,6 +55,7 @@ void SpdyWriteQueue::Enqueue(RequestPriority priority,
bool SpdyWriteQueue::Dequeue(SpdyFrameType* frame_type,
scoped_ptr<SpdyBufferProducer>* frame_producer,
base::WeakPtr<SpdyStream>* stream) {
+ CHECK(!removing_writes_);
for (int i = MAXIMUM_PRIORITY; i >= MINIMUM_PRIORITY; --i) {
if (!queue_[i].empty()) {
PendingWrite pending_write = queue_[i].front();
@@ -72,6 +73,8 @@ bool SpdyWriteQueue::Dequeue(SpdyFrameType* frame_type,
void SpdyWriteQueue::RemovePendingWritesForStream(
const base::WeakPtr<SpdyStream>& stream) {
+ CHECK(!removing_writes_);
+ removing_writes_ = true;
RequestPriority priority = stream->priority();
CHECK_GE(priority, MINIMUM_PRIORITY);
CHECK_LE(priority, MAXIMUM_PRIORITY);
@@ -103,10 +106,13 @@ void SpdyWriteQueue::RemovePendingWritesForStream(
}
}
queue->erase(out_it, queue->end());
+ removing_writes_ = false;
}
void SpdyWriteQueue::RemovePendingWritesForStreamsAfter(
SpdyStreamId last_good_stream_id) {
+ CHECK(!removing_writes_);
+ removing_writes_ = true;
for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) {
// Do the actual deletion and removal, preserving FIFO-ness.
std::deque<PendingWrite>* queue = &queue_[i];
@@ -123,9 +129,12 @@ void SpdyWriteQueue::RemovePendingWritesForStreamsAfter(
}
queue->erase(out_it, queue->end());
}
+ removing_writes_ = false;
}
void SpdyWriteQueue::Clear() {
+ CHECK(!removing_writes_);
+ removing_writes_ = true;
for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) {
for (std::deque<PendingWrite>::iterator it = queue_[i].begin();
it != queue_[i].end(); ++it) {
@@ -133,6 +142,7 @@ void SpdyWriteQueue::Clear() {
}
queue_[i].clear();
}
+ removing_writes_ = false;
}
} // namespace net
« no previous file with comments | « net/spdy/spdy_write_queue.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698