Remove class-loading experiment for View Managers.

Reviewed By: fkgozali

Differential Revision: D7418876

fbshipit-source-id: 52f8dce29a509233b9545a564c4f0d390fa81f13
This commit is contained in:
Dmitry Zakharov 2018-03-28 12:52:20 -07:00 committed by Facebook Github Bot
parent 88ba7ebcc7
commit 7cbb222cd5
4 changed files with 8 additions and 26 deletions

View File

@ -98,14 +98,13 @@ public class CompositeReactPackage extends ReactInstancePackage
/** {@inheritDoc} */
@Override
public List<String> getViewManagerNames(
ReactApplicationContext reactContext, boolean loadClasses) {
public List<String> getViewManagerNames(ReactApplicationContext reactContext) {
Set<String> uniqueNames = new HashSet<>();
for (ReactPackage reactPackage : mChildReactPackages) {
if (reactPackage instanceof ViewManagerOnDemandReactPackage) {
List<String> names =
((ViewManagerOnDemandReactPackage) reactPackage)
.getViewManagerNames(reactContext, loadClasses);
.getViewManagerNames(reactContext);
if (names != null) {
uniqueNames.addAll(names);
}
@ -116,15 +115,14 @@ public class CompositeReactPackage extends ReactInstancePackage
/** {@inheritDoc} */
@Override
public @Nullable ViewManager createViewManager(
ReactApplicationContext reactContext, String viewManagerName, boolean loadClasses) {
public @Nullable ViewManager createViewManager(ReactApplicationContext reactContext, String viewManagerName) {
ListIterator<ReactPackage> iterator = mChildReactPackages.listIterator(mChildReactPackages.size());
while (iterator.hasPrevious()) {
ReactPackage reactPackage = iterator.previous();
if (reactPackage instanceof ViewManagerOnDemandReactPackage) {
ViewManager viewManager =
((ViewManagerOnDemandReactPackage) reactPackage)
.createViewManager(reactContext, viewManagerName, loadClasses);
.createViewManager(reactContext, viewManagerName);
if (viewManager != null) {
return viewManager;
}

View File

@ -156,7 +156,6 @@ public class ReactInstanceManager {
private final MemoryPressureRouter mMemoryPressureRouter;
private final @Nullable NativeModuleCallExceptionHandler mNativeModuleCallExceptionHandler;
private final boolean mLazyNativeModulesEnabled;
private final boolean mDelayViewManagerClassLoadsEnabled;
private final @Nullable JSIModulesProvider mJSIModulesProvider;
private List<ViewManager> mViewManagers;
@ -203,7 +202,6 @@ public class ReactInstanceManager {
@Nullable RedBoxHandler redBoxHandler,
boolean lazyNativeModulesEnabled,
boolean lazyViewManagersEnabled,
boolean delayViewManagerClassLoadsEnabled,
@Nullable DevBundleDownloadListener devBundleDownloadListener,
int minNumShakes,
int minTimeLeftInFrameForNonBatchedOperationMs,
@ -235,7 +233,6 @@ public class ReactInstanceManager {
mMemoryPressureRouter = new MemoryPressureRouter(applicationContext);
mNativeModuleCallExceptionHandler = nativeModuleCallExceptionHandler;
mLazyNativeModulesEnabled = lazyNativeModulesEnabled;
mDelayViewManagerClassLoadsEnabled = delayViewManagerClassLoadsEnabled;
synchronized (mPackages) {
PrinterHolder.getPrinter()
.logMessage(ReactDebugOverlayTags.RN_CORE, "RNCore: Use Split Packages");
@ -780,7 +777,7 @@ public class ReactInstanceManager {
if (reactPackage instanceof ViewManagerOnDemandReactPackage) {
ViewManager viewManager =
((ViewManagerOnDemandReactPackage) reactPackage)
.createViewManager(context, viewManagerName, !mDelayViewManagerClassLoadsEnabled);
.createViewManager(context, viewManagerName);
if (viewManager != null) {
return viewManager;
}
@ -805,7 +802,7 @@ public class ReactInstanceManager {
if (reactPackage instanceof ViewManagerOnDemandReactPackage) {
List<String> names =
((ViewManagerOnDemandReactPackage) reactPackage)
.getViewManagerNames(context, !mDelayViewManagerClassLoadsEnabled);
.getViewManagerNames(context);
if (names != null) {
uniqueNames.addAll(names);
}

View File

@ -44,7 +44,6 @@ public class ReactInstanceManagerBuilder {
private @Nullable RedBoxHandler mRedBoxHandler;
private boolean mLazyNativeModulesEnabled;
private boolean mLazyViewManagersEnabled;
private boolean mDelayViewManagerClassLoadsEnabled;
private @Nullable DevBundleDownloadListener mDevBundleDownloadListener;
private @Nullable JavaScriptExecutorFactory mJavaScriptExecutorFactory;
private int mMinNumShakes = 1;
@ -209,12 +208,6 @@ public class ReactInstanceManagerBuilder {
return this;
}
public ReactInstanceManagerBuilder setDelayViewManagerClassLoadsEnabled(
boolean delayViewManagerClassLoadsEnabled) {
mDelayViewManagerClassLoadsEnabled = delayViewManagerClassLoadsEnabled;
return this;
}
public ReactInstanceManagerBuilder setDevBundleDownloadListener(
@Nullable DevBundleDownloadListener listener) {
mDevBundleDownloadListener = listener;
@ -285,7 +278,6 @@ public class ReactInstanceManagerBuilder {
mRedBoxHandler,
mLazyNativeModulesEnabled,
mLazyViewManagersEnabled,
mDelayViewManagerClassLoadsEnabled,
mDevBundleDownloadListener,
mMinNumShakes,
mMinTimeLeftInFrameForNonBatchedOperationMs,

View File

@ -16,17 +16,12 @@ public interface ViewManagerOnDemandReactPackage {
/**
* Provides a list of names of ViewManagers with which these modules can be accessed from JS.
* Typically, this is ViewManager.getName().
*
* @param loadClasses defines if View Managers classes should be loaded or be avoided.
*/
@Nullable List<String> getViewManagerNames(ReactApplicationContext reactContext, boolean loadClasses);
@Nullable List<String> getViewManagerNames(ReactApplicationContext reactContext);
/**
* Creates and returns a ViewManager with a specific name {@param viewManagerName}. It's up to an
* implementing package how to interpret the name.
*
* @param loadClasses defines if View Managers classes should be loaded or be avoided.
*/
@Nullable
ViewManager createViewManager(
ReactApplicationContext reactContext, String viewManagerName, boolean loadClasses);
ViewManager createViewManager(ReactApplicationContext reactContext, String viewManagerName);
}