Chromium Code Reviews| Index: base/threading/platform_thread_win.cc |
| diff --git a/base/threading/platform_thread_win.cc b/base/threading/platform_thread_win.cc |
| index 395fc9e20173ad00797c85248584a9d7d1826d7d..520fcd353b2cb1d12e6734ad49635936248b69b3 100644 |
| --- a/base/threading/platform_thread_win.cc |
| +++ b/base/threading/platform_thread_win.cc |
| @@ -195,7 +195,7 @@ bool PlatformThread::CreateWithPriority(size_t stack_size, Delegate* delegate, |
| ThreadPriority priority) { |
| bool result = Create(stack_size, delegate, thread_handle); |
| if (result) |
| - SetThreadPriority(*thread_handle, priority); |
| + SetCurrentThreadPriority(priority); |
|
gab
2015/06/23 17:01:32
Hmm, this is incorrect no? This code runs on the t
Takashi Toyoshima
2015/06/24 04:15:39
Oops, thank you for catching this.
Yes, definitely
|
| return result; |
| } |
| @@ -231,10 +231,7 @@ void PlatformThread::Join(PlatformThreadHandle thread_handle) { |
| } |
| // static |
| -void PlatformThread::SetThreadPriority(PlatformThreadHandle handle, |
| - ThreadPriority priority) { |
| - DCHECK(!handle.is_null()); |
| - |
| +void PlatformThread::SetCurrentThreadPriority(ThreadPriority priority) { |
| int desired_priority = THREAD_PRIORITY_ERROR_RETURN; |
| switch (priority) { |
| case ThreadPriority::BACKGROUND: |
| @@ -258,16 +255,16 @@ void PlatformThread::SetThreadPriority(PlatformThreadHandle handle, |
| #ifndef NDEBUG |
| const BOOL success = |
| #endif |
| - ::SetThreadPriority(handle.platform_handle(), desired_priority); |
| + ::SetThreadPriority(PlatformThread::CurrentHandle().platform_handle(), |
| + desired_priority); |
| DPLOG_IF(ERROR, !success) << "Failed to set thread priority to " |
| << desired_priority; |
| } |
| // static |
| -ThreadPriority PlatformThread::GetThreadPriority(PlatformThreadHandle handle) { |
| - DCHECK(!handle.is_null()); |
| - |
| - int priority = ::GetThreadPriority(handle.platform_handle()); |
| +ThreadPriority PlatformThread::GetCurrentThreadPriority() { |
| + int priority = |
| + ::GetThreadPriority(PlatformThread::CurrentHandle().platform_handle()); |
| switch (priority) { |
| case THREAD_PRIORITY_LOWEST: |
| return ThreadPriority::BACKGROUND; |