| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2011 Google Inc. All rights reserved. | 2 * Copyright (C) 2011 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyrightdd | 8 * * Redistributions of source code must retain the above copyrightdd |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 26 matching lines...) Expand all Loading... |
| 37 { | 37 { |
| 38 this._eventHandler = eventHandler; | 38 this._eventHandler = eventHandler; |
| 39 this._nextObjectId = 1; | 39 this._nextObjectId = 1; |
| 40 this._nextCallId = 1; | 40 this._nextCallId = 1; |
| 41 /** @type {!Map<number, function(*)>} */ | 41 /** @type {!Map<number, function(*)>} */ |
| 42 this._callbacks = new Map(); | 42 this._callbacks = new Map(); |
| 43 /** @type {!Set<number>} */ | 43 /** @type {!Set<number>} */ |
| 44 this._previousCallbacks = new Set(); | 44 this._previousCallbacks = new Set(); |
| 45 this._worker = new WebInspector.Worker("heap_snapshot_worker"); | 45 this._worker = new WebInspector.Worker("heap_snapshot_worker"); |
| 46 this._worker.onmessage = this._messageReceived.bind(this); | 46 this._worker.onmessage = this._messageReceived.bind(this); |
| 47 } | 47 }; |
| 48 | 48 |
| 49 WebInspector.HeapSnapshotWorkerProxy.prototype = { | 49 WebInspector.HeapSnapshotWorkerProxy.prototype = { |
| 50 /** | 50 /** |
| 51 * @param {number} profileUid | 51 * @param {number} profileUid |
| 52 * @param {function(!WebInspector.HeapSnapshotProxy)} snapshotReceivedCallba
ck | 52 * @param {function(!WebInspector.HeapSnapshotProxy)} snapshotReceivedCallba
ck |
| 53 * @return {!WebInspector.HeapSnapshotLoaderProxy} | 53 * @return {!WebInspector.HeapSnapshotLoaderProxy} |
| 54 */ | 54 */ |
| 55 createLoader: function(profileUid, snapshotReceivedCallback) | 55 createLoader: function(profileUid, snapshotReceivedCallback) |
| 56 { | 56 { |
| 57 var objectId = this._nextObjectId++; | 57 var objectId = this._nextObjectId++; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 this._callbacks.delete(data.callId); | 168 this._callbacks.delete(data.callId); |
| 169 callback(data.result); | 169 callback(data.result); |
| 170 }, | 170 }, |
| 171 | 171 |
| 172 _postMessage: function(message) | 172 _postMessage: function(message) |
| 173 { | 173 { |
| 174 this._worker.postMessage(message); | 174 this._worker.postMessage(message); |
| 175 }, | 175 }, |
| 176 | 176 |
| 177 __proto__: WebInspector.Object.prototype | 177 __proto__: WebInspector.Object.prototype |
| 178 } | 178 }; |
| 179 | 179 |
| 180 | 180 |
| 181 /** | 181 /** |
| 182 * @constructor | 182 * @constructor |
| 183 * @param {!WebInspector.HeapSnapshotWorkerProxy} worker | 183 * @param {!WebInspector.HeapSnapshotWorkerProxy} worker |
| 184 * @param {number} objectId | 184 * @param {number} objectId |
| 185 */ | 185 */ |
| 186 WebInspector.HeapSnapshotProxyObject = function(worker, objectId) | 186 WebInspector.HeapSnapshotProxyObject = function(worker, objectId) |
| 187 { | 187 { |
| 188 this._worker = worker; | 188 this._worker = worker; |
| 189 this._objectId = objectId; | 189 this._objectId = objectId; |
| 190 } | 190 }; |
| 191 | 191 |
| 192 WebInspector.HeapSnapshotProxyObject.prototype = { | 192 WebInspector.HeapSnapshotProxyObject.prototype = { |
| 193 /** | 193 /** |
| 194 * @param {string} workerMethodName | 194 * @param {string} workerMethodName |
| 195 * @param {!Array.<*>} args | 195 * @param {!Array.<*>} args |
| 196 */ | 196 */ |
| 197 _callWorker: function(workerMethodName, args) | 197 _callWorker: function(workerMethodName, args) |
| 198 { | 198 { |
| 199 args.splice(1, 0, this._objectId); | 199 args.splice(1, 0, this._objectId); |
| 200 return this._worker[workerMethodName].apply(this._worker, args); | 200 return this._worker[workerMethodName].apply(this._worker, args); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 * @param {!WebInspector.HeapSnapshotWorkerProxy} worker | 264 * @param {!WebInspector.HeapSnapshotWorkerProxy} worker |
| 265 * @param {number} objectId | 265 * @param {number} objectId |
| 266 * @param {number} profileUid | 266 * @param {number} profileUid |
| 267 * @param {function(!WebInspector.HeapSnapshotProxy)} snapshotReceivedCallback | 267 * @param {function(!WebInspector.HeapSnapshotProxy)} snapshotReceivedCallback |
| 268 */ | 268 */ |
| 269 WebInspector.HeapSnapshotLoaderProxy = function(worker, objectId, profileUid, sn
apshotReceivedCallback) | 269 WebInspector.HeapSnapshotLoaderProxy = function(worker, objectId, profileUid, sn
apshotReceivedCallback) |
| 270 { | 270 { |
| 271 WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId); | 271 WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId); |
| 272 this._profileUid = profileUid; | 272 this._profileUid = profileUid; |
| 273 this._snapshotReceivedCallback = snapshotReceivedCallback; | 273 this._snapshotReceivedCallback = snapshotReceivedCallback; |
| 274 } | 274 }; |
| 275 | 275 |
| 276 WebInspector.HeapSnapshotLoaderProxy.prototype = { | 276 WebInspector.HeapSnapshotLoaderProxy.prototype = { |
| 277 /** | 277 /** |
| 278 * @override | 278 * @override |
| 279 * @param {string} chunk | 279 * @param {string} chunk |
| 280 * @param {function(!WebInspector.OutputStream)=} callback | 280 * @param {function(!WebInspector.OutputStream)=} callback |
| 281 */ | 281 */ |
| 282 write: function(chunk, callback) | 282 write: function(chunk, callback) |
| 283 { | 283 { |
| 284 this.callMethod(callback, "write", chunk); | 284 this.callMethod(callback, "write", chunk); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 308 { | 308 { |
| 309 this.dispose(); | 309 this.dispose(); |
| 310 snapshotProxy.setProfileUid(this._profileUid); | 310 snapshotProxy.setProfileUid(this._profileUid); |
| 311 snapshotProxy.updateStaticData(this._snapshotReceivedCallback.bind(t
his)); | 311 snapshotProxy.updateStaticData(this._snapshotReceivedCallback.bind(t
his)); |
| 312 } | 312 } |
| 313 | 313 |
| 314 this.callMethod(buildSnapshot.bind(this), "close"); | 314 this.callMethod(buildSnapshot.bind(this), "close"); |
| 315 }, | 315 }, |
| 316 | 316 |
| 317 __proto__: WebInspector.HeapSnapshotProxyObject.prototype | 317 __proto__: WebInspector.HeapSnapshotProxyObject.prototype |
| 318 } | 318 }; |
| 319 | 319 |
| 320 | 320 |
| 321 /** | 321 /** |
| 322 * @constructor | 322 * @constructor |
| 323 * @extends {WebInspector.HeapSnapshotProxyObject} | 323 * @extends {WebInspector.HeapSnapshotProxyObject} |
| 324 * @param {!WebInspector.HeapSnapshotWorkerProxy} worker | 324 * @param {!WebInspector.HeapSnapshotWorkerProxy} worker |
| 325 * @param {number} objectId | 325 * @param {number} objectId |
| 326 */ | 326 */ |
| 327 WebInspector.HeapSnapshotProxy = function(worker, objectId) | 327 WebInspector.HeapSnapshotProxy = function(worker, objectId) |
| 328 { | 328 { |
| 329 WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId); | 329 WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId); |
| 330 /** @type {?WebInspector.HeapSnapshotCommon.StaticData} */ | 330 /** @type {?WebInspector.HeapSnapshotCommon.StaticData} */ |
| 331 this._staticData = null; | 331 this._staticData = null; |
| 332 } | 332 }; |
| 333 | 333 |
| 334 WebInspector.HeapSnapshotProxy.prototype = { | 334 WebInspector.HeapSnapshotProxy.prototype = { |
| 335 /** | 335 /** |
| 336 * @param {!WebInspector.HeapSnapshotCommon.SearchConfig} searchConfig | 336 * @param {!WebInspector.HeapSnapshotCommon.SearchConfig} searchConfig |
| 337 * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} filter | 337 * @param {!WebInspector.HeapSnapshotCommon.NodeFilter} filter |
| 338 * @return {!Promise<!Array<number>>} | 338 * @return {!Promise<!Array<number>>} |
| 339 */ | 339 */ |
| 340 search: function(searchConfig, filter) | 340 search: function(searchConfig, filter) |
| 341 { | 341 { |
| 342 return this._callMethodPromise("search", searchConfig, filter); | 342 return this._callMethodPromise("search", searchConfig, filter); |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 | 511 |
| 512 /** | 512 /** |
| 513 * @return {number} | 513 * @return {number} |
| 514 */ | 514 */ |
| 515 maxJSObjectId: function() | 515 maxJSObjectId: function() |
| 516 { | 516 { |
| 517 return this._staticData.maxJSObjectId; | 517 return this._staticData.maxJSObjectId; |
| 518 }, | 518 }, |
| 519 | 519 |
| 520 __proto__: WebInspector.HeapSnapshotProxyObject.prototype | 520 __proto__: WebInspector.HeapSnapshotProxyObject.prototype |
| 521 } | 521 }; |
| 522 | 522 |
| 523 | 523 |
| 524 /** | 524 /** |
| 525 * @constructor | 525 * @constructor |
| 526 * @extends {WebInspector.HeapSnapshotProxyObject} | 526 * @extends {WebInspector.HeapSnapshotProxyObject} |
| 527 * @implements {WebInspector.HeapSnapshotGridNode.ChildrenProvider} | 527 * @implements {WebInspector.HeapSnapshotGridNode.ChildrenProvider} |
| 528 * @param {!WebInspector.HeapSnapshotWorkerProxy} worker | 528 * @param {!WebInspector.HeapSnapshotWorkerProxy} worker |
| 529 * @param {number} objectId | 529 * @param {number} objectId |
| 530 */ | 530 */ |
| 531 WebInspector.HeapSnapshotProviderProxy = function(worker, objectId) | 531 WebInspector.HeapSnapshotProviderProxy = function(worker, objectId) |
| 532 { | 532 { |
| 533 WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId); | 533 WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId); |
| 534 } | 534 }; |
| 535 | 535 |
| 536 WebInspector.HeapSnapshotProviderProxy.prototype = { | 536 WebInspector.HeapSnapshotProviderProxy.prototype = { |
| 537 /** | 537 /** |
| 538 * @override | 538 * @override |
| 539 * @param {number} snapshotObjectId | 539 * @param {number} snapshotObjectId |
| 540 * @return {!Promise<number>} | 540 * @return {!Promise<number>} |
| 541 */ | 541 */ |
| 542 nodePosition: function(snapshotObjectId) | 542 nodePosition: function(snapshotObjectId) |
| 543 { | 543 { |
| 544 return this._callMethodPromise("nodePosition", snapshotObjectId); | 544 return this._callMethodPromise("nodePosition", snapshotObjectId); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 568 * @override | 568 * @override |
| 569 * @param {!WebInspector.HeapSnapshotCommon.ComparatorConfig} comparator | 569 * @param {!WebInspector.HeapSnapshotCommon.ComparatorConfig} comparator |
| 570 * @return {!Promise<?>} | 570 * @return {!Promise<?>} |
| 571 */ | 571 */ |
| 572 sortAndRewind: function(comparator) | 572 sortAndRewind: function(comparator) |
| 573 { | 573 { |
| 574 return this._callMethodPromise("sortAndRewind", comparator); | 574 return this._callMethodPromise("sortAndRewind", comparator); |
| 575 }, | 575 }, |
| 576 | 576 |
| 577 __proto__: WebInspector.HeapSnapshotProxyObject.prototype | 577 __proto__: WebInspector.HeapSnapshotProxyObject.prototype |
| 578 } | 578 }; |
| OLD | NEW |