Skip to content

Commit

Permalink
Rename onCatalystInstanceDestroy -> invalidate (#39611)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #39611

I'm renaming onCatalystInstanceDestroy -> invalidate, this is necessary to converge TurboModuleRegistry -> turboModuleManager in the next diffs of the stack

changelog: [intenral] internal

Reviewed By: arushikesarwani94

Differential Revision: D49469208

fbshipit-source-id: db1421e6ddaa99cfde062bb41b4307990749b060
  • Loading branch information
mdvacca committed Sep 22, 2023
1 parent 0f2ecd3 commit 58f8d84
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ public void run() {
public void run() {
// We need to destroy the TurboModuleManager on the JS Thread
if (mTurboModuleManagerJSIModule != null) {
mTurboModuleManagerJSIModule.onCatalystInstanceDestroy();
mTurboModuleManagerJSIModule.invalidate();
}

getReactQueueConfiguration()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,5 @@ public interface JSIModule {
void initialize();

/** Called before {CatalystInstance#onHostDestroy} */
void onCatalystInstanceDestroy();
void invalidate();
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public JSIModule getJSIModule() {

public void notifyJSInstanceDestroy() {
if (mModule != null) {
mModule.onCatalystInstanceDestroy();
mModule.invalidate();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ public void initialize() {
@Override
@AnyThread
@ThreadConfined(ANY)
public void onCatalystInstanceDestroy() {
public void invalidate() {
FLog.i(TAG, "FabricUIManager.onCatalystInstanceDestroy");

if (mDevToolsReactPerfLogger != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,8 @@ public Collection<NativeModule> getNativeModules() {
/* package */ void destroy() {
FLog.d(TAG, "ReactInstance.destroy() is called.");
mQueueConfiguration.destroy();
mTurboModuleManager.onCatalystInstanceDestroy();
mFabricUIManager.onCatalystInstanceDestroy();
mTurboModuleManager.invalidate();
mFabricUIManager.invalidate();
mHybridData.resetNative();
mComponentNameResolverManager = null;
mUIConstantsProviderManager = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ private native HybridData initHybrid(
public void initialize() {}

@Override
public void onCatalystInstanceDestroy() {
public void invalidate() {
/*
* Halt the production of new TurboModules.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,10 @@ interface TurboModuleRegistry {
* NativeModules.
*/
val eagerInitModuleNames: List<String>

/**
* Called during the turn down process of ReactHost. This method is called before React Native is
* stopped.
*/
fun invalidate()
}
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public void onHostDestroy() {
}

@Override
public void onCatalystInstanceDestroy() {
public void invalidate() {
super.onCatalystInstanceDestroy();
mEventDispatcher.onCatalystInstanceDestroyed();
mUIImplementation.onCatalystInstanceDestroyed();
Expand Down

0 comments on commit 58f8d84

Please sign in to comment.