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

Unified Diff: webrtc/base/platform_thread.h

Issue 2708723003: Introduce new constructor to PlatformThread. (Closed)
Patch Set: Update IncomingVideoStream again 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
Index: webrtc/base/platform_thread.h
diff --git a/webrtc/base/platform_thread.h b/webrtc/base/platform_thread.h
index 667407fabc4299b034ae7ad0203044ba6caecf89..78ab082df2d3bf2d82d117ba206682e198c34ed7 100644
--- a/webrtc/base/platform_thread.h
+++ b/webrtc/base/platform_thread.h
@@ -32,7 +32,8 @@ void SetCurrentThreadName(const char* name);
// Callback function that the spawned thread will enter once spawned.
// A return value of false is interpreted as that the function has no
// more work to do and that the thread can be released.
-typedef bool (*ThreadRunFunction)(void*);
+typedef bool (*ThreadRunFunctionDeprecated)(void*);
+typedef void (*ThreadRunFunction)(void*);
enum ThreadPriority {
#ifdef WEBRTC_WIN
@@ -55,7 +56,13 @@ enum ThreadPriority {
// called from the same thread, including instantiation.
class PlatformThread {
public:
- PlatformThread(ThreadRunFunction func, void* obj, const char* thread_name);
+ PlatformThread(ThreadRunFunctionDeprecated func,
+ void* obj,
+ const char* thread_name);
+ PlatformThread(ThreadRunFunction func,
+ void* obj,
+ const char* thread_name,
+ ThreadPriority priority = kNormalPriority);
virtual ~PlatformThread();
const std::string& name() const { return name_; }
@@ -74,6 +81,7 @@ class PlatformThread {
void Stop();
// Set the priority of the thread. Must be called when thread is running.
+ // TODO(tommi): Make private and only allow public support via ctor.
bool SetPriority(ThreadPriority priority);
protected:
@@ -85,12 +93,15 @@ class PlatformThread {
private:
void Run();
- ThreadRunFunction const run_function_;
+ ThreadRunFunctionDeprecated const run_function_deprecated_ = nullptr;
+ ThreadRunFunction const run_function_ = nullptr;
+ const ThreadPriority priority_ = kNormalPriority;
void* const obj_;
// TODO(pbos): Make sure call sites use string literals and update to a const
// char* instead of a std::string.
const std::string name_;
rtc::ThreadChecker thread_checker_;
+ rtc::ThreadChecker worker_thread_checker_;
the sun 2017/02/22 13:42:57 <bikeshed> "worker_thread..." makes me associate i
tommi 2017/02/22 15:04:00 Done. (went with spawned_thread_checker_)
#if defined(WEBRTC_WIN)
static DWORD WINAPI StartThread(void* param);

Powered by Google App Engine
This is Rietveld 408576698