Replace reentrant ASSERT checks in MessageQueueManager with a non-racy version.
ASSERT(!crit_.CurrentThreadIsOwner()) was racy due to use of a rtc::IsThreadRefEqual which cannot compare the thread handlers without a lock unless one is already sure it is the thread owning the crit.
Review-Url: https://codereview.webrtc.org/2131503002
Cr-Commit-Position: refs/heads/master@{#13411}
diff --git a/webrtc/base/messagequeue.h b/webrtc/base/messagequeue.h
index 15b9856..a1b20da 100644
--- a/webrtc/base/messagequeue.h
+++ b/webrtc/base/messagequeue.h
@@ -68,8 +68,11 @@
static MessageQueueManager* instance_;
// This list contains all live MessageQueues.
- std::vector<MessageQueue *> message_queues_;
+ std::vector<MessageQueue*> message_queues_ GUARDED_BY(crit_);
+
+ // Acquire this with DebugNonReentrantCritScope.
CriticalSection crit_;
+ bool locked_ GUARDED_BY(crit_);
};
// Derive from this for specialized data