| 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/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
| 8 #include "base/threading/platform_thread.h" | 8 #include "base/threading/platform_thread.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 namespace { | 170 namespace { |
| 171 | 171 |
| 172 const ThreadPriority kThreadPriorityTestValues[] = { | 172 const ThreadPriority kThreadPriorityTestValues[] = { |
| 173 // Disable non-normal priority toggling on POSIX as it appears to be broken | 173 // Disable non-normal priority toggling on POSIX as it appears to be broken |
| 174 // (http://crbug.com/468793). This is prefered to disabling the tests altogether | 174 // (http://crbug.com/468793). This is prefered to disabling the tests altogether |
| 175 // on POSIX as it at least provides coverage for running this code under | 175 // on POSIX as it at least provides coverage for running this code under |
| 176 // "normal" priority. | 176 // "normal" priority. |
| 177 #if !defined(OS_POSIX) | 177 #if !defined(OS_POSIX) |
| 178 ThreadPriority::DISPLAY, | 178 ThreadPriority::DISPLAY, |
| 179 ThreadPriority::REALTIME_AUDIO, | 179 ThreadPriority::REALTIME_AUDIO, |
| 180 ThreadPriority::UI_BACKGROUND, |
| 180 // Keep BACKGROUND second to last to test backgrounding from other | 181 // Keep BACKGROUND second to last to test backgrounding from other |
| 181 // priorities. | 182 // priorities. |
| 182 ThreadPriority::BACKGROUND, | 183 ThreadPriority::BACKGROUND, |
| 183 #endif // !defined(OS_POSIX) | 184 #endif // !defined(OS_POSIX) |
| 184 // Keep NORMAL last to test unbackgrounding. | 185 // Keep NORMAL last to test unbackgrounding. |
| 185 ThreadPriority::NORMAL | 186 ThreadPriority::NORMAL |
| 186 }; | 187 }; |
| 187 | 188 |
| 188 } // namespace | 189 } // namespace |
| 189 | 190 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 } | 267 } |
| 267 | 268 |
| 268 // Restore current thread priority for follow-up tests. | 269 // Restore current thread priority for follow-up tests. |
| 269 PlatformThread::SetThreadPriority(current_handle, ThreadPriority::NORMAL); | 270 PlatformThread::SetThreadPriority(current_handle, ThreadPriority::NORMAL); |
| 270 | 271 |
| 271 thread.MarkForTermination(); | 272 thread.MarkForTermination(); |
| 272 PlatformThread::Join(handle); | 273 PlatformThread::Join(handle); |
| 273 } | 274 } |
| 274 | 275 |
| 275 } // namespace base | 276 } // namespace base |
| OLD | NEW |