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; |
+ } |
} |