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

Unified Diff: webrtc/rtc_base/messagequeue.cc

Issue 2915253002: Delete SignalThread class. (Closed)
Patch Set: Another TODO on moving to QueuedTask. 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
« no previous file with comments | « webrtc/rtc_base/messagequeue.h ('k') | webrtc/rtc_base/nethelpers.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/rtc_base/messagequeue.cc
diff --git a/webrtc/rtc_base/messagequeue.cc b/webrtc/rtc_base/messagequeue.cc
index cafb70bd002faaf3241db5f9f4633b70767cb887..fce1906a41e0d5c5db6c07e0c5c4bd07ccf30cf8 100644
--- a/webrtc/rtc_base/messagequeue.cc
+++ b/webrtc/rtc_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 {
+ RunnableData* data = static_cast<RunnableData*>(msg->pdata);
+ data->Run();
+ delete data;
+ }
+};
+
} // namespace
//------------------------------------------------------------------
@@ -529,4 +539,12 @@ void MessageQueue::Dispatch(Message *pmsg) {
}
}
+void MessageQueue::PostFunctorInternal(const Location& posted_from,
+ RunnableData* 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
« no previous file with comments | « webrtc/rtc_base/messagequeue.h ('k') | webrtc/rtc_base/nethelpers.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698