Skip to content

Commit

Permalink
Remove unreferenced JSEngineResolutionAlgorithm from ReactHost API (#…
Browse files Browse the repository at this point in the history
…45269)

Summary:
Pull Request resolved: #45269

There's no callers to this property, and we already create a `jsRuntimeFactory` above in DefaultReactHost, which will actually decide which VM to use.

Changelog: [Android][Removed] Unused jsEngineResolutionAlgorithm from ReactHost

Reviewed By: cortinico

Differential Revision: D59333435

fbshipit-source-id: 21be4d138bca64c0cb78de366bf2e247b4f37650
  • Loading branch information
javache authored and facebook-github-bot committed Jul 4, 2024
1 parent bf11d1e commit f1b6218
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 34 deletions.
4 changes: 0 additions & 4 deletions packages/react-native/ReactAndroid/api/ReactAndroid.api
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,6 @@ public abstract interface class com/facebook/react/ReactHost {
public abstract fun destroy (Ljava/lang/String;Ljava/lang/Exception;)Lcom/facebook/react/interfaces/TaskInterface;
public abstract fun getCurrentReactContext ()Lcom/facebook/react/bridge/ReactContext;
public abstract fun getDevSupportManager ()Lcom/facebook/react/devsupport/interfaces/DevSupportManager;
public abstract fun getJsEngineResolutionAlgorithm ()Lcom/facebook/react/JSEngineResolutionAlgorithm;
public abstract fun getLifecycleState ()Lcom/facebook/react/common/LifecycleState;
public abstract fun getMemoryPressureRouter ()Lcom/facebook/react/MemoryPressureRouter;
public abstract fun getReactQueueConfiguration ()Lcom/facebook/react/bridge/queue/ReactQueueConfiguration;
Expand All @@ -236,7 +235,6 @@ public abstract interface class com/facebook/react/ReactHost {
public abstract fun reload (Ljava/lang/String;)Lcom/facebook/react/interfaces/TaskInterface;
public abstract fun removeBeforeDestroyListener (Lkotlin/jvm/functions/Function0;)V
public abstract fun removeReactInstanceEventListener (Lcom/facebook/react/ReactInstanceEventListener;)V
public abstract fun setJsEngineResolutionAlgorithm (Lcom/facebook/react/JSEngineResolutionAlgorithm;)V
public abstract fun start ()Lcom/facebook/react/interfaces/TaskInterface;
}

Expand Down Expand Up @@ -3795,7 +3793,6 @@ public class com/facebook/react/runtime/ReactHostImpl : com/facebook/react/React
public fun destroy (Ljava/lang/String;Ljava/lang/Exception;)Lcom/facebook/react/interfaces/TaskInterface;
public fun getCurrentReactContext ()Lcom/facebook/react/bridge/ReactContext;
public fun getDevSupportManager ()Lcom/facebook/react/devsupport/interfaces/DevSupportManager;
public fun getJsEngineResolutionAlgorithm ()Lcom/facebook/react/JSEngineResolutionAlgorithm;
public fun getLifecycleState ()Lcom/facebook/react/common/LifecycleState;
public fun getMemoryPressureRouter ()Lcom/facebook/react/MemoryPressureRouter;
public fun getReactQueueConfiguration ()Lcom/facebook/react/bridge/queue/ReactQueueConfiguration;
Expand All @@ -3815,7 +3812,6 @@ public class com/facebook/react/runtime/ReactHostImpl : com/facebook/react/React
public fun reload (Ljava/lang/String;)Lcom/facebook/react/interfaces/TaskInterface;
public fun removeBeforeDestroyListener (Lkotlin/jvm/functions/Function0;)V
public fun removeReactInstanceEventListener (Lcom/facebook/react/ReactInstanceEventListener;)V
public fun setJsEngineResolutionAlgorithm (Lcom/facebook/react/JSEngineResolutionAlgorithm;)V
public fun start ()Lcom/facebook/react/interfaces/TaskInterface;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ public interface ReactHost {
/** [ReactQueueConfiguration] for caller to post jobs in React Native threads */
public val reactQueueConfiguration: ReactQueueConfiguration?

/** [JSEngineResolutionAlgorithm] used by this host. */
public var jsEngineResolutionAlgorithm: JSEngineResolutionAlgorithm?

/** Routes memory pressure events to interested components */
public val memoryPressureRouter: MemoryPressureRouter

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
package com.facebook.react.defaults

import android.content.Context
import com.facebook.react.JSEngineResolutionAlgorithm
import com.facebook.react.ReactHost
import com.facebook.react.ReactNativeHost
import com.facebook.react.ReactPackage
Expand Down Expand Up @@ -87,20 +86,12 @@ public object DefaultReactHost {
// TODO: T164788699 find alternative of accessing ReactHostImpl for initialising reactHost
reactHost =
ReactHostImpl(
context,
defaultReactHostDelegate,
componentFactory,
true /* allowPackagerServerAccess */,
useDevSupport,
)
.apply {
jsEngineResolutionAlgorithm =
if (isHermesEnabled) {
JSEngineResolutionAlgorithm.HERMES
} else {
JSEngineResolutionAlgorithm.JSC
}
}
context,
defaultReactHostDelegate,
componentFactory,
true /* allowPackagerServerAccess */,
useDevSupport,
)
}
return reactHost as ReactHost
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1708,18 +1708,6 @@ private Task<Void> getOrCreateDestroyTask(final String reason, @Nullable Excepti
return mDestroyTask;
}

@Nullable
@Override
public JSEngineResolutionAlgorithm getJsEngineResolutionAlgorithm() {
return mJSEngineResolutionAlgorithm;
}

@Override
public void setJsEngineResolutionAlgorithm(
@Nullable JSEngineResolutionAlgorithm jsEngineResolutionAlgorithm) {
mJSEngineResolutionAlgorithm = jsEngineResolutionAlgorithm;
}

private @Nullable ReactHostInspectorTarget getOrCreateReactHostInspectorTarget() {
if (mReactHostInspectorTarget == null && InspectorFlags.getFuseboxEnabled()) {
// NOTE: ReactHostInspectorTarget only retains a weak reference to `this`.
Expand Down

0 comments on commit f1b6218

Please sign in to comment.