2016-04-29 17:34:51 +03:00
|
|
|
/**
|
2021-12-31 02:08:43 +03:00
|
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
2016-04-29 17:34:51 +03:00
|
|
|
*
|
2018-02-17 05:24:55 +03:00
|
|
|
* This source code is licensed under the MIT license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree.
|
2016-04-29 17:34:51 +03:00
|
|
|
*
|
2018-05-11 05:06:46 +03:00
|
|
|
* @format
|
2020-07-22 19:43:45 +03:00
|
|
|
* @flow strict
|
2016-04-29 17:34:51 +03:00
|
|
|
*/
|
2018-05-11 05:06:46 +03:00
|
|
|
|
2020-01-14 18:54:08 +03:00
|
|
|
import NativeJSCHeapCapture from './NativeJSCHeapCapture';
|
2019-05-22 23:04:35 +03:00
|
|
|
|
2018-05-11 01:44:52 +03:00
|
|
|
const HeapCapture = {
|
2021-11-03 08:10:46 +03:00
|
|
|
captureHeap: function (path: string) {
|
2018-05-11 01:44:52 +03:00
|
|
|
let error = null;
|
2016-04-29 17:34:51 +03:00
|
|
|
try {
|
|
|
|
global.nativeCaptureHeap(path);
|
|
|
|
console.log('HeapCapture.captureHeap succeeded: ' + path);
|
|
|
|
} catch (e) {
|
|
|
|
console.log('HeapCapture.captureHeap error: ' + e.toString());
|
|
|
|
error = e.toString();
|
|
|
|
}
|
2020-01-14 18:54:08 +03:00
|
|
|
if (NativeJSCHeapCapture) {
|
|
|
|
NativeJSCHeapCapture.captureComplete(path, error);
|
2019-05-22 23:04:35 +03:00
|
|
|
}
|
2016-04-29 17:34:51 +03:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = HeapCapture;
|