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

Unified Diff: webrtc/base/asyncinvoker-inl.h

Issue 2703613006: Revert of Use std::unique_ptr instead of rtc::scoped_refptr in AsyncInvoker. (Closed)
Patch Set: Created 3 years, 10 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/base/asyncinvoker.cc ('k') | webrtc/base/messagequeue.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/asyncinvoker-inl.h
diff --git a/webrtc/base/asyncinvoker-inl.h b/webrtc/base/asyncinvoker-inl.h
index c3691b5659b78935fe6381fd744622cbc11030ef..15fafa888b1fca715f28bb8b4161432f82f9e538 100644
--- a/webrtc/base/asyncinvoker-inl.h
+++ b/webrtc/base/asyncinvoker-inl.h
@@ -15,6 +15,8 @@
#include "webrtc/base/callback.h"
#include "webrtc/base/criticalsection.h"
#include "webrtc/base/messagehandler.h"
+#include "webrtc/base/refcount.h"
+#include "webrtc/base/scoped_ref_ptr.h"
#include "webrtc/base/sigslot.h"
#include "webrtc/base/thread.h"
@@ -23,13 +25,15 @@
class AsyncInvoker;
// Helper class for AsyncInvoker. Runs a task and triggers a callback
-// on the calling thread if necessary.
-class AsyncClosure {
+// on the calling thread if necessary. Instances are ref-counted so their
+// lifetime can be independent of AsyncInvoker.
+class AsyncClosure : public RefCountInterface {
public:
- virtual ~AsyncClosure() {}
// Runs the asynchronous task, and triggers a callback to the calling
// thread if needed. Should be called from the target thread.
virtual void Execute() = 0;
+ protected:
+ ~AsyncClosure() override {}
};
// Simple closure that doesn't trigger a callback for the calling thread.
« no previous file with comments | « webrtc/base/asyncinvoker.cc ('k') | webrtc/base/messagequeue.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698