Index: base/threading/platform_thread.h |
diff --git a/base/threading/platform_thread.h b/base/threading/platform_thread.h |
index 28743145610c70fe14f8c8fdd1e377a9aa861528..653961ddfae05b34ddbf3def5fbe91f20e523c51 100644 |
--- a/base/threading/platform_thread.h |
+++ b/base/threading/platform_thread.h |
@@ -110,15 +110,17 @@ class PlatformThreadHandle { |
const PlatformThreadId kInvalidThreadId(0); |
-// Valid values for SetThreadPriority() |
-enum ThreadPriority{ |
- kThreadPriority_Normal, |
- // Suitable for low-latency, glitch-resistant audio. |
- kThreadPriority_RealtimeAudio, |
- // Suitable for threads which generate data for the display (at ~60Hz). |
- kThreadPriority_Display, |
+// Valid values for SetThreadPriority(), listed in increasing order of |
+// importance. |
+enum class ThreadPriority { |
// Suitable for threads that shouldn't disrupt high priority work. |
- kThreadPriority_Background |
+ BACKGROUND, |
+ // Default priority level. |
+ NORMAL, |
+ // Suitable for threads which generate data for the display (at ~60Hz). |
+ DISPLAY, |
+ // Suitable for low-latency, glitch-resistant audio. |
+ REALTIME_AUDIO, |
}; |
// A namespace for low-level thread functions. |
@@ -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 Windows, this is 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); |
}; |