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: 877c5af6ad0fc378ec9cbd952f33db0ea08f761c
  • Loading branch information
mdvacca authored and facebook-github-bot committed Sep 27, 2023
1 parent 36057da commit 5f215cd
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 5f215cd

Please sign in to comment.