mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-09-30 09:17:09 +08:00
This reverts commit 25a9b3bd7404d49e55772ffba046ed8df65ad14e. Reason for revert: Memory snapshots work again Original change's description: > Revert "[DevTools]: Moves common to ES modules" > > This reverts commit e064553334d4b0c925f0b1f0e2e0234be66b71be. > > Reason for revert: Memory tool fails to take heap snapshots with this > error: https://imgur.com/hzR9Eqw > > Original change's description: > > [DevTools]: Moves common to ES modules > > > > This CL converts the contents of the common/ folder over to ES modules > > from the current custom module system. It includes statements in each > > file that will pollute the global namespace, allowing the non-ESM code > > to continue working as before. > > > > Bug: 1006759 > > Change-Id: Ib591e49155000381f85999a5da6c467ad0160996 > > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1816563 > > Reviewed-by: Yang Guo <yangguo@chromium.org> > > Commit-Queue: Paul Lewis <aerotwist@chromium.org> > > Cr-Commit-Position: refs/heads/master@{#699728} > > > Change-Id: Ic0d526780451e8bb4de538f11c85859a3badfb0f > No-Presubmit: true > No-Tree-Checks: true > No-Try: true > Bug: 1006759 > Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1825463 > Commit-Queue: Yang Guo <yangguo@chromium.org> > Reviewed-by: Yang Guo <yangguo@chromium.org> > Cr-Commit-Position: refs/heads/master@{#699835} Bug: 1006759 Change-Id: I48c7e84262bb295e5830cac8a79a274226df046c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1825420 Commit-Queue: Paul Lewis <aerotwist@chromium.org> Reviewed-by: Yang Guo <yangguo@chromium.org> Cr-Original-Commit-Position: refs/heads/master@{#699981} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 75a39ca7ac8dcfc6a830db07a5a389ca9ab27b1d
75 lines
2.4 KiB
JavaScript
75 lines
2.4 KiB
JavaScript
// Copyright 2018 The Chromium Authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
|
|
/**
|
|
* @implements {Common.JavaScriptMetadata}
|
|
*/
|
|
JavaScriptMetadata.JavaScriptMetadata = class {
|
|
constructor() {
|
|
/** @type {!Map<string, !Array<!Array<string>>>} */
|
|
this._uniqueFunctions = new Map();
|
|
/** @type {!Map<string, !Map<string, !Array<!Array<string>>>>} */
|
|
this._instanceMethods = new Map();
|
|
/** @type {!Map<string, !Map<string, !Array<!Array<string>>>>} */
|
|
this._staticMethods = new Map();
|
|
|
|
for (const nativeFunction of JavaScriptMetadata.NativeFunctions) {
|
|
if (!nativeFunction.receiver) {
|
|
this._uniqueFunctions.set(nativeFunction.name, nativeFunction.signatures);
|
|
} else if (nativeFunction.static) {
|
|
if (!this._staticMethods.has(nativeFunction.receiver))
|
|
this._staticMethods.set(nativeFunction.receiver, new Map());
|
|
this._staticMethods.get(nativeFunction.receiver).set(nativeFunction.name, nativeFunction.signatures);
|
|
} else {
|
|
if (!this._instanceMethods.has(nativeFunction.receiver))
|
|
this._instanceMethods.set(nativeFunction.receiver, new Map());
|
|
this._instanceMethods.get(nativeFunction.receiver).set(nativeFunction.name, nativeFunction.signatures);
|
|
}
|
|
}
|
|
}
|
|
|
|
/**
|
|
* @override
|
|
* @param {string} name
|
|
* @return {?Array<!Array<string>>}
|
|
*/
|
|
signaturesForNativeFunction(name) {
|
|
return this._uniqueFunctions.get(name) || null;
|
|
}
|
|
|
|
/**
|
|
* @override
|
|
* @param {string} name
|
|
* @param {string} receiverClassName
|
|
* @return {?Array<!Array<string>>}
|
|
*/
|
|
signaturesForInstanceMethod(name, receiverClassName) {
|
|
if (!this._instanceMethods.has(receiverClassName))
|
|
return null;
|
|
return this._instanceMethods.get(receiverClassName).get(name) || null;
|
|
}
|
|
|
|
/**
|
|
* @override
|
|
* @param {string} name
|
|
* @param {string} receiverConstructorName
|
|
* @return {?Array<!Array<string>>}
|
|
*/
|
|
signaturesForStaticMethod(name, receiverConstructorName) {
|
|
if (!this._staticMethods.has(receiverConstructorName))
|
|
return null;
|
|
return this._staticMethods.get(receiverConstructorName).get(name) || null;
|
|
}
|
|
};
|
|
|
|
/**
|
|
* @type {!Array<{
|
|
* name: string,
|
|
* signatures: !Array<!Array<string>>,
|
|
* static: (boolean|undefined),
|
|
* receiver: (string|undefined),
|
|
* }>}
|
|
*/
|
|
JavaScriptMetadata.NativeFunctions;
|