Add spec for HeapCapture (#24899)
Summary: Part of #24875, adds a spec for HeapCapture ## Changelog [General] [Added] - TM Spec for HeapCapture Pull Request resolved: https://github.com/facebook/react-native/pull/24899 Reviewed By: fkgozali Differential Revision: D15393464 Pulled By: RSNara fbshipit-source-id: d8778285753ce8dbc87204ecfbddfa7339acd264
This commit is contained in:
Родитель
67c3ed34ba
Коммит
94029eee54
|
@ -22,7 +22,7 @@ BatchedBridge.registerLazyCallableModule('JSTimers', () =>
|
|||
require('./Timers/JSTimers'),
|
||||
);
|
||||
BatchedBridge.registerLazyCallableModule('HeapCapture', () =>
|
||||
require('../Utilities/HeapCapture'),
|
||||
require('../HeapCapture/HeapCapture'),
|
||||
);
|
||||
BatchedBridge.registerLazyCallableModule('SamplingProfiler', () =>
|
||||
require('../Performance/SamplingProfiler'),
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
import NativeHeapCapture from './NativeHeapCapture';
|
||||
|
||||
const HeapCapture = {
|
||||
captureHeap: function(path: string) {
|
||||
let error = null;
|
||||
|
@ -20,10 +22,9 @@ const HeapCapture = {
|
|||
console.log('HeapCapture.captureHeap error: ' + e.toString());
|
||||
error = e.toString();
|
||||
}
|
||||
require('../BatchedBridge/NativeModules').JSCHeapCapture.captureComplete(
|
||||
path,
|
||||
error,
|
||||
);
|
||||
if (NativeHeapCapture) {
|
||||
NativeHeapCapture.captureComplete(path, error);
|
||||
}
|
||||
},
|
||||
};
|
||||
|
|
@ -0,0 +1,24 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
import type {TurboModule} from 'RCTExport';
|
||||
import * as TurboModuleRegistry from 'TurboModuleRegistry';
|
||||
|
||||
export interface Spec extends TurboModule {
|
||||
// Common interface
|
||||
+captureHeap: (path: string) => void;
|
||||
|
||||
// Android only
|
||||
+captureComplete: (path: string, error: ?string) => void;
|
||||
}
|
||||
|
||||
export default TurboModuleRegistry.get<Spec>('HeapCapture');
|
Загрузка…
Ссылка в новой задаче