Relanding: Use std::unique_ptr instead of rtc::scoped_refptr in AsyncInvoker.
The AsyncClosures only ever have one thing referencing them, so they should be using std::unique_ptr to manage ownership. Maybe this code was written before std::unique_ptr was available. Originally reverted because it made a change to ScopedMessageData that wasn't backwards compatible, and applications using the rtc::Thread infrastructure may be using it. BUG=None NOTRY=True Review-Url: https://codereview.webrtc.org/2689233003 Cr-Commit-Position: refs/heads/master@{#16684}
This commit is contained in:
@ -15,8 +15,6 @@
|
||||
#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"
|
||||
|
||||
@ -25,15 +23,13 @@ namespace rtc {
|
||||
class AsyncInvoker;
|
||||
|
||||
// Helper class for AsyncInvoker. Runs a task and triggers a callback
|
||||
// on the calling thread if necessary. Instances are ref-counted so their
|
||||
// lifetime can be independent of AsyncInvoker.
|
||||
class AsyncClosure : public RefCountInterface {
|
||||
// on the calling thread if necessary.
|
||||
class AsyncClosure {
|
||||
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.
|
||||
|
||||
Reference in New Issue
Block a user