| Index: third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotProxy.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotProxy.js b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotProxy.js
|
| index 2c9670d926b6ff0750fbfb097812e2a0fb13da06..03817251741a524c9f35eaf096b1b7b46d967187 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotProxy.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/profiler/HeapSnapshotProxy.js
|
| @@ -27,14 +27,15 @@
|
| * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
| * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
| */
|
| -
|
| /**
|
| - * @constructor
|
| - * @param {function(string, *)} eventHandler
|
| - * @extends {WebInspector.Object}
|
| + * @unrestricted
|
| */
|
| -WebInspector.HeapSnapshotWorkerProxy = function(eventHandler)
|
| -{
|
| +WebInspector.HeapSnapshotWorkerProxy = class extends WebInspector.Object {
|
| + /**
|
| + * @param {function(string, *)} eventHandler
|
| + */
|
| + constructor(eventHandler) {
|
| + super();
|
| this._eventHandler = eventHandler;
|
| this._nextObjectId = 1;
|
| this._nextCallId = 1;
|
| @@ -42,537 +43,508 @@ WebInspector.HeapSnapshotWorkerProxy = function(eventHandler)
|
| this._callbacks = new Map();
|
| /** @type {!Set<number>} */
|
| this._previousCallbacks = new Set();
|
| - this._worker = new WebInspector.Worker("heap_snapshot_worker");
|
| + this._worker = new WebInspector.Worker('heap_snapshot_worker');
|
| this._worker.onmessage = this._messageReceived.bind(this);
|
| -};
|
| + }
|
| +
|
| + /**
|
| + * @param {number} profileUid
|
| + * @param {function(!WebInspector.HeapSnapshotProxy)} snapshotReceivedCallback
|
| + * @return {!WebInspector.HeapSnapshotLoaderProxy}
|
| + */
|
| + createLoader(profileUid, snapshotReceivedCallback) {
|
| + var objectId = this._nextObjectId++;
|
| + var proxy = new WebInspector.HeapSnapshotLoaderProxy(this, objectId, profileUid, snapshotReceivedCallback);
|
| + this._postMessage({
|
| + callId: this._nextCallId++,
|
| + disposition: 'create',
|
| + objectId: objectId,
|
| + methodName: 'WebInspector.HeapSnapshotLoader'
|
| + });
|
| + return proxy;
|
| + }
|
| +
|
| + dispose() {
|
| + this._worker.terminate();
|
| + if (this._interval)
|
| + clearInterval(this._interval);
|
| + }
|
| +
|
| + disposeObject(objectId) {
|
| + this._postMessage({callId: this._nextCallId++, disposition: 'dispose', objectId: objectId});
|
| + }
|
| +
|
| + evaluateForTest(script, callback) {
|
| + var callId = this._nextCallId++;
|
| + this._callbacks.set(callId, callback);
|
| + this._postMessage({callId: callId, disposition: 'evaluateForTest', source: script});
|
| + }
|
| +
|
| + /**
|
| + * @param {?function(...?)} callback
|
| + * @param {string} objectId
|
| + * @param {string} methodName
|
| + * @param {function(new:T, ...?)} proxyConstructor
|
| + * @return {?Object}
|
| + * @template T
|
| + */
|
| + callFactoryMethod(callback, objectId, methodName, proxyConstructor) {
|
| + var callId = this._nextCallId++;
|
| + var methodArguments = Array.prototype.slice.call(arguments, 4);
|
| + var newObjectId = this._nextObjectId++;
|
|
|
| -WebInspector.HeapSnapshotWorkerProxy.prototype = {
|
| /**
|
| - * @param {number} profileUid
|
| - * @param {function(!WebInspector.HeapSnapshotProxy)} snapshotReceivedCallback
|
| - * @return {!WebInspector.HeapSnapshotLoaderProxy}
|
| + * @this {WebInspector.HeapSnapshotWorkerProxy}
|
| */
|
| - createLoader: function(profileUid, snapshotReceivedCallback)
|
| - {
|
| - var objectId = this._nextObjectId++;
|
| - var proxy = new WebInspector.HeapSnapshotLoaderProxy(this, objectId, profileUid, snapshotReceivedCallback);
|
| - this._postMessage({callId: this._nextCallId++, disposition: "create", objectId: objectId, methodName: "WebInspector.HeapSnapshotLoader"});
|
| - return proxy;
|
| - },
|
| -
|
| - dispose: function()
|
| - {
|
| - this._worker.terminate();
|
| - if (this._interval)
|
| - clearInterval(this._interval);
|
| - },
|
| -
|
| - disposeObject: function(objectId)
|
| - {
|
| - this._postMessage({callId: this._nextCallId++, disposition: "dispose", objectId: objectId});
|
| - },
|
| -
|
| - evaluateForTest: function(script, callback)
|
| - {
|
| - var callId = this._nextCallId++;
|
| - this._callbacks.set(callId, callback);
|
| - this._postMessage({callId: callId, disposition: "evaluateForTest", source: script});
|
| - },
|
| -
|
| - /**
|
| - * @param {?function(...?)} callback
|
| - * @param {string} objectId
|
| - * @param {string} methodName
|
| - * @param {function(new:T, ...?)} proxyConstructor
|
| - * @return {?Object}
|
| - * @template T
|
| - */
|
| - callFactoryMethod: function(callback, objectId, methodName, proxyConstructor)
|
| - {
|
| - var callId = this._nextCallId++;
|
| - var methodArguments = Array.prototype.slice.call(arguments, 4);
|
| - var newObjectId = this._nextObjectId++;
|
| -
|
| - /**
|
| - * @this {WebInspector.HeapSnapshotWorkerProxy}
|
| - */
|
| - function wrapCallback(remoteResult)
|
| - {
|
| - callback(remoteResult ? new proxyConstructor(this, newObjectId) : null);
|
| - }
|
| -
|
| - if (callback) {
|
| - this._callbacks.set(callId, wrapCallback.bind(this));
|
| - this._postMessage({callId: callId, disposition: "factory", objectId: objectId, methodName: methodName, methodArguments: methodArguments, newObjectId: newObjectId});
|
| - return null;
|
| - } else {
|
| - this._postMessage({callId: callId, disposition: "factory", objectId: objectId, methodName: methodName, methodArguments: methodArguments, newObjectId: newObjectId});
|
| - return new proxyConstructor(this, newObjectId);
|
| - }
|
| - },
|
| -
|
| - /**
|
| - * @param {function(*)} callback
|
| - * @param {string} objectId
|
| - * @param {string} methodName
|
| - */
|
| - callMethod: function(callback, objectId, methodName)
|
| - {
|
| - var callId = this._nextCallId++;
|
| - var methodArguments = Array.prototype.slice.call(arguments, 3);
|
| - if (callback)
|
| - this._callbacks.set(callId, callback);
|
| - this._postMessage({callId: callId, disposition: "method", objectId: objectId, methodName: methodName, methodArguments: methodArguments});
|
| - },
|
| -
|
| - startCheckingForLongRunningCalls: function()
|
| - {
|
| - if (this._interval)
|
| - return;
|
| - this._checkLongRunningCalls();
|
| - this._interval = setInterval(this._checkLongRunningCalls.bind(this), 300);
|
| - },
|
| -
|
| - _checkLongRunningCalls: function()
|
| - {
|
| - for (var callId of this._previousCallbacks)
|
| - if (!this._callbacks.has(callId))
|
| - this._previousCallbacks.delete(callId);
|
| - var hasLongRunningCalls = !!this._previousCallbacks.size;
|
| - this.dispatchEventToListeners("wait", hasLongRunningCalls);
|
| - for (var callId of this._callbacks.keysArray())
|
| - this._previousCallbacks.add(callId);
|
| - },
|
| + function wrapCallback(remoteResult) {
|
| + callback(remoteResult ? new proxyConstructor(this, newObjectId) : null);
|
| + }
|
|
|
| - /**
|
| - * @param {!MessageEvent} event
|
| - */
|
| - _messageReceived: function(event)
|
| - {
|
| - var data = event.data;
|
| - if (data.eventName) {
|
| - if (this._eventHandler)
|
| - this._eventHandler(data.eventName, data.data);
|
| - return;
|
| - }
|
| - if (data.error) {
|
| - if (data.errorMethodName)
|
| - WebInspector.console.error(WebInspector.UIString("An error occurred when a call to method '%s' was requested", data.errorMethodName));
|
| - WebInspector.console.error(data["errorCallStack"]);
|
| - this._callbacks.delete(data.callId);
|
| - return;
|
| - }
|
| - if (!this._callbacks.has(data.callId))
|
| - return;
|
| - var callback = this._callbacks.get(data.callId);
|
| - this._callbacks.delete(data.callId);
|
| - callback(data.result);
|
| - },
|
| -
|
| - _postMessage: function(message)
|
| - {
|
| - this._worker.postMessage(message);
|
| - },
|
| -
|
| - __proto__: WebInspector.Object.prototype
|
| + if (callback) {
|
| + this._callbacks.set(callId, wrapCallback.bind(this));
|
| + this._postMessage({
|
| + callId: callId,
|
| + disposition: 'factory',
|
| + objectId: objectId,
|
| + methodName: methodName,
|
| + methodArguments: methodArguments,
|
| + newObjectId: newObjectId
|
| + });
|
| + return null;
|
| + } else {
|
| + this._postMessage({
|
| + callId: callId,
|
| + disposition: 'factory',
|
| + objectId: objectId,
|
| + methodName: methodName,
|
| + methodArguments: methodArguments,
|
| + newObjectId: newObjectId
|
| + });
|
| + return new proxyConstructor(this, newObjectId);
|
| + }
|
| + }
|
| +
|
| + /**
|
| + * @param {function(*)} callback
|
| + * @param {string} objectId
|
| + * @param {string} methodName
|
| + */
|
| + callMethod(callback, objectId, methodName) {
|
| + var callId = this._nextCallId++;
|
| + var methodArguments = Array.prototype.slice.call(arguments, 3);
|
| + if (callback)
|
| + this._callbacks.set(callId, callback);
|
| + this._postMessage({
|
| + callId: callId,
|
| + disposition: 'method',
|
| + objectId: objectId,
|
| + methodName: methodName,
|
| + methodArguments: methodArguments
|
| + });
|
| + }
|
| +
|
| + startCheckingForLongRunningCalls() {
|
| + if (this._interval)
|
| + return;
|
| + this._checkLongRunningCalls();
|
| + this._interval = setInterval(this._checkLongRunningCalls.bind(this), 300);
|
| + }
|
| +
|
| + _checkLongRunningCalls() {
|
| + for (var callId of this._previousCallbacks)
|
| + if (!this._callbacks.has(callId))
|
| + this._previousCallbacks.delete(callId);
|
| + var hasLongRunningCalls = !!this._previousCallbacks.size;
|
| + this.dispatchEventToListeners('wait', hasLongRunningCalls);
|
| + for (var callId of this._callbacks.keysArray())
|
| + this._previousCallbacks.add(callId);
|
| + }
|
| +
|
| + /**
|
| + * @param {!MessageEvent} event
|
| + */
|
| + _messageReceived(event) {
|
| + var data = event.data;
|
| + if (data.eventName) {
|
| + if (this._eventHandler)
|
| + this._eventHandler(data.eventName, data.data);
|
| + return;
|
| + }
|
| + if (data.error) {
|
| + if (data.errorMethodName)
|
| + WebInspector.console.error(WebInspector.UIString(
|
| + 'An error occurred when a call to method \'%s\' was requested', data.errorMethodName));
|
| + WebInspector.console.error(data['errorCallStack']);
|
| + this._callbacks.delete(data.callId);
|
| + return;
|
| + }
|
| + if (!this._callbacks.has(data.callId))
|
| + return;
|
| + var callback = this._callbacks.get(data.callId);
|
| + this._callbacks.delete(data.callId);
|
| + callback(data.result);
|
| + }
|
| +
|
| + _postMessage(message) {
|
| + this._worker.postMessage(message);
|
| + }
|
| };
|
|
|
| -
|
| /**
|
| - * @constructor
|
| - * @param {!WebInspector.HeapSnapshotWorkerProxy} worker
|
| - * @param {number} objectId
|
| + * @unrestricted
|
| */
|
| -WebInspector.HeapSnapshotProxyObject = function(worker, objectId)
|
| -{
|
| +WebInspector.HeapSnapshotProxyObject = class {
|
| + /**
|
| + * @param {!WebInspector.HeapSnapshotWorkerProxy} worker
|
| + * @param {number} objectId
|
| + */
|
| + constructor(worker, objectId) {
|
| this._worker = worker;
|
| this._objectId = objectId;
|
| -};
|
| -
|
| -WebInspector.HeapSnapshotProxyObject.prototype = {
|
| + }
|
| +
|
| + /**
|
| + * @param {string} workerMethodName
|
| + * @param {!Array.<*>} args
|
| + */
|
| + _callWorker(workerMethodName, args) {
|
| + args.splice(1, 0, this._objectId);
|
| + return this._worker[workerMethodName].apply(this._worker, args);
|
| + }
|
| +
|
| + dispose() {
|
| + this._worker.disposeObject(this._objectId);
|
| + }
|
| +
|
| + disposeWorker() {
|
| + this._worker.dispose();
|
| + }
|
| +
|
| + /**
|
| + * @param {?function(...?)} callback
|
| + * @param {string} methodName
|
| + * @param {function (new:T, ...?)} proxyConstructor
|
| + * @param {...*} var_args
|
| + * @return {!T}
|
| + * @template T
|
| + */
|
| + callFactoryMethod(callback, methodName, proxyConstructor, var_args) {
|
| + return this._callWorker('callFactoryMethod', Array.prototype.slice.call(arguments, 0));
|
| + }
|
| +
|
| + /**
|
| + * @param {function(T)|undefined} callback
|
| + * @param {string} methodName
|
| + * @param {...*} var_args
|
| + * @return {*}
|
| + * @template T
|
| + */
|
| + callMethod(callback, methodName, var_args) {
|
| + return this._callWorker('callMethod', Array.prototype.slice.call(arguments, 0));
|
| + }
|
| +
|
| + /**
|
| + * @param {string} methodName
|
| + * @param {...*} var_args
|
| + * @return {!Promise.<?T>}
|
| + * @template T
|
| + */
|
| + _callMethodPromise(methodName, var_args) {
|
| /**
|
| - * @param {string} workerMethodName
|
| * @param {!Array.<*>} args
|
| - */
|
| - _callWorker: function(workerMethodName, args)
|
| - {
|
| - args.splice(1, 0, this._objectId);
|
| - return this._worker[workerMethodName].apply(this._worker, args);
|
| - },
|
| -
|
| - dispose: function()
|
| - {
|
| - this._worker.disposeObject(this._objectId);
|
| - },
|
| -
|
| - disposeWorker: function()
|
| - {
|
| - this._worker.dispose();
|
| - },
|
| -
|
| - /**
|
| - * @param {?function(...?)} callback
|
| - * @param {string} methodName
|
| - * @param {function (new:T, ...?)} proxyConstructor
|
| - * @param {...*} var_args
|
| - * @return {!T}
|
| - * @template T
|
| - */
|
| - callFactoryMethod: function(callback, methodName, proxyConstructor, var_args)
|
| - {
|
| - return this._callWorker("callFactoryMethod", Array.prototype.slice.call(arguments, 0));
|
| - },
|
| -
|
| - /**
|
| - * @param {function(T)|undefined} callback
|
| - * @param {string} methodName
|
| - * @param {...*} var_args
|
| - * @return {*}
|
| + * @param {function(?T)} fulfill
|
| + * @this {WebInspector.HeapSnapshotProxyObject}
|
| * @template T
|
| */
|
| - callMethod: function(callback, methodName, var_args)
|
| - {
|
| - return this._callWorker("callMethod", Array.prototype.slice.call(arguments, 0));
|
| - },
|
| -
|
| - /**
|
| - * @param {string} methodName
|
| - * @param {...*} var_args
|
| - * @return {!Promise.<?T>}
|
| - * @template T
|
| - */
|
| - _callMethodPromise: function(methodName, var_args)
|
| - {
|
| - /**
|
| - * @param {!Array.<*>} args
|
| - * @param {function(?T)} fulfill
|
| - * @this {WebInspector.HeapSnapshotProxyObject}
|
| - * @template T
|
| - */
|
| - function action(args, fulfill)
|
| - {
|
| - this._callWorker("callMethod", [fulfill].concat(args));
|
| - }
|
| - return new Promise(action.bind(this, Array.prototype.slice.call(arguments)));
|
| + function action(args, fulfill) {
|
| + this._callWorker('callMethod', [fulfill].concat(args));
|
| }
|
| + return new Promise(action.bind(this, Array.prototype.slice.call(arguments)));
|
| + }
|
| };
|
|
|
| /**
|
| - * @constructor
|
| - * @extends {WebInspector.HeapSnapshotProxyObject}
|
| * @implements {WebInspector.OutputStream}
|
| - * @param {!WebInspector.HeapSnapshotWorkerProxy} worker
|
| - * @param {number} objectId
|
| - * @param {number} profileUid
|
| - * @param {function(!WebInspector.HeapSnapshotProxy)} snapshotReceivedCallback
|
| + * @unrestricted
|
| */
|
| -WebInspector.HeapSnapshotLoaderProxy = function(worker, objectId, profileUid, snapshotReceivedCallback)
|
| -{
|
| - WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId);
|
| +WebInspector.HeapSnapshotLoaderProxy = class extends WebInspector.HeapSnapshotProxyObject {
|
| + /**
|
| + * @param {!WebInspector.HeapSnapshotWorkerProxy} worker
|
| + * @param {number} objectId
|
| + * @param {number} profileUid
|
| + * @param {function(!WebInspector.HeapSnapshotProxy)} snapshotReceivedCallback
|
| + */
|
| + constructor(worker, objectId, profileUid, snapshotReceivedCallback) {
|
| + super(worker, objectId);
|
| this._profileUid = profileUid;
|
| this._snapshotReceivedCallback = snapshotReceivedCallback;
|
| -};
|
| -
|
| -WebInspector.HeapSnapshotLoaderProxy.prototype = {
|
| + }
|
| +
|
| + /**
|
| + * @override
|
| + * @param {string} chunk
|
| + * @param {function(!WebInspector.OutputStream)=} callback
|
| + */
|
| + write(chunk, callback) {
|
| + this.callMethod(callback, 'write', chunk);
|
| + }
|
| +
|
| + /**
|
| + * @override
|
| + * @param {function()=} callback
|
| + */
|
| + close(callback) {
|
| /**
|
| - * @override
|
| - * @param {string} chunk
|
| - * @param {function(!WebInspector.OutputStream)=} callback
|
| + * @this {WebInspector.HeapSnapshotLoaderProxy}
|
| */
|
| - write: function(chunk, callback)
|
| - {
|
| - this.callMethod(callback, "write", chunk);
|
| - },
|
| + function buildSnapshot() {
|
| + if (callback)
|
| + callback();
|
| + this.callFactoryMethod(updateStaticData.bind(this), 'buildSnapshot', WebInspector.HeapSnapshotProxy);
|
| + }
|
|
|
| /**
|
| - * @override
|
| - * @param {function()=} callback
|
| + * @param {!WebInspector.HeapSnapshotProxy} snapshotProxy
|
| + * @this {WebInspector.HeapSnapshotLoaderProxy}
|
| */
|
| - close: function(callback)
|
| - {
|
| - /**
|
| - * @this {WebInspector.HeapSnapshotLoaderProxy}
|
| - */
|
| - function buildSnapshot()
|
| - {
|
| - if (callback)
|
| - callback();
|
| - this.callFactoryMethod(updateStaticData.bind(this), "buildSnapshot", WebInspector.HeapSnapshotProxy);
|
| - }
|
| -
|
| - /**
|
| - * @param {!WebInspector.HeapSnapshotProxy} snapshotProxy
|
| - * @this {WebInspector.HeapSnapshotLoaderProxy}
|
| - */
|
| - function updateStaticData(snapshotProxy)
|
| - {
|
| - this.dispose();
|
| - snapshotProxy.setProfileUid(this._profileUid);
|
| - snapshotProxy.updateStaticData(this._snapshotReceivedCallback.bind(this));
|
| - }
|
| -
|
| - this.callMethod(buildSnapshot.bind(this), "close");
|
| - },
|
| -
|
| - __proto__: WebInspector.HeapSnapshotProxyObject.prototype
|
| -};
|
| + function updateStaticData(snapshotProxy) {
|
| + this.dispose();
|
| + snapshotProxy.setProfileUid(this._profileUid);
|
| + snapshotProxy.updateStaticData(this._snapshotReceivedCallback.bind(this));
|
| + }
|
|
|
| + this.callMethod(buildSnapshot.bind(this), 'close');
|
| + }
|
| +};
|
|
|
| /**
|
| - * @constructor
|
| - * @extends {WebInspector.HeapSnapshotProxyObject}
|
| - * @param {!WebInspector.HeapSnapshotWorkerProxy} worker
|
| - * @param {number} objectId
|
| + * @unrestricted
|
| */
|
| -WebInspector.HeapSnapshotProxy = function(worker, objectId)
|
| -{
|
| - WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId);
|
| +WebInspector.HeapSnapshotProxy = class extends WebInspector.HeapSnapshotProxyObject {
|
| + /**
|
| + * @param {!WebInspector.HeapSnapshotWorkerProxy} worker
|
| + * @param {number} objectId
|
| + */
|
| + constructor(worker, objectId) {
|
| + super(worker, objectId);
|
| /** @type {?WebInspector.HeapSnapshotCommon.StaticData} */
|
| this._staticData = null;
|
| -};
|
| -
|
| -WebInspector.HeapSnapshotProxy.prototype = {
|
| + }
|
| +
|
| + /**
|
| + * @param {!WebInspector.HeapSnapshotCommon.SearchConfig} searchConfig
|
| + * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} filter
|
| + * @return {!Promise<!Array<number>>}
|
| + */
|
| + search(searchConfig, filter) {
|
| + return this._callMethodPromise('search', searchConfig, filter);
|
| + }
|
| +
|
| + /**
|
| + * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} filter
|
| + * @param {function(!Object.<string, !WebInspector.HeapSnapshotCommon.Aggregate>)} callback
|
| + */
|
| + aggregatesWithFilter(filter, callback) {
|
| + this.callMethod(callback, 'aggregatesWithFilter', filter);
|
| + }
|
| +
|
| + aggregatesForDiff(callback) {
|
| + this.callMethod(callback, 'aggregatesForDiff');
|
| + }
|
| +
|
| + calculateSnapshotDiff(baseSnapshotId, baseSnapshotAggregates, callback) {
|
| + this.callMethod(callback, 'calculateSnapshotDiff', baseSnapshotId, baseSnapshotAggregates);
|
| + }
|
| +
|
| + /**
|
| + * @param {number} snapshotObjectId
|
| + * @return {!Promise<?string>}
|
| + */
|
| + nodeClassName(snapshotObjectId) {
|
| + return this._callMethodPromise('nodeClassName', snapshotObjectId);
|
| + }
|
| +
|
| + /**
|
| + * @param {number} nodeIndex
|
| + * @return {!WebInspector.HeapSnapshotProviderProxy}
|
| + */
|
| + createEdgesProvider(nodeIndex) {
|
| + return this.callFactoryMethod(null, 'createEdgesProvider', WebInspector.HeapSnapshotProviderProxy, nodeIndex);
|
| + }
|
| +
|
| + /**
|
| + * @param {number} nodeIndex
|
| + * @return {!WebInspector.HeapSnapshotProviderProxy}
|
| + */
|
| + createRetainingEdgesProvider(nodeIndex) {
|
| + return this.callFactoryMethod(
|
| + null, 'createRetainingEdgesProvider', WebInspector.HeapSnapshotProviderProxy, nodeIndex);
|
| + }
|
| +
|
| + /**
|
| + * @param {string} baseSnapshotId
|
| + * @param {string} className
|
| + * @return {?WebInspector.HeapSnapshotProviderProxy}
|
| + */
|
| + createAddedNodesProvider(baseSnapshotId, className) {
|
| + return this.callFactoryMethod(
|
| + null, 'createAddedNodesProvider', WebInspector.HeapSnapshotProviderProxy, baseSnapshotId, className);
|
| + }
|
| +
|
| + /**
|
| + * @param {!Array.<number>} nodeIndexes
|
| + * @return {?WebInspector.HeapSnapshotProviderProxy}
|
| + */
|
| + createDeletedNodesProvider(nodeIndexes) {
|
| + return this.callFactoryMethod(
|
| + null, 'createDeletedNodesProvider', WebInspector.HeapSnapshotProviderProxy, nodeIndexes);
|
| + }
|
| +
|
| + /**
|
| + * @param {function(*):boolean} filter
|
| + * @return {?WebInspector.HeapSnapshotProviderProxy}
|
| + */
|
| + createNodesProvider(filter) {
|
| + return this.callFactoryMethod(null, 'createNodesProvider', WebInspector.HeapSnapshotProviderProxy, filter);
|
| + }
|
| +
|
| + /**
|
| + * @param {string} className
|
| + * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} nodeFilter
|
| + * @return {?WebInspector.HeapSnapshotProviderProxy}
|
| + */
|
| + createNodesProviderForClass(className, nodeFilter) {
|
| + return this.callFactoryMethod(
|
| + null, 'createNodesProviderForClass', WebInspector.HeapSnapshotProviderProxy, className, nodeFilter);
|
| + }
|
| +
|
| + allocationTracesTops(callback) {
|
| + this.callMethod(callback, 'allocationTracesTops');
|
| + }
|
| +
|
| + /**
|
| + * @param {number} nodeId
|
| + * @param {function(!WebInspector.HeapSnapshotCommon.AllocationNodeCallers)} callback
|
| + */
|
| + allocationNodeCallers(nodeId, callback) {
|
| + this.callMethod(callback, 'allocationNodeCallers', nodeId);
|
| + }
|
| +
|
| + /**
|
| + * @param {number} nodeIndex
|
| + * @param {function(?Array.<!WebInspector.HeapSnapshotCommon.AllocationStackFrame>)} callback
|
| + */
|
| + allocationStack(nodeIndex, callback) {
|
| + this.callMethod(callback, 'allocationStack', nodeIndex);
|
| + }
|
| +
|
| + /**
|
| + * @override
|
| + */
|
| + dispose() {
|
| + throw new Error('Should never be called');
|
| + }
|
| +
|
| + get nodeCount() {
|
| + return this._staticData.nodeCount;
|
| + }
|
| +
|
| + get rootNodeIndex() {
|
| + return this._staticData.rootNodeIndex;
|
| + }
|
| +
|
| + updateStaticData(callback) {
|
| /**
|
| - * @param {!WebInspector.HeapSnapshotCommon.SearchConfig} searchConfig
|
| - * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} filter
|
| - * @return {!Promise<!Array<number>>}
|
| + * @param {!WebInspector.HeapSnapshotCommon.StaticData} staticData
|
| + * @this {WebInspector.HeapSnapshotProxy}
|
| */
|
| - search: function(searchConfig, filter)
|
| - {
|
| - return this._callMethodPromise("search", searchConfig, filter);
|
| - },
|
| -
|
| - /**
|
| - * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} filter
|
| - * @param {function(!Object.<string, !WebInspector.HeapSnapshotCommon.Aggregate>)} callback
|
| - */
|
| - aggregatesWithFilter: function(filter, callback)
|
| - {
|
| - this.callMethod(callback, "aggregatesWithFilter", filter);
|
| - },
|
| -
|
| - aggregatesForDiff: function(callback)
|
| - {
|
| - this.callMethod(callback, "aggregatesForDiff");
|
| - },
|
| -
|
| - calculateSnapshotDiff: function(baseSnapshotId, baseSnapshotAggregates, callback)
|
| - {
|
| - this.callMethod(callback, "calculateSnapshotDiff", baseSnapshotId, baseSnapshotAggregates);
|
| - },
|
| -
|
| - /**
|
| - * @param {number} snapshotObjectId
|
| - * @return {!Promise<?string>}
|
| - */
|
| - nodeClassName: function(snapshotObjectId)
|
| - {
|
| - return this._callMethodPromise("nodeClassName", snapshotObjectId);
|
| - },
|
| -
|
| - /**
|
| - * @param {number} nodeIndex
|
| - * @return {!WebInspector.HeapSnapshotProviderProxy}
|
| - */
|
| - createEdgesProvider: function(nodeIndex)
|
| - {
|
| - return this.callFactoryMethod(null, "createEdgesProvider", WebInspector.HeapSnapshotProviderProxy, nodeIndex);
|
| - },
|
| -
|
| - /**
|
| - * @param {number} nodeIndex
|
| - * @return {!WebInspector.HeapSnapshotProviderProxy}
|
| - */
|
| - createRetainingEdgesProvider: function(nodeIndex)
|
| - {
|
| - return this.callFactoryMethod(null, "createRetainingEdgesProvider", WebInspector.HeapSnapshotProviderProxy, nodeIndex);
|
| - },
|
| -
|
| - /**
|
| - * @param {string} baseSnapshotId
|
| - * @param {string} className
|
| - * @return {?WebInspector.HeapSnapshotProviderProxy}
|
| - */
|
| - createAddedNodesProvider: function(baseSnapshotId, className)
|
| - {
|
| - return this.callFactoryMethod(null, "createAddedNodesProvider", WebInspector.HeapSnapshotProviderProxy, baseSnapshotId, className);
|
| - },
|
| -
|
| - /**
|
| - * @param {!Array.<number>} nodeIndexes
|
| - * @return {?WebInspector.HeapSnapshotProviderProxy}
|
| - */
|
| - createDeletedNodesProvider: function(nodeIndexes)
|
| - {
|
| - return this.callFactoryMethod(null, "createDeletedNodesProvider", WebInspector.HeapSnapshotProviderProxy, nodeIndexes);
|
| - },
|
| -
|
| - /**
|
| - * @param {function(*):boolean} filter
|
| - * @return {?WebInspector.HeapSnapshotProviderProxy}
|
| - */
|
| - createNodesProvider: function(filter)
|
| - {
|
| - return this.callFactoryMethod(null, "createNodesProvider", WebInspector.HeapSnapshotProviderProxy, filter);
|
| - },
|
| -
|
| - /**
|
| - * @param {string} className
|
| - * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} nodeFilter
|
| - * @return {?WebInspector.HeapSnapshotProviderProxy}
|
| - */
|
| - createNodesProviderForClass: function(className, nodeFilter)
|
| - {
|
| - return this.callFactoryMethod(null, "createNodesProviderForClass", WebInspector.HeapSnapshotProviderProxy, className, nodeFilter);
|
| - },
|
| -
|
| - allocationTracesTops: function(callback)
|
| - {
|
| - this.callMethod(callback, "allocationTracesTops");
|
| - },
|
| -
|
| - /**
|
| - * @param {number} nodeId
|
| - * @param {function(!WebInspector.HeapSnapshotCommon.AllocationNodeCallers)} callback
|
| - */
|
| - allocationNodeCallers: function(nodeId, callback)
|
| - {
|
| - this.callMethod(callback, "allocationNodeCallers", nodeId);
|
| - },
|
| -
|
| - /**
|
| - * @param {number} nodeIndex
|
| - * @param {function(?Array.<!WebInspector.HeapSnapshotCommon.AllocationStackFrame>)} callback
|
| - */
|
| - allocationStack: function(nodeIndex, callback)
|
| - {
|
| - this.callMethod(callback, "allocationStack", nodeIndex);
|
| - },
|
| -
|
| - dispose: function()
|
| - {
|
| - throw new Error("Should never be called");
|
| - },
|
| -
|
| - get nodeCount()
|
| - {
|
| - return this._staticData.nodeCount;
|
| - },
|
| -
|
| - get rootNodeIndex()
|
| - {
|
| - return this._staticData.rootNodeIndex;
|
| - },
|
| -
|
| - updateStaticData: function(callback)
|
| - {
|
| - /**
|
| - * @param {!WebInspector.HeapSnapshotCommon.StaticData} staticData
|
| - * @this {WebInspector.HeapSnapshotProxy}
|
| - */
|
| - function dataReceived(staticData)
|
| - {
|
| - this._staticData = staticData;
|
| - callback(this);
|
| - }
|
| - this.callMethod(dataReceived.bind(this), "updateStaticData");
|
| - },
|
| -
|
| - /**
|
| - * @return {!Promise.<!WebInspector.HeapSnapshotCommon.Statistics>}
|
| - */
|
| - getStatistics: function()
|
| - {
|
| - return this._callMethodPromise("getStatistics");
|
| - },
|
| -
|
| - /**
|
| - * @return {!Promise.<?WebInspector.HeapSnapshotCommon.Samples>}
|
| - */
|
| - getSamples: function()
|
| - {
|
| - return this._callMethodPromise("getSamples");
|
| - },
|
| -
|
| - get totalSize()
|
| - {
|
| - return this._staticData.totalSize;
|
| - },
|
| -
|
| - get uid()
|
| - {
|
| - return this._profileUid;
|
| - },
|
| -
|
| - setProfileUid: function(profileUid)
|
| - {
|
| - this._profileUid = profileUid;
|
| - },
|
| -
|
| - /**
|
| - * @return {number}
|
| - */
|
| - maxJSObjectId: function()
|
| - {
|
| - return this._staticData.maxJSObjectId;
|
| - },
|
| -
|
| - __proto__: WebInspector.HeapSnapshotProxyObject.prototype
|
| + function dataReceived(staticData) {
|
| + this._staticData = staticData;
|
| + callback(this);
|
| + }
|
| + this.callMethod(dataReceived.bind(this), 'updateStaticData');
|
| + }
|
| +
|
| + /**
|
| + * @return {!Promise.<!WebInspector.HeapSnapshotCommon.Statistics>}
|
| + */
|
| + getStatistics() {
|
| + return this._callMethodPromise('getStatistics');
|
| + }
|
| +
|
| + /**
|
| + * @return {!Promise.<?WebInspector.HeapSnapshotCommon.Samples>}
|
| + */
|
| + getSamples() {
|
| + return this._callMethodPromise('getSamples');
|
| + }
|
| +
|
| + get totalSize() {
|
| + return this._staticData.totalSize;
|
| + }
|
| +
|
| + get uid() {
|
| + return this._profileUid;
|
| + }
|
| +
|
| + setProfileUid(profileUid) {
|
| + this._profileUid = profileUid;
|
| + }
|
| +
|
| + /**
|
| + * @return {number}
|
| + */
|
| + maxJSObjectId() {
|
| + return this._staticData.maxJSObjectId;
|
| + }
|
| };
|
|
|
| -
|
| /**
|
| - * @constructor
|
| - * @extends {WebInspector.HeapSnapshotProxyObject}
|
| * @implements {WebInspector.HeapSnapshotGridNode.ChildrenProvider}
|
| - * @param {!WebInspector.HeapSnapshotWorkerProxy} worker
|
| - * @param {number} objectId
|
| + * @unrestricted
|
| */
|
| -WebInspector.HeapSnapshotProviderProxy = function(worker, objectId)
|
| -{
|
| - WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId);
|
| -};
|
| -
|
| -WebInspector.HeapSnapshotProviderProxy.prototype = {
|
| - /**
|
| - * @override
|
| - * @param {number} snapshotObjectId
|
| - * @return {!Promise<number>}
|
| - */
|
| - nodePosition: function(snapshotObjectId)
|
| - {
|
| - return this._callMethodPromise("nodePosition", snapshotObjectId);
|
| - },
|
| -
|
| - /**
|
| - * @override
|
| - * @param {function(boolean)} callback
|
| - */
|
| - isEmpty: function(callback)
|
| - {
|
| - this.callMethod(callback, "isEmpty");
|
| - },
|
| -
|
| - /**
|
| - * @override
|
| - * @param {number} startPosition
|
| - * @param {number} endPosition
|
| - * @param {function(!WebInspector.HeapSnapshotCommon.ItemsRange)} callback
|
| - */
|
| - serializeItemsRange: function(startPosition, endPosition, callback)
|
| - {
|
| - this.callMethod(callback, "serializeItemsRange", startPosition, endPosition);
|
| - },
|
| -
|
| - /**
|
| - * @override
|
| - * @param {!WebInspector.HeapSnapshotCommon.ComparatorConfig} comparator
|
| - * @return {!Promise<?>}
|
| - */
|
| - sortAndRewind: function(comparator)
|
| - {
|
| - return this._callMethodPromise("sortAndRewind", comparator);
|
| - },
|
| -
|
| - __proto__: WebInspector.HeapSnapshotProxyObject.prototype
|
| +WebInspector.HeapSnapshotProviderProxy = class extends WebInspector.HeapSnapshotProxyObject {
|
| + /**
|
| + * @param {!WebInspector.HeapSnapshotWorkerProxy} worker
|
| + * @param {number} objectId
|
| + */
|
| + constructor(worker, objectId) {
|
| + super(worker, objectId);
|
| + }
|
| +
|
| + /**
|
| + * @override
|
| + * @param {number} snapshotObjectId
|
| + * @return {!Promise<number>}
|
| + */
|
| + nodePosition(snapshotObjectId) {
|
| + return this._callMethodPromise('nodePosition', snapshotObjectId);
|
| + }
|
| +
|
| + /**
|
| + * @override
|
| + * @param {function(boolean)} callback
|
| + */
|
| + isEmpty(callback) {
|
| + this.callMethod(callback, 'isEmpty');
|
| + }
|
| +
|
| + /**
|
| + * @override
|
| + * @param {number} startPosition
|
| + * @param {number} endPosition
|
| + * @param {function(!WebInspector.HeapSnapshotCommon.ItemsRange)} callback
|
| + */
|
| + serializeItemsRange(startPosition, endPosition, callback) {
|
| + this.callMethod(callback, 'serializeItemsRange', startPosition, endPosition);
|
| + }
|
| +
|
| + /**
|
| + * @override
|
| + * @param {!WebInspector.HeapSnapshotCommon.ComparatorConfig} comparator
|
| + * @return {!Promise<?>}
|
| + */
|
| + sortAndRewind(comparator) {
|
| + return this._callMethodPromise('sortAndRewind', comparator);
|
| + }
|
| };
|
|
|