OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/threading/platform_thread.h" | 5 #include "base/threading/platform_thread.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/debug/alias.h" | 9 #include "base/debug/alias.h" |
10 #include "base/debug/profiler.h" | 10 #include "base/debug/profiler.h" |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 break; | 239 break; |
240 case ThreadPriority::REALTIME_AUDIO: | 240 case ThreadPriority::REALTIME_AUDIO: |
241 desired_priority = THREAD_PRIORITY_TIME_CRITICAL; | 241 desired_priority = THREAD_PRIORITY_TIME_CRITICAL; |
242 break; | 242 break; |
243 default: | 243 default: |
244 NOTREACHED() << "Unknown priority."; | 244 NOTREACHED() << "Unknown priority."; |
245 break; | 245 break; |
246 } | 246 } |
247 DCHECK_NE(desired_priority, THREAD_PRIORITY_ERROR_RETURN); | 247 DCHECK_NE(desired_priority, THREAD_PRIORITY_ERROR_RETURN); |
248 | 248 |
249 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON) | 249 #if DCHECK_IS_ON() |
250 const BOOL success = | 250 const BOOL success = |
251 #endif | 251 #endif |
252 ::SetThreadPriority(PlatformThread::CurrentHandle().platform_handle(), | 252 ::SetThreadPriority(PlatformThread::CurrentHandle().platform_handle(), |
253 desired_priority); | 253 desired_priority); |
254 DPLOG_IF(ERROR, !success) << "Failed to set thread priority to " | 254 DPLOG_IF(ERROR, !success) << "Failed to set thread priority to " |
255 << desired_priority; | 255 << desired_priority; |
256 } | 256 } |
257 | 257 |
258 // static | 258 // static |
259 ThreadPriority PlatformThread::GetCurrentThreadPriority() { | 259 ThreadPriority PlatformThread::GetCurrentThreadPriority() { |
(...skipping 10 matching lines...) Expand all Loading... |
270 return ThreadPriority::REALTIME_AUDIO; | 270 return ThreadPriority::REALTIME_AUDIO; |
271 case THREAD_PRIORITY_ERROR_RETURN: | 271 case THREAD_PRIORITY_ERROR_RETURN: |
272 DPCHECK(false) << "GetThreadPriority error"; // Falls through. | 272 DPCHECK(false) << "GetThreadPriority error"; // Falls through. |
273 default: | 273 default: |
274 NOTREACHED() << "Unexpected priority: " << priority; | 274 NOTREACHED() << "Unexpected priority: " << priority; |
275 return ThreadPriority::NORMAL; | 275 return ThreadPriority::NORMAL; |
276 } | 276 } |
277 } | 277 } |
278 | 278 |
279 } // namespace base | 279 } // namespace base |
OLD | NEW |