diff --git a/Libraries/Core/InitializeCore.js b/Libraries/Core/InitializeCore.js index 630c5642c5..e5b65b59f5 100644 --- a/Libraries/Core/InitializeCore.js +++ b/Libraries/Core/InitializeCore.js @@ -216,8 +216,6 @@ if (__DEV__) { require('setupDevtools'); } - require('RCTDebugComponentOwnership'); - // Set up inspector const JSInspector = require('JSInspector'); JSInspector.registerAgent(require('NetworkAgent')); diff --git a/Libraries/DebugComponentHierarchy/RCTDebugComponentOwnership.js b/Libraries/DebugComponentHierarchy/RCTDebugComponentOwnership.js deleted file mode 100644 index db569ee4b1..0000000000 --- a/Libraries/DebugComponentHierarchy/RCTDebugComponentOwnership.js +++ /dev/null @@ -1,41 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * Utility class to provide the component owner hierarchy to native code for - * debugging purposes. - * - * @providesModule RCTDebugComponentOwnership - * @flow - */ - -'use strict'; - -var BatchedBridge = require('BatchedBridge'); - -var RCTDebugComponentOwnership = { - /** - * Asynchronously returns the owner hierarchy as an array of strings. Request id is - * passed along to the native module so that the native module can identify the - * particular call instance. - * - * Example returned owner hierarchy: ['RootView', 'Dialog', 'TitleView', 'Text'] - */ - getOwnerHierarchy: function(requestID: number, tag: number) { - // Consider cleaning up these unused modules in a separate diff. - throw new Error( - 'This seems to be unused. Will disable until it is needed again.' - ); - }, -}; - -BatchedBridge.registerCallableModule( - 'RCTDebugComponentOwnership', - RCTDebugComponentOwnership -); - -module.exports = RCTDebugComponentOwnership; diff --git a/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java b/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java index 617223cc2f..acb052b836 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/CoreModulesPackage.java @@ -35,7 +35,6 @@ import com.facebook.react.modules.systeminfo.AndroidInfoModule; import com.facebook.react.uimanager.UIImplementationProvider; import com.facebook.react.uimanager.UIManagerModule; import com.facebook.react.uimanager.ViewManager; -import com.facebook.react.uimanager.debug.DebugComponentOwnershipModule; import com.facebook.systrace.Systrace; import static com.facebook.react.bridge.ReactMarkerConstants.CREATE_UI_MANAGER_MODULE_END; @@ -65,7 +64,6 @@ import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_CORE_REACT_ UIManagerModule.class, DeviceInfoModule.class, // Debug only - DebugComponentOwnershipModule.class, JSCHeapCapture.class, JSCSamplingProfiler.class, } @@ -159,13 +157,6 @@ import static com.facebook.react.bridge.ReactMarkerConstants.PROCESS_CORE_REACT_ })); if (ReactBuildConfig.DEBUG) { - moduleSpecList.add( - new ModuleSpec(DebugComponentOwnershipModule.class, new Provider() { - @Override - public NativeModule get() { - return new DebugComponentOwnershipModule(reactContext); - } - })); moduleSpecList.add( new ModuleSpec(JSCHeapCapture.class, new Provider() { @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java b/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java index 92ffd1b210..15466d97a8 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java +++ b/ReactAndroid/src/main/java/com/facebook/react/DebugCorePackage.java @@ -21,7 +21,6 @@ import com.facebook.react.devsupport.JSCHeapCapture; import com.facebook.react.devsupport.JSCSamplingProfiler; import com.facebook.react.module.annotations.ReactModuleList; import com.facebook.react.module.model.ReactModuleInfoProvider; -import com.facebook.react.uimanager.debug.DebugComponentOwnershipModule; /** * Package defining core framework modules (e.g. UIManager). It should be used for modules that @@ -30,7 +29,6 @@ import com.facebook.react.uimanager.debug.DebugComponentOwnershipModule; */ @ReactModuleList( nativeModules = { - DebugComponentOwnershipModule.class, JSCHeapCapture.class, JSCSamplingProfiler.class, } @@ -43,14 +41,6 @@ import com.facebook.react.uimanager.debug.DebugComponentOwnershipModule; @Override public List getNativeModules(final ReactApplicationContext reactContext) { List moduleSpecList = new ArrayList<>(); - - moduleSpecList.add( - new ModuleSpec(DebugComponentOwnershipModule.class, new Provider() { - @Override - public NativeModule get() { - return new DebugComponentOwnershipModule(reactContext); - } - })); moduleSpecList.add( new ModuleSpec(JSCHeapCapture.class, new Provider() { @Override diff --git a/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/DebugComponentOwnershipModule.java b/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/DebugComponentOwnershipModule.java deleted file mode 100644 index a38af1d060..0000000000 --- a/ReactAndroid/src/main/java/com/facebook/react/uimanager/debug/DebugComponentOwnershipModule.java +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. - * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - */ - -package com.facebook.react.uimanager.debug; - -import javax.annotation.Nullable; - -import android.util.SparseArray; - -import com.facebook.infer.annotation.Assertions; -import com.facebook.react.bridge.JSApplicationCausedNativeException; -import com.facebook.react.bridge.JavaScriptModule; -import com.facebook.react.bridge.ReactApplicationContext; -import com.facebook.react.bridge.ReactContextBaseJavaModule; -import com.facebook.react.bridge.ReactMethod; -import com.facebook.react.bridge.ReadableArray; -import com.facebook.react.module.annotations.ReactModule; - -/** - * Native module that can asynchronously request the owners hierarchy of a react tag. - * - * Example returned owner hierarchy: ['RootView', 'Dialog', 'TitleView', 'Text'] - */ -@ReactModule(name = "DebugComponentOwnershipModule") -public class DebugComponentOwnershipModule extends ReactContextBaseJavaModule { - - public interface RCTDebugComponentOwnership extends JavaScriptModule { - - void getOwnerHierarchy(int requestID, int tag); - } - - /** - * Callback for when we receive the ownership hierarchy in native code. - * - * NB: {@link #onOwnerHierarchyLoaded} will be called on the native modules thread! - */ - public static interface OwnerHierarchyCallback { - - void onOwnerHierarchyLoaded(int tag, @Nullable ReadableArray owners); - } - - private final SparseArray mRequestIdToCallback = new SparseArray<>(); - - private @Nullable RCTDebugComponentOwnership mRCTDebugComponentOwnership; - private int mNextRequestId = 0; - - public DebugComponentOwnershipModule(ReactApplicationContext reactContext) { - super(reactContext); - } - - @Override - public void initialize() { - super.initialize(); - mRCTDebugComponentOwnership = getReactApplicationContext(). - getJSModule(RCTDebugComponentOwnership.class); - } - - @Override - public void onCatalystInstanceDestroy() { - super.onCatalystInstanceDestroy(); - mRCTDebugComponentOwnership = null; - } - - @ReactMethod - public synchronized void receiveOwnershipHierarchy( - int requestId, - int tag, - @Nullable ReadableArray owners) { - OwnerHierarchyCallback callback = mRequestIdToCallback.get(requestId); - if (callback == null) { - throw new JSApplicationCausedNativeException( - "Got receiveOwnershipHierarchy for invalid request id: " + requestId); - } - mRequestIdToCallback.delete(requestId); - callback.onOwnerHierarchyLoaded(tag, owners); - } - - /** - * Request to receive the component hierarchy for a particular tag. - * - * Example returned owner hierarchy: ['RootView', 'Dialog', 'TitleView', 'Text'] - * - * NB: The callback provided will be invoked on the native modules thread! - */ - public synchronized void loadComponentOwnerHierarchy(int tag, OwnerHierarchyCallback callback) { - int requestId = mNextRequestId; - mNextRequestId++; - mRequestIdToCallback.put(requestId, callback); - Assertions.assertNotNull(mRCTDebugComponentOwnership).getOwnerHierarchy(requestId, tag); - } - - @Override - public String getName() { - return "DebugComponentOwnershipModule"; - } -}