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

Unified Diff: webrtc/base/platform_thread.h

Issue 2708723003: Introduce new constructor to PlatformThread. (Closed)
Patch Set: Disable RTC_DCHECK in channel_proxy + add TODO 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 | « webrtc/base/event_tracer.cc ('k') | webrtc/base/platform_thread.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/platform_thread.h
diff --git a/webrtc/base/platform_thread.h b/webrtc/base/platform_thread.h
index 667407fabc4299b034ae7ad0203044ba6caecf89..ed26ca03cc70d1e2d05814b05733c02d34241de8 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 spawned_thread_checker_;
#if defined(WEBRTC_WIN)
static DWORD WINAPI StartThread(void* param);
« no previous file with comments | « webrtc/base/event_tracer.cc ('k') | webrtc/base/platform_thread.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698