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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | base/threading/platform_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/java/src/org/chromium/base/ThreadUtils.java
diff --git a/base/android/java/src/org/chromium/base/ThreadUtils.java b/base/android/java/src/org/chromium/base/ThreadUtils.java
index ef2887acd0c97e5c8ca97beb489c1dbe50302d98..a4ae663d1a9bb11aa69e2f1dfabecf198966db87 100644
--- a/base/android/java/src/org/chromium/base/ThreadUtils.java
+++ b/base/android/java/src/org/chromium/base/ThreadUtils.java
@@ -212,6 +212,22 @@ public class ThreadUtils {
}
/**
+ * Set thread priority to foreground.
+ */
+ @CalledByNative
+ public static void setThreadPriorityNormal(int tid) {
+ Process.setThreadPriority(tid, Process.THREAD_PRIORITY_DEFAULT);
+ }
+
+ /**
+ * Set thread priority to backbround.
+ */
+ @CalledByNative
+ public static void setThreadPriorityBackground(int tid) {
+ Process.setThreadPriority(tid, Process.THREAD_PRIORITY_BACKGROUND);
+ }
+
+ /**
* Checks whether Thread priority is THREAD_PRIORITY_AUDIO or not.
* @param tid Thread id.
* @return true for THREAD_PRIORITY_AUDIO and false otherwise.
@@ -220,4 +236,24 @@ public class ThreadUtils {
private static boolean isThreadPriorityAudio(int tid) {
return Process.getThreadPriority(tid) == Process.THREAD_PRIORITY_AUDIO;
}
+
+ /**
+ * Checks whether Thread priority is THREAD_PRIORITY_DEFAULT or not.
+ * @param tid Thread id.
+ * @return true for THREAD_PRIORITY_DEFAULT and false otherwise.
+ */
+ @CalledByNative
+ private static boolean isThreadPriorityNormal(int tid) {
+ return Process.getThreadPriority(tid) == Process.THREAD_PRIORITY_DEFAULT;
+ }
+
+ /**
+ * Checks whether Thread priority is THREAD_PRIORITY_BACKGROUND or not.
+ * @param tid Thread id.
+ * @return true for THREAD_PRIORITY_BACKGROUND and false otherwise.
+ */
+ @CalledByNative
+ private static boolean isThreadPriorityBackground(int tid) {
+ return Process.getThreadPriority(tid) == Process.THREAD_PRIORITY_BACKGROUND;
+ }
}
« 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