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

Unified Diff: webrtc/base/messagequeue.cc

Issue 1895933003: Adding the ability to use a simulated clock for unit tests. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 4 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
Index: webrtc/base/messagequeue.cc
diff --git a/webrtc/base/messagequeue.cc b/webrtc/base/messagequeue.cc
index 61aa61192bbad69d87ddf5e79aab3a5af3ce290f..140dd672244e9210efac0ca07bf6bd4cc27afde5 100644
--- a/webrtc/base/messagequeue.cc
+++ b/webrtc/base/messagequeue.cc
@@ -113,6 +113,27 @@ void MessageQueueManager::ClearInternal(MessageHandler *handler) {
(*iter)->Clear(handler);
}
+class NoOpMessageHandler : public MessageHandler {
+ public:
+ void OnMessage(Message* msg) override {}
+};
+
+void MessageQueueManager::WakeAllMessageQueues() {
+ if (!instance_) {
+ return;
+ }
+ return Instance()->WakeAllMessageQueuesInternal();
+}
+void MessageQueueManager::WakeAllMessageQueuesInternal() {
+#if CS_DEBUG_CHECKS // CurrentThreadIsOwner returns true by default.
+ ASSERT(!crit_.CurrentThreadIsOwner()); // See note above.
+#endif
+ CritScope cs(&crit_);
+ for (MessageQueue* queue : message_queues_) {
+ queue->Post(new NoOpMessageHandler(), 0);
+ }
+}
+
//------------------------------------------------------------------
// MessageQueue

Powered by Google App Engine
This is Rietveld 408576698