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

Unified Diff: webrtc/base/task_queue.h

Issue 2708353003: Add support for priorities to TaskQueue. (Closed)
Patch Set: Rebase 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 | « no previous file | webrtc/base/task_queue_gcd.cc » ('j') | webrtc/base/task_queue_libevent.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/task_queue.h
diff --git a/webrtc/base/task_queue.h b/webrtc/base/task_queue.h
index 92a1c9477a090cacc7fb4652ccc578a47f3cc359..a1f3def4b2a08de2919c9c997d21da69b584c4ff 100644
--- a/webrtc/base/task_queue.h
+++ b/webrtc/base/task_queue.h
@@ -161,8 +161,15 @@ static std::unique_ptr<QueuedTask> NewClosure(const Closure& closure,
// so assumptions about lifetimes of pending tasks should not be made.
class LOCKABLE TaskQueue {
public:
- explicit TaskQueue(const char* queue_name);
- // TODO(tommi): Implement move semantics?
the sun 2017/02/24 09:03:43 Did you mean to remove comment? (FYI: Move semanti
tommi 2017/02/24 17:34:41 Yeah that's why I removed it. If we find we need i
+ // TaskQueue priority levels. On some platforms these will map to thread
+ // priorities, on others such as Mac and iOS, GCD queue priorities.
+ enum Priority {
the sun 2017/02/24 09:03:43 We can use enum class these days
tommi 2017/02/24 17:34:41 oooh! completely forgot - Done!
+ NORMAL = 0,
+ HIGH,
+ LOW,
+ };
+
+ explicit TaskQueue(const char* queue_name, Priority priority = NORMAL);
~TaskQueue();
static TaskQueue* Current();
@@ -275,8 +282,11 @@ class LOCKABLE TaskQueue {
class WorkerThread : public PlatformThread {
public:
- WorkerThread(ThreadRunFunction func, void* obj, const char* thread_name)
- : PlatformThread(func, obj, thread_name) {}
+ WorkerThread(ThreadRunFunction func,
+ void* obj,
+ const char* thread_name,
+ ThreadPriority priority)
+ : PlatformThread(func, obj, thread_name, priority) {}
bool QueueAPC(PAPCFUNC apc_function, ULONG_PTR data) {
return PlatformThread::QueueAPC(apc_function, data);
« no previous file with comments | « no previous file | webrtc/base/task_queue_gcd.cc » ('j') | webrtc/base/task_queue_libevent.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698