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

Unified Diff: webrtc/base/messagequeue.cc

Issue 2915253002: Delete SignalThread class. (Closed)
Patch Set: Fix template magic. Naming and formatting fixes. Created 3 years, 6 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 cafb70bd002faaf3241db5f9f4633b70767cb887..0eaf747cc6d7966411315685365be9d06d2cfd5c 100644
--- a/webrtc/base/messagequeue.cc
+++ b/webrtc/base/messagequeue.cc
@@ -44,6 +44,16 @@ class SCOPED_LOCKABLE DebugNonReentrantCritScope {
RTC_DISALLOW_COPY_AND_ASSIGN(DebugNonReentrantCritScope);
};
+
+class FunctorPostMessageHandler : public MessageHandler {
+ public:
+ void OnMessage(Message* msg) override {
+ CallableData* data = static_cast<CallableData*>(msg->pdata);
+ data->Call();
+ delete data;
+ }
+};
+
} // namespace
//------------------------------------------------------------------
@@ -529,4 +539,12 @@ void MessageQueue::Dispatch(Message *pmsg) {
}
}
+void MessageQueue::PostFunctorInternal(const Location& posted_from,
+ CallableData* message_data) {
+ // Use static to ensure it outlives this scope. Safe since
+ // FunctorPostMessageHandler keeps no state.
+ static FunctorPostMessageHandler handler;
+ Post(posted_from, &handler, 0, message_data);
+}
+
} // namespace rtc

Powered by Google App Engine
This is Rietveld 408576698