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

Unified Diff: webrtc/base/asyncinvoker.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 | « no previous file | webrtc/base/asyncinvoker.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/asyncinvoker.h
diff --git a/webrtc/base/asyncinvoker.h b/webrtc/base/asyncinvoker.h
index 43fffeac10568526755d097ec9b167f83811a001..d91e30601eff620aaec65537ee47632187a705c5 100644
--- a/webrtc/base/asyncinvoker.h
+++ b/webrtc/base/asyncinvoker.h
@@ -11,13 +11,11 @@
#ifndef WEBRTC_BASE_ASYNCINVOKER_H_
#define WEBRTC_BASE_ASYNCINVOKER_H_
-#include <memory>
-#include <utility>
-
#include "webrtc/base/asyncinvoker-inl.h"
#include "webrtc/base/bind.h"
#include "webrtc/base/constructormagic.h"
#include "webrtc/base/sigslot.h"
+#include "webrtc/base/scopedptrcollection.h"
#include "webrtc/base/thread.h"
namespace rtc {
@@ -81,9 +79,9 @@
Thread* thread,
const FunctorT& functor,
uint32_t id = 0) {
- std::unique_ptr<AsyncClosure> closure(
- new FireAndForgetAsyncClosure<FunctorT>(functor));
- DoInvoke(posted_from, thread, std::move(closure), id);
+ scoped_refptr<AsyncClosure> closure(
+ new RefCountedObject<FireAndForgetAsyncClosure<FunctorT> >(functor));
+ DoInvoke(posted_from, thread, closure, id);
}
// Call |functor| asynchronously on |thread| with |delay_ms|, with no callback
@@ -94,9 +92,9 @@
const FunctorT& functor,
uint32_t delay_ms,
uint32_t id = 0) {
- std::unique_ptr<AsyncClosure> closure(
- new FireAndForgetAsyncClosure<FunctorT>(functor));
- DoInvokeDelayed(posted_from, thread, std::move(closure), delay_ms, id);
+ scoped_refptr<AsyncClosure> closure(
+ new RefCountedObject<FireAndForgetAsyncClosure<FunctorT> >(functor));
+ DoInvokeDelayed(posted_from, thread, closure, delay_ms, id);
}
// Call |functor| asynchronously on |thread|, calling |callback| when done.
@@ -110,11 +108,11 @@
void (HostT::*callback)(ReturnT),
HostT* callback_host,
uint32_t id = 0) {
- std::unique_ptr<AsyncClosure> closure(
- new NotifyingAsyncClosure<ReturnT, FunctorT, HostT>(
+ scoped_refptr<AsyncClosure> closure(
+ new RefCountedObject<NotifyingAsyncClosure<ReturnT, FunctorT, HostT> >(
this, callback_posted_from, Thread::Current(), functor, callback,
callback_host));
- DoInvoke(posted_from, thread, std::move(closure), id);
+ DoInvoke(posted_from, thread, closure, id);
}
// Call |functor| asynchronously on |thread|, calling |callback| when done.
@@ -129,11 +127,11 @@
void (HostT::*callback)(),
HostT* callback_host,
uint32_t id = 0) {
- std::unique_ptr<AsyncClosure> closure(
- new NotifyingAsyncClosure<void, FunctorT, HostT>(
+ scoped_refptr<AsyncClosure> closure(
+ new RefCountedObject<NotifyingAsyncClosure<void, FunctorT, HostT> >(
this, callback_posted_from, Thread::Current(), functor, callback,
callback_host));
- DoInvoke(posted_from, thread, std::move(closure), id);
+ DoInvoke(posted_from, thread, closure, id);
}
// Synchronously execute on |thread| all outstanding calls we own
@@ -150,11 +148,11 @@
void OnMessage(Message* msg) override;
void DoInvoke(const Location& posted_from,
Thread* thread,
- std::unique_ptr<AsyncClosure> closure,
+ const scoped_refptr<AsyncClosure>& closure,
uint32_t id);
void DoInvokeDelayed(const Location& posted_from,
Thread* thread,
- std::unique_ptr<AsyncClosure> closure,
+ const scoped_refptr<AsyncClosure>& closure,
uint32_t delay_ms,
uint32_t id);
bool destroying_;
« no previous file with comments | « no previous file | webrtc/base/asyncinvoker.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698