2011-07-07 08:21:25 +00:00
|
|
|
/*
|
|
|
|
|
* Copyright (c) 2011 The WebRTC project authors. All Rights Reserved.
|
|
|
|
|
*
|
|
|
|
|
* Use of this source code is governed by a BSD-style license
|
|
|
|
|
* that can be found in the LICENSE file in the root of the source
|
|
|
|
|
* tree. An additional intellectual property rights grant can be found
|
|
|
|
|
* in the file PATENTS. All contributing project authors may
|
|
|
|
|
* be found in the AUTHORS file in the root of the source tree.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#ifndef WEBRTC_MODULES_UTILITY_INTERFACE_PROCESS_THREAD_H_
|
|
|
|
|
#define WEBRTC_MODULES_UTILITY_INTERFACE_PROCESS_THREAD_H_
|
|
|
|
|
|
2013-07-12 08:28:10 +00:00
|
|
|
#include "webrtc/typedefs.h"
|
2015-02-06 09:44:12 +00:00
|
|
|
#include "webrtc/base/scoped_ptr.h"
|
2011-07-07 08:21:25 +00:00
|
|
|
|
|
|
|
|
namespace webrtc {
|
|
|
|
|
class Module;
|
|
|
|
|
|
2015-02-06 09:44:12 +00:00
|
|
|
class ProcessThread {
|
|
|
|
|
public:
|
|
|
|
|
virtual ~ProcessThread();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-02-06 09:44:12 +00:00
|
|
|
static rtc::scoped_ptr<ProcessThread> Create();
|
2011-07-07 08:21:25 +00:00
|
|
|
|
2015-02-06 09:44:12 +00:00
|
|
|
// Starts the worker thread. Must be called from the construction thread.
|
2015-02-27 13:36:34 +00:00
|
|
|
virtual void Start() = 0;
|
2015-02-06 09:44:12 +00:00
|
|
|
|
|
|
|
|
// Stops the worker thread. Must be called from the construction thread.
|
2015-02-27 13:36:34 +00:00
|
|
|
virtual void Stop() = 0;
|
2015-02-06 09:44:12 +00:00
|
|
|
|
|
|
|
|
// Wakes the thread up to give a module a chance to do processing right
|
|
|
|
|
// away. This causes the worker thread to wake up and requery the specified
|
|
|
|
|
// module for when it should be called back. (Typically the module should
|
|
|
|
|
// return 0 from TimeUntilNextProcess on the worker thread at that point).
|
|
|
|
|
// Can be called on any thread.
|
|
|
|
|
virtual void WakeUp(Module* module) = 0;
|
|
|
|
|
|
|
|
|
|
// Adds a module that will start to receive callbacks on the worker thread.
|
|
|
|
|
// Can be called from any thread.
|
2015-02-27 13:36:34 +00:00
|
|
|
virtual void RegisterModule(Module* module) = 0;
|
2015-02-06 09:44:12 +00:00
|
|
|
|
|
|
|
|
// Removes a previously registered module.
|
|
|
|
|
// Can be called from any thread.
|
2015-02-27 13:36:34 +00:00
|
|
|
virtual void DeRegisterModule(Module* module) = 0;
|
2011-07-07 08:21:25 +00:00
|
|
|
};
|
2015-02-06 09:44:12 +00:00
|
|
|
|
2013-07-03 15:12:26 +00:00
|
|
|
} // namespace webrtc
|
2015-02-06 09:44:12 +00:00
|
|
|
|
2011-07-07 08:21:25 +00:00
|
|
|
#endif // WEBRTC_MODULES_UTILITY_INTERFACE_PROCESS_THREAD_H_
|