mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: This seems like a remnant of an old refactor. This is passed in, we wrap it with a JMessageQueueThread and then never use it again. Changelog: [Internal] Reviewed By: mdvacca Differential Revision: D31506280 fbshipit-source-id: aca01439dcddbe2b44ce80342fa8664f827919c9
77 lines
2.8 KiB
Java
77 lines
2.8 KiB
Java
/*
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*/
|
|
|
|
package com.facebook.react.fabric;
|
|
|
|
import androidx.annotation.NonNull;
|
|
import com.facebook.react.bridge.JSIModuleProvider;
|
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
import com.facebook.react.bridge.UIManager;
|
|
import com.facebook.react.common.mapbuffer.ReadableMapBufferSoLoader;
|
|
import com.facebook.react.config.ReactFeatureFlags;
|
|
import com.facebook.react.fabric.events.EventBeatManager;
|
|
import com.facebook.react.uimanager.ViewManagerRegistry;
|
|
import com.facebook.systrace.Systrace;
|
|
|
|
public class FabricJSIModuleProvider implements JSIModuleProvider<UIManager> {
|
|
|
|
@NonNull private final ReactApplicationContext mReactApplicationContext;
|
|
@NonNull private final ComponentFactory mComponentFactory;
|
|
@NonNull private final ReactNativeConfig mConfig;
|
|
@NonNull private final ViewManagerRegistry mViewManagerRegistry;
|
|
|
|
public FabricJSIModuleProvider(
|
|
@NonNull ReactApplicationContext reactApplicationContext,
|
|
@NonNull ComponentFactory componentFactory,
|
|
@NonNull ReactNativeConfig config,
|
|
@NonNull ViewManagerRegistry viewManagerRegistry) {
|
|
mReactApplicationContext = reactApplicationContext;
|
|
mComponentFactory = componentFactory;
|
|
mConfig = config;
|
|
mViewManagerRegistry = viewManagerRegistry;
|
|
}
|
|
|
|
@Override
|
|
public UIManager get() {
|
|
Systrace.beginSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricJSIModuleProvider.get");
|
|
final EventBeatManager eventBeatManager = new EventBeatManager(mReactApplicationContext);
|
|
final FabricUIManager uiManager = createUIManager(eventBeatManager);
|
|
|
|
Systrace.beginSection(
|
|
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricJSIModuleProvider.registerBinding");
|
|
final Binding binding = new Binding();
|
|
|
|
if (ReactFeatureFlags.enableEagerInitializeMapBufferSoFile) {
|
|
ReadableMapBufferSoLoader.staticInit();
|
|
}
|
|
|
|
binding.register(
|
|
mReactApplicationContext.getCatalystInstance().getRuntimeExecutor(),
|
|
mReactApplicationContext.getCatalystInstance().getRuntimeScheduler(),
|
|
uiManager,
|
|
eventBeatManager,
|
|
mComponentFactory,
|
|
mConfig);
|
|
|
|
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
|
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
|
|
|
return uiManager;
|
|
}
|
|
|
|
private FabricUIManager createUIManager(@NonNull EventBeatManager eventBeatManager) {
|
|
Systrace.beginSection(
|
|
Systrace.TRACE_TAG_REACT_JAVA_BRIDGE, "FabricJSIModuleProvider.createUIManager");
|
|
|
|
FabricUIManager fabricUIManager;
|
|
fabricUIManager =
|
|
new FabricUIManager(mReactApplicationContext, mViewManagerRegistry, eventBeatManager);
|
|
Systrace.endSection(Systrace.TRACE_TAG_REACT_JAVA_BRIDGE);
|
|
return fabricUIManager;
|
|
}
|
|
}
|