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

Unified Diff: base/threading/platform_thread.h

Issue 1006933003: Add full SetThreadPriority support to Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 9 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 | base/threading/platform_thread_android.cc » ('j') | base/threading/platform_thread_freebsd.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/threading/platform_thread.h
diff --git a/base/threading/platform_thread.h b/base/threading/platform_thread.h
index 28743145610c70fe14f8c8fdd1e377a9aa861528..5d0c537bb843084fc089f7a3e7ed34e27aa5a25a 100644
--- a/base/threading/platform_thread.h
+++ b/base/threading/platform_thread.h
@@ -111,13 +111,15 @@ class PlatformThreadHandle {
const PlatformThreadId kInvalidThreadId(0);
// Valid values for SetThreadPriority()
-enum ThreadPriority{
+enum ThreadPriority {
kThreadPriority_Normal,
rvargas (doing something else) 2015/03/19 22:19:21 Let's order this according to priority.
gab 2015/03/30 20:14:45 I was thinking about that too, but I was thinking
rvargas (doing something else) 2015/03/30 22:31:22 I doesn't have to be part of this CL, but we need
// Suitable for low-latency, glitch-resistant audio.
kThreadPriority_RealtimeAudio,
// Suitable for threads which generate data for the display (at ~60Hz).
kThreadPriority_Display,
- // Suitable for threads that shouldn't disrupt high priority work.
+ // Suitable for threads that shouldn't disrupt high priority work. Extra
+ // background properties (low IO/memory priority) can be achieved on some
+ // platforms if this mode is set from the current thread.
rvargas (doing something else) 2015/03/19 22:19:21 nit: "if this mode"? Do you mean this priority?
gab 2015/03/30 20:14:45 Done.
kThreadPriority_Background
};
@@ -141,7 +143,10 @@ class BASE_EXPORT PlatformThread {
// we're on the right thread quickly.
static PlatformThreadRef CurrentRef();
- // Get the current handle.
+ // Get the handle representing the current thread. On some platforms, this can
+ // be a pseudo handle constant which will always represent the thread using it
+ // and hence should not be shared with other threads nor be used to
+ // differentiate the current thread from another.
static PlatformThreadHandle CurrentHandle();
// Yield the current thread so another thread can be scheduled.
@@ -171,9 +176,7 @@ class BASE_EXPORT PlatformThread {
// CreateWithPriority() does the same thing as Create() except the priority of
// the thread is set based on |priority|. Can be used in place of Create()
- // followed by SetThreadPriority(). SetThreadPriority() has not been
- // implemented on the Linux platform yet, this is the only way to get a high
- // priority thread on Linux.
+ // followed by SetThreadPriority().
static bool CreateWithPriority(size_t stack_size, Delegate* delegate,
PlatformThreadHandle* thread_handle,
ThreadPriority priority);
@@ -191,6 +194,8 @@ class BASE_EXPORT PlatformThread {
static void SetThreadPriority(PlatformThreadHandle handle,
ThreadPriority priority);
+ static ThreadPriority GetThreadPriority(PlatformThreadHandle handle);
+
private:
DISALLOW_IMPLICIT_CONSTRUCTORS(PlatformThread);
};
« no previous file with comments | « no previous file | base/threading/platform_thread_android.cc » ('j') | base/threading/platform_thread_freebsd.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698