lower thread priority of native module and JS thread

Reviewed By: achen1

Differential Revision: D4921012

fbshipit-source-id: 71df4ab0614f20f092b992c07e828eb5ad951159
This commit is contained in:
Aaron Chiu 2017-04-20 15:26:44 -07:00 committed by Facebook Github Bot
parent 38f5b84734
commit 97a86634f7
2 changed files with 3 additions and 1 deletions

View File

@ -23,6 +23,7 @@ import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.os.Process;
import android.view.View;
import com.facebook.common.logging.FLog;
@ -742,6 +743,7 @@ public class ReactInstanceManager {
@Override
public void run() {
try {
Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);
final ReactApplicationContext reactApplicationContext = createReactContext(
initParams.getJsExecutorFactory().create(),
initParams.getJsBundleLoader());
@ -789,7 +791,6 @@ public class ReactInstanceManager {
}
}
});
mCreateReactContextThread.setPriority(Thread.MAX_PRIORITY);
mCreateReactContextThread.start();
}

View File

@ -200,6 +200,7 @@ public class MessageQueueThreadImpl implements MessageQueueThread {
new Runnable() {
@Override
public void run() {
Process.setThreadPriority(Process.THREAD_PRIORITY_DEFAULT);
Looper.prepare();
looperFuture.set(Looper.myLooper());