@@ -75,7 +75,7 @@ public PendingJSCall(
7575 private final ArrayList <PendingJSCall > mJSCallsPendingInit = new ArrayList <PendingJSCall >();
7676 private final Object mJSCallsPendingInitLock = new Object ();
7777
78- private final NativeModuleRegistry mJavaRegistry ;
78+ private final NativeModuleRegistry mNativeModuleRegistry ;
7979 private final NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler ;
8080 private final MessageQueueThread mNativeModulesQueueThread ;
8181 private final @ Nullable MessageQueueThread mUIBackgroundQueueThread ;
@@ -92,8 +92,7 @@ public PendingJSCall(
9292 private CatalystInstanceImpl (
9393 final ReactQueueConfigurationSpec reactQueueConfigurationSpec ,
9494 final JavaScriptExecutor jsExecutor ,
95- final NativeModuleRegistry registry ,
96- final JavaScriptModuleRegistry jsModuleRegistry ,
95+ final NativeModuleRegistry nativeModuleRegistry ,
9796 final JSBundleLoader jsBundleLoader ,
9897 NativeModuleCallExceptionHandler nativeModuleCallExceptionHandler ) {
9998 Log .d (ReactConstants .TAG , "Initializing React Xplat Bridge." );
@@ -103,8 +102,8 @@ private CatalystInstanceImpl(
103102 reactQueueConfigurationSpec ,
104103 new NativeExceptionHandler ());
105104 mBridgeIdleListeners = new CopyOnWriteArrayList <>();
106- mJavaRegistry = registry ;
107- mJSModuleRegistry = jsModuleRegistry ;
105+ mNativeModuleRegistry = nativeModuleRegistry ;
106+ mJSModuleRegistry = new JavaScriptModuleRegistry () ;
108107 mJSBundleLoader = jsBundleLoader ;
109108 mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler ;
110109 mNativeModulesQueueThread = mReactQueueConfiguration .getNativeModulesQueueThread ();
@@ -118,8 +117,8 @@ private CatalystInstanceImpl(
118117 mReactQueueConfiguration .getJSQueueThread (),
119118 mNativeModulesQueueThread ,
120119 mUIBackgroundQueueThread ,
121- mJavaRegistry .getJavaModules (this ),
122- mJavaRegistry .getCxxModules ());
120+ mNativeModuleRegistry .getJavaModules (this ),
121+ mNativeModuleRegistry .getCxxModules ());
123122 Log .d (ReactConstants .TAG , "Initializing React Xplat Bridge after initializeBridge" );
124123 }
125124
@@ -137,7 +136,7 @@ public BridgeCallback(CatalystInstanceImpl outer) {
137136 public void onBatchComplete () {
138137 CatalystInstanceImpl impl = mOuter .get ();
139138 if (impl != null ) {
140- impl .mJavaRegistry .onBatchComplete ();
139+ impl .mNativeModuleRegistry .onBatchComplete ();
141140 }
142141 }
143142
@@ -294,7 +293,7 @@ public void destroy() {
294293 mNativeModulesQueueThread .runOnQueue (new Runnable () {
295294 @ Override
296295 public void run () {
297- mJavaRegistry .notifyJSInstanceDestroy ();
296+ mNativeModuleRegistry .notifyJSInstanceDestroy ();
298297 boolean wasIdle = (mPendingJSCalls .getAndSet (0 ) == 0 );
299298 if (!wasIdle && !mBridgeIdleListeners .isEmpty ()) {
300299 for (NotThreadSafeBridgeIdleDebugListener listener : mBridgeIdleListeners ) {
@@ -342,7 +341,7 @@ public void initialize() {
342341 mNativeModulesQueueThread .runOnQueue (new Runnable () {
343342 @ Override
344343 public void run () {
345- mJavaRegistry .notifyJSInstanceInitialized ();
344+ mNativeModuleRegistry .notifyJSInstanceInitialized ();
346345 }
347346 });
348347 }
@@ -359,19 +358,19 @@ public <T extends JavaScriptModule> T getJSModule(Class<T> jsInterface) {
359358
360359 @ Override
361360 public <T extends NativeModule > boolean hasNativeModule (Class <T > nativeModuleInterface ) {
362- return mJavaRegistry .hasModule (nativeModuleInterface );
361+ return mNativeModuleRegistry .hasModule (nativeModuleInterface );
363362 }
364363
365364 // This is only ever called with UIManagerModule or CurrentViewerModule.
366365 @ Override
367366 public <T extends NativeModule > T getNativeModule (Class <T > nativeModuleInterface ) {
368- return mJavaRegistry .getModule (nativeModuleInterface );
367+ return mNativeModuleRegistry .getModule (nativeModuleInterface );
369368 }
370369
371370 // This is only used by com.facebook.react.modules.common.ModuleDataCleaner
372371 @ Override
373372 public Collection <NativeModule > getNativeModules () {
374- return mJavaRegistry .getAllModules ();
373+ return mNativeModuleRegistry .getAllModules ();
375374 }
376375
377376 private native void handleMemoryPressureUiHidden ();
@@ -528,7 +527,6 @@ public static class Builder {
528527 private @ Nullable ReactQueueConfigurationSpec mReactQueueConfigurationSpec ;
529528 private @ Nullable JSBundleLoader mJSBundleLoader ;
530529 private @ Nullable NativeModuleRegistry mRegistry ;
531- private @ Nullable JavaScriptModuleRegistry mJSModuleRegistry ;
532530 private @ Nullable JavaScriptExecutor mJSExecutor ;
533531 private @ Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler ;
534532
@@ -544,7 +542,6 @@ public Builder setRegistry(NativeModuleRegistry registry) {
544542 }
545543
546544 public Builder setJSModuleRegistry (JavaScriptModuleRegistry jsModuleRegistry ) {
547- mJSModuleRegistry = jsModuleRegistry ;
548545 return this ;
549546 }
550547
@@ -569,7 +566,6 @@ public CatalystInstanceImpl build() {
569566 Assertions .assertNotNull (mReactQueueConfigurationSpec ),
570567 Assertions .assertNotNull (mJSExecutor ),
571568 Assertions .assertNotNull (mRegistry ),
572- Assertions .assertNotNull (mJSModuleRegistry ),
573569 Assertions .assertNotNull (mJSBundleLoader ),
574570 Assertions .assertNotNull (mNativeModuleCallExceptionHandler ));
575571 }
0 commit comments