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

Side by Side Diff: base/android/java/src/org/chromium/base/ThreadUtils.java

Issue 1784623005: Test dynamic priorities (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 | « no previous file | base/threading/platform_thread.h » ('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 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
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 }
OLDNEW
« no previous file with comments | « no previous file | base/threading/platform_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698