mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-01-12 22:50:10 +08:00
Move message queue initialization in ReactContext into its own method
Summary: Refactoring ReactContext to move message queue initialization into its own function that can be called independently of initializeWithInstance. This allows you to create a ReactContext with message queue threads without a CatalystInstance. Reviewed By: mdvacca Differential Revision: D14817741 fbshipit-source-id: f314a526c6534792714e5ba55dd873f1728c6b9f
This commit is contained in:
committed by
Facebook Github Bot
parent
a7326d338c
commit
c6b4eb7dcf
@@ -65,9 +65,21 @@ public class ReactContext extends ContextWrapper {
|
||||
mCatalystInstance = catalystInstance;
|
||||
|
||||
ReactQueueConfiguration queueConfig = catalystInstance.getReactQueueConfiguration();
|
||||
mUiMessageQueueThread = queueConfig.getUIQueueThread();
|
||||
mNativeModulesMessageQueueThread = queueConfig.getNativeModulesQueueThread();
|
||||
mJSMessageQueueThread = queueConfig.getJSQueueThread();
|
||||
initializeMessageQueueThreads(queueConfig);
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize message queue threads using a ReactQueueConfiguration.
|
||||
* TODO (janzer) T43898341 Make this package instead of public
|
||||
*/
|
||||
public void initializeMessageQueueThreads(ReactQueueConfiguration queueConfig) {
|
||||
if (mUiMessageQueueThread == null && mNativeModulesMessageQueueThread == null && mJSMessageQueueThread == null) {
|
||||
mUiMessageQueueThread = queueConfig.getUIQueueThread();
|
||||
mNativeModulesMessageQueueThread = queueConfig.getNativeModulesQueueThread();
|
||||
mJSMessageQueueThread = queueConfig.getJSQueueThread();
|
||||
} else {
|
||||
throw new IllegalStateException("Message queue threads already initialized");
|
||||
}
|
||||
}
|
||||
|
||||
public void resetPerfStats() {
|
||||
|
||||
Reference in New Issue
Block a user