Remove unused RCTDebugComponentOwnership
Reviewed By: sahrens Differential Revision: D5380887 fbshipit-source-id: ff81324718d64d7a04ef4bd293d30dd6f3aabb2a
This commit is contained in:
parent
e0eee0bb49
commit
8548ca09f1
|
@ -216,8 +216,6 @@ if (__DEV__) {
|
|||
require('setupDevtools');
|
||||
}
|
||||
|
||||
require('RCTDebugComponentOwnership');
|
||||
|
||||
// Set up inspector
|
||||
const JSInspector = require('JSInspector');
|
||||
JSInspector.registerAgent(require('NetworkAgent'));
|
||||
|
|
|
@ -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;
|
|
@ -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<NativeModule>() {
|
||||
@Override
|
||||
public NativeModule get() {
|
||||
return new DebugComponentOwnershipModule(reactContext);
|
||||
}
|
||||
}));
|
||||
moduleSpecList.add(
|
||||
new ModuleSpec(JSCHeapCapture.class, new Provider<NativeModule>() {
|
||||
@Override
|
||||
|
|
|
@ -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<ModuleSpec> getNativeModules(final ReactApplicationContext reactContext) {
|
||||
List<ModuleSpec> moduleSpecList = new ArrayList<>();
|
||||
|
||||
moduleSpecList.add(
|
||||
new ModuleSpec(DebugComponentOwnershipModule.class, new Provider<NativeModule>() {
|
||||
@Override
|
||||
public NativeModule get() {
|
||||
return new DebugComponentOwnershipModule(reactContext);
|
||||
}
|
||||
}));
|
||||
moduleSpecList.add(
|
||||
new ModuleSpec(JSCHeapCapture.class, new Provider<NativeModule>() {
|
||||
@Override
|
||||
|
|
|
@ -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<OwnerHierarchyCallback> 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";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue