OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 package org.chromium.base; | 5 package org.chromium.base; |
6 | 6 |
7 import android.os.Handler; | 7 import android.os.Handler; |
8 import android.os.Looper; | 8 import android.os.Looper; |
9 import android.os.Process; | 9 import android.os.Process; |
10 | 10 |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 /** | 206 /** |
207 * Set thread priority to audio. | 207 * Set thread priority to audio. |
208 */ | 208 */ |
209 @CalledByNative | 209 @CalledByNative |
210 public static void setThreadPriorityAudio(int tid) { | 210 public static void setThreadPriorityAudio(int tid) { |
211 Process.setThreadPriority(tid, Process.THREAD_PRIORITY_AUDIO); | 211 Process.setThreadPriority(tid, Process.THREAD_PRIORITY_AUDIO); |
212 } | 212 } |
213 | 213 |
214 /** | 214 /** |
| 215 * Set thread priority to foreground. |
| 216 */ |
| 217 @CalledByNative |
| 218 public static void setThreadPriorityNormal(int tid) { |
| 219 Process.setThreadPriority(tid, Process.THREAD_PRIORITY_DEFAULT); |
| 220 } |
| 221 |
| 222 /** |
| 223 * Set thread priority to backbround. |
| 224 */ |
| 225 @CalledByNative |
| 226 public static void setThreadPriorityBackground(int tid) { |
| 227 Process.setThreadPriority(tid, Process.THREAD_PRIORITY_BACKGROUND); |
| 228 } |
| 229 |
| 230 /** |
215 * Checks whether Thread priority is THREAD_PRIORITY_AUDIO or not. | 231 * Checks whether Thread priority is THREAD_PRIORITY_AUDIO or not. |
216 * @param tid Thread id. | 232 * @param tid Thread id. |
217 * @return true for THREAD_PRIORITY_AUDIO and false otherwise. | 233 * @return true for THREAD_PRIORITY_AUDIO and false otherwise. |
218 */ | 234 */ |
219 @CalledByNative | 235 @CalledByNative |
220 private static boolean isThreadPriorityAudio(int tid) { | 236 private static boolean isThreadPriorityAudio(int tid) { |
221 return Process.getThreadPriority(tid) == Process.THREAD_PRIORITY_AUDIO; | 237 return Process.getThreadPriority(tid) == Process.THREAD_PRIORITY_AUDIO; |
222 } | 238 } |
| 239 |
| 240 /** |
| 241 * Checks whether Thread priority is THREAD_PRIORITY_DEFAULT or not. |
| 242 * @param tid Thread id. |
| 243 * @return true for THREAD_PRIORITY_DEFAULT and false otherwise. |
| 244 */ |
| 245 @CalledByNative |
| 246 private static boolean isThreadPriorityNormal(int tid) { |
| 247 return Process.getThreadPriority(tid) == Process.THREAD_PRIORITY_DEFAULT
; |
| 248 } |
| 249 |
| 250 /** |
| 251 * Checks whether Thread priority is THREAD_PRIORITY_BACKGROUND or not. |
| 252 * @param tid Thread id. |
| 253 * @return true for THREAD_PRIORITY_BACKGROUND and false otherwise. |
| 254 */ |
| 255 @CalledByNative |
| 256 private static boolean isThreadPriorityBackground(int tid) { |
| 257 return Process.getThreadPriority(tid) == Process.THREAD_PRIORITY_BACKGRO
UND; |
| 258 } |
223 } | 259 } |
OLD | NEW |