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

Side by Side Diff: base/threading/platform_thread_internal_posix.h

Issue 1193303002: base/threading: restrict to set only current thread priority (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review #48 Created 5 years, 5 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 unified diff | Download patch
« no previous file with comments | « base/threading/platform_thread_freebsd.cc ('k') | base/threading/platform_thread_linux.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 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 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 #ifndef BASE_THREADING_PLATFORM_THREAD_INTERNAL_POSIX_H_ 5 #ifndef BASE_THREADING_PLATFORM_THREAD_INTERNAL_POSIX_H_
6 #define BASE_THREADING_PLATFORM_THREAD_INTERNAL_POSIX_H_ 6 #define BASE_THREADING_PLATFORM_THREAD_INTERNAL_POSIX_H_
7 7
8 #include "base/threading/platform_thread.h" 8 #include "base/threading/platform_thread.h"
9 9
10 namespace base { 10 namespace base {
11 11
12 namespace internal { 12 namespace internal {
13 13
14 struct ThreadPriorityToNiceValuePair { 14 struct ThreadPriorityToNiceValuePair {
15 ThreadPriority priority; 15 ThreadPriority priority;
16 int nice_value; 16 int nice_value;
17 }; 17 };
18 extern const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4]; 18 extern const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4];
19 19
20 // Returns the nice value matching |priority| based on the platform-specific 20 // Returns the nice value matching |priority| based on the platform-specific
21 // implementation of kThreadPriorityToNiceValueMap. 21 // implementation of kThreadPriorityToNiceValueMap.
22 int ThreadPriorityToNiceValue(ThreadPriority priority); 22 int ThreadPriorityToNiceValue(ThreadPriority priority);
23 23
24 // Returns the ThreadPrioirty matching |nice_value| based on the platform- 24 // Returns the ThreadPrioirty matching |nice_value| based on the platform-
25 // specific implementation of kThreadPriorityToNiceValueMap. 25 // specific implementation of kThreadPriorityToNiceValueMap.
26 ThreadPriority NiceValueToThreadPriority(int nice_value); 26 ThreadPriority NiceValueToThreadPriority(int nice_value);
27 27
28 // Allows platform specific tweaks to the generic POSIX solution for 28 // Allows platform specific tweaks to the generic POSIX solution for
29 // SetThreadPriority. Returns true if the platform-specific implementation 29 // SetCurrentThreadPriority. Returns true if the platform-specific
30 // handled this |priority| change, false if the generic implementation should 30 // implementation handled this |priority| change, false if the generic
31 // instead proceed. 31 // implementation should instead proceed.
32 bool SetThreadPriorityForPlatform(PlatformThreadHandle handle, 32 bool SetCurrentThreadPriorityForPlatform(ThreadPriority priority);
33 ThreadPriority priority);
34 33
35 // Returns true if there is a platform-specific ThreadPriority set on |handle| 34 // Returns true if there is a platform-specific ThreadPriority set on the
36 // (and returns the actual ThreadPriority via |priority|). Returns false 35 // current thread (and returns the actual ThreadPriority via |priority|).
37 // otherwise, leaving |priority| untouched. 36 // Returns false otherwise, leaving |priority| untouched.
38 bool GetThreadPriorityForPlatform(PlatformThreadHandle handle, 37 bool GetCurrentThreadPriorityForPlatform(ThreadPriority* priority);
39 ThreadPriority* priority);
40 38
41 } // namespace internal 39 } // namespace internal
42 40
43 } // namespace base 41 } // namespace base
44 42
45 #endif // BASE_THREADING_PLATFORM_THREAD_INTERNAL_POSIX_H_ 43 #endif // BASE_THREADING_PLATFORM_THREAD_INTERNAL_POSIX_H_
OLDNEW
« no previous file with comments | « base/threading/platform_thread_freebsd.cc ('k') | base/threading/platform_thread_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698