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 <errno.h> | 7 #include <errno.h> |
8 #include <sched.h> | 8 #include <sched.h> |
9 | 9 |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 namespace base { | 23 namespace base { |
24 | 24 |
25 namespace internal { | 25 namespace internal { |
26 | 26 |
27 namespace { | 27 namespace { |
28 #if !defined(OS_NACL) | 28 #if !defined(OS_NACL) |
29 const struct sched_param kRealTimePrio = {8}; | 29 const struct sched_param kRealTimePrio = {8}; |
30 #endif | 30 #endif |
31 } // namespace | 31 } // namespace |
32 | 32 |
33 const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4] = { | 33 const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[5] = { |
34 {ThreadPriority::BACKGROUND, 10}, | 34 {ThreadPriority::BACKGROUND, 10}, |
| 35 {ThreadPriority::UI_BACKGROUND, 9}, |
35 {ThreadPriority::NORMAL, 0}, | 36 {ThreadPriority::NORMAL, 0}, |
36 {ThreadPriority::DISPLAY, -6}, | 37 {ThreadPriority::DISPLAY, -6}, |
37 {ThreadPriority::REALTIME_AUDIO, -10}, | 38 {ThreadPriority::REALTIME_AUDIO, -10}, |
38 }; | 39 }; |
39 | 40 |
40 bool SetThreadPriorityForPlatform(PlatformThreadHandle handle, | 41 bool SetThreadPriorityForPlatform(PlatformThreadHandle handle, |
41 ThreadPriority priority) { | 42 ThreadPriority priority) { |
42 #if !defined(OS_NACL) | 43 #if !defined(OS_NACL) |
43 // TODO(gab): Assess the correctness of using |pthread_self()| below instead | 44 // TODO(gab): Assess the correctness of using |pthread_self()| below instead |
44 // of |handle|. http://crbug.com/468793. | 45 // of |handle|. http://crbug.com/468793. |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 #if !defined(THREAD_SANITIZER) | 105 #if !defined(THREAD_SANITIZER) |
105 return 0; | 106 return 0; |
106 #else | 107 #else |
107 // ThreadSanitizer bloats the stack heavily. Evidence has been that the | 108 // ThreadSanitizer bloats the stack heavily. Evidence has been that the |
108 // default stack size isn't enough for some browser tests. | 109 // default stack size isn't enough for some browser tests. |
109 return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux). | 110 return 2 * (1 << 23); // 2 times 8192K (the default stack size on Linux). |
110 #endif | 111 #endif |
111 } | 112 } |
112 | 113 |
113 } // namespace base | 114 } // namespace base |
OLD | NEW |