Roll src/third_party/WebKit 640e652:eec14d5 (svn 200948:200949)
[chromium-blink-merge.git] / base / threading / platform_thread_internal_posix.h
blob05a8d1e26e78bd56d4e539110aad330a4ed01b1d
1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef BASE_THREADING_PLATFORM_THREAD_INTERNAL_POSIX_H_
6 #define BASE_THREADING_PLATFORM_THREAD_INTERNAL_POSIX_H_
8 #include "base/threading/platform_thread.h"
10 namespace base {
12 namespace internal {
14 struct ThreadPriorityToNiceValuePair {
15 ThreadPriority priority;
16 int nice_value;
18 extern const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4];
20 // Returns the nice value matching |priority| based on the platform-specific
21 // implementation of kThreadPriorityToNiceValueMap.
22 int ThreadPriorityToNiceValue(ThreadPriority priority);
24 // Returns the ThreadPrioirty matching |nice_value| based on the platform-
25 // specific implementation of kThreadPriorityToNiceValueMap.
26 ThreadPriority NiceValueToThreadPriority(int nice_value);
28 // Allows platform specific tweaks to the generic POSIX solution for
29 // SetCurrentThreadPriority. Returns true if the platform-specific
30 // implementation handled this |priority| change, false if the generic
31 // implementation should instead proceed.
32 bool SetCurrentThreadPriorityForPlatform(ThreadPriority priority);
34 // Returns true if there is a platform-specific ThreadPriority set on the
35 // current thread (and returns the actual ThreadPriority via |priority|).
36 // Returns false otherwise, leaving |priority| untouched.
37 bool GetCurrentThreadPriorityForPlatform(ThreadPriority* priority);
39 } // namespace internal
41 } // namespace base
43 #endif // BASE_THREADING_PLATFORM_THREAD_INTERNAL_POSIX_H_