Adding basic support for posting tasks to a process thread.
BUG= R=magjed@webrtc.org Review URL: https://webrtc-codereview.appspot.com/41099004 Cr-Commit-Position: refs/heads/master@{#8614} git-svn-id: http://webrtc.googlecode.com/svn/trunk@8614 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
@ -17,6 +17,14 @@
|
||||
namespace webrtc {
|
||||
class Module;
|
||||
|
||||
class ProcessTask {
|
||||
public:
|
||||
ProcessTask() {}
|
||||
virtual ~ProcessTask() {}
|
||||
|
||||
virtual void Run() = 0;
|
||||
};
|
||||
|
||||
class ProcessThread {
|
||||
public:
|
||||
virtual ~ProcessThread();
|
||||
@ -36,6 +44,14 @@ class ProcessThread {
|
||||
// Can be called on any thread.
|
||||
virtual void WakeUp(Module* module) = 0;
|
||||
|
||||
// Queues a task object to run on the worker thread. Ownership of the
|
||||
// task object is transferred to the ProcessThread and the object will
|
||||
// either be deleted after running on the worker thread, or on the
|
||||
// construction thread of the ProcessThread instance, if the task did not
|
||||
// get a chance to run (e.g. posting the task while shutting down or when
|
||||
// the thread never runs).
|
||||
virtual void PostTask(rtc::scoped_ptr<ProcessTask> task) = 0;
|
||||
|
||||
// Adds a module that will start to receive callbacks on the worker thread.
|
||||
// Can be called from any thread.
|
||||
virtual void RegisterModule(Module* module) = 0;
|
||||
|
||||
Reference in New Issue
Block a user