| Index: base/threading/platform_thread_android.cc
|
| diff --git a/base/threading/platform_thread_android.cc b/base/threading/platform_thread_android.cc
|
| index fd5e54d8af961fe03c90d3bd6c7b61b111aa6f13..d2648d0eeeeb364d1e0ff204c509217809e8e2da 100644
|
| --- a/base/threading/platform_thread_android.cc
|
| +++ b/base/threading/platform_thread_android.cc
|
| @@ -47,6 +47,19 @@ bool SetCurrentThreadPriorityForPlatform(ThreadPriority priority) {
|
| return false;
|
| }
|
|
|
| +bool SetThreadPriority(PlatformThreadId tid, ThreadPriority priority) {
|
| + if (priority == ThreadPriority::BACKGROUND) {
|
| + JNIEnv* env = base::android::AttachCurrentThread();
|
| + Java_ThreadUtils_setThreadPriorityBackground(env, tid);
|
| + return true;
|
| + } else if (priority == ThreadPriority::NORMAL) {
|
| + JNIEnv* env = base::android::AttachCurrentThread();
|
| + Java_ThreadUtils_setThreadPriorityNormal(env, tid);
|
| + return true;
|
| + }
|
| + return false;
|
| +}
|
| +
|
| bool GetCurrentThreadPriorityForPlatform(ThreadPriority* priority) {
|
| DCHECK(priority);
|
| *priority = ThreadPriority::NORMAL;
|
| @@ -55,6 +68,14 @@ bool GetCurrentThreadPriorityForPlatform(ThreadPriority* priority) {
|
| env, PlatformThread::CurrentId())) {
|
| *priority = ThreadPriority::REALTIME_AUDIO;
|
| return true;
|
| + } else if (Java_ThreadUtils_isThreadPriorityNormal(
|
| + env, PlatformThread::CurrentId())) {
|
| + *priority = ThreadPriority::NORMAL;
|
| + return true;
|
| + } else if (Java_ThreadUtils_isThreadPriorityBackground(
|
| + env, PlatformThread::CurrentId())) {
|
| + *priority = ThreadPriority::BACKGROUND;
|
| + return true;
|
| }
|
| return false;
|
| }
|
|
|