| OLD | NEW |
| 1 /** | 1 /** |
| 2 * @unrestricted | 2 * @unrestricted |
| 3 */ | 3 */ |
| 4 SDK.HeapProfilerModel = class extends SDK.SDKModel { | 4 SDK.HeapProfilerModel = class extends SDK.SDKModel { |
| 5 /** | 5 /** |
| 6 * @param {!SDK.Target} target | 6 * @param {!SDK.Target} target |
| 7 */ | 7 */ |
| 8 constructor(target) { | 8 constructor(target) { |
| 9 super(target); | 9 super(target); |
| 10 target.registerHeapProfilerDispatcher(new SDK.HeapProfilerDispatcher(this)); | 10 target.registerHeapProfilerDispatcher(new SDK.HeapProfilerDispatcher(this)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 this._enabled = true; | 34 this._enabled = true; |
| 35 this._heapProfilerAgent.enable(); | 35 this._heapProfilerAgent.enable(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 startSampling() { | 38 startSampling() { |
| 39 var defaultSamplingIntervalInBytes = 16384; | 39 var defaultSamplingIntervalInBytes = 16384; |
| 40 this._heapProfilerAgent.startSampling(defaultSamplingIntervalInBytes); | 40 this._heapProfilerAgent.startSampling(defaultSamplingIntervalInBytes); |
| 41 } | 41 } |
| 42 | 42 |
| 43 /** | 43 /** |
| 44 * @return {!Promise.<?Protocol.HeapProfiler.SamplingHeapProfile>} | 44 * @return {!Promise<?Protocol.HeapProfiler.SamplingHeapProfile>} |
| 45 */ | 45 */ |
| 46 stopSampling() { | 46 stopSampling() { |
| 47 this._isRecording = false; | 47 this._isRecording = false; |
| 48 return this._heapProfilerAgent.stopSampling((error, profile) => error ? null
: profile); | 48 return this._heapProfilerAgent.stopSampling(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 /** | 51 /** |
| 52 * @return {!Promise} | 52 * @return {!Promise} |
| 53 */ | 53 */ |
| 54 collectGarbage() { | 54 collectGarbage() { |
| 55 return this._heapProfilerAgent.collectGarbage(); | 55 return this._heapProfilerAgent.collectGarbage(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 /** | 58 /** |
| 59 * @param {string} objectId | 59 * @param {string} objectId |
| 60 * @return {!Promise<?string>} | 60 * @return {!Promise<?string>} |
| 61 */ | 61 */ |
| 62 snapshotObjectIdForObjectId(objectId) { | 62 snapshotObjectIdForObjectId(objectId) { |
| 63 return this._heapProfilerAgent.getHeapObjectId(objectId, (error, result) =>
error ? null : result); | 63 return this._heapProfilerAgent.getHeapObjectId(objectId); |
| 64 } | 64 } |
| 65 | 65 |
| 66 /** | 66 /** |
| 67 * @param {string} snapshotObjectId | 67 * @param {string} snapshotObjectId |
| 68 * @param {string} objectGroupName | 68 * @param {string} objectGroupName |
| 69 * @return {!Promise<?SDK.RemoteObject>} | 69 * @return {!Promise<?SDK.RemoteObject>} |
| 70 */ | 70 */ |
| 71 objectForSnapshotObjectId(snapshotObjectId, objectGroupName) { | 71 objectForSnapshotObjectId(snapshotObjectId, objectGroupName) { |
| 72 return this._heapProfilerAgent.getObjectByHeapObjectId(snapshotObjectId, obj
ectGroupName, (error, result) => { | 72 return this._heapProfilerAgent.getObjectByHeapObjectId(snapshotObjectId, obj
ectGroupName) |
| 73 if (error || !result.type) | 73 .then(result => result && result.type ? this._runtimeModel.createRemoteO
bject(result) : null); |
| 74 return null; | |
| 75 return this._runtimeModel.createRemoteObject(result); | |
| 76 }); | |
| 77 } | 74 } |
| 78 | 75 |
| 79 /** | 76 /** |
| 80 * @param {string} snapshotObjectId | 77 * @param {string} snapshotObjectId |
| 81 * @return {!Promise} | 78 * @return {!Promise} |
| 82 */ | 79 */ |
| 83 addInspectedHeapObject(snapshotObjectId) { | 80 addInspectedHeapObject(snapshotObjectId) { |
| 84 return this._heapProfilerAgent.addInspectedHeapObject(snapshotObjectId); | 81 return this._heapProfilerAgent.addInspectedHeapObject(snapshotObjectId); |
| 85 } | 82 } |
| 86 | 83 |
| 87 /** | 84 /** |
| 88 * @param {boolean} reportProgress | 85 * @param {boolean} reportProgress |
| 89 * @return {!Promise<boolean>} | 86 * @return {!Promise} |
| 90 */ | 87 */ |
| 91 takeHeapSnapshot(reportProgress) { | 88 takeHeapSnapshot(reportProgress) { |
| 92 return this._heapProfilerAgent.takeHeapSnapshot(reportProgress, error => !er
ror); | 89 return this._heapProfilerAgent.takeHeapSnapshot(reportProgress); |
| 93 } | 90 } |
| 94 | 91 |
| 95 /** | 92 /** |
| 96 * @param {boolean} recordAllocationStacks | 93 * @param {boolean} recordAllocationStacks |
| 97 * @return {!Promise} | 94 * @return {!Promise} |
| 98 */ | 95 */ |
| 99 startTrackingHeapObjects(recordAllocationStacks) { | 96 startTrackingHeapObjects(recordAllocationStacks) { |
| 100 return this._heapProfilerAgent.startTrackingHeapObjects(recordAllocationStac
ks); | 97 return this._heapProfilerAgent.startTrackingHeapObjects(recordAllocationStac
ks); |
| 101 } | 98 } |
| 102 | 99 |
| 103 /** | 100 /** |
| 104 * @param {boolean} reportProgress | 101 * @param {boolean} reportProgress |
| 105 * @return {!Promise<boolean>} | 102 * @return {!Promise} |
| 106 */ | 103 */ |
| 107 stopTrackingHeapObjects(reportProgress) { | 104 stopTrackingHeapObjects(reportProgress) { |
| 108 return this._heapProfilerAgent.stopTrackingHeapObjects(reportProgress, error
=> !error); | 105 return this._heapProfilerAgent.stopTrackingHeapObjects(reportProgress); |
| 109 } | 106 } |
| 110 | 107 |
| 111 /** | 108 /** |
| 112 * @param {!Array.<number>} samples | 109 * @param {!Array<number>} samples |
| 113 */ | 110 */ |
| 114 heapStatsUpdate(samples) { | 111 heapStatsUpdate(samples) { |
| 115 this.dispatchEventToListeners(SDK.HeapProfilerModel.Events.HeapStatsUpdate,
samples); | 112 this.dispatchEventToListeners(SDK.HeapProfilerModel.Events.HeapStatsUpdate,
samples); |
| 116 } | 113 } |
| 117 | 114 |
| 118 /** | 115 /** |
| 119 * @param {number} lastSeenObjectId | 116 * @param {number} lastSeenObjectId |
| 120 * @param {number} timestamp | 117 * @param {number} timestamp |
| 121 */ | 118 */ |
| 122 lastSeenObjectId(lastSeenObjectId, timestamp) { | 119 lastSeenObjectId(lastSeenObjectId, timestamp) { |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 this._heapProfilerModel.reportHeapSnapshotProgress(done, total, finished); | 198 this._heapProfilerModel.reportHeapSnapshotProgress(done, total, finished); |
| 202 } | 199 } |
| 203 | 200 |
| 204 /** | 201 /** |
| 205 * @override | 202 * @override |
| 206 */ | 203 */ |
| 207 resetProfiles() { | 204 resetProfiles() { |
| 208 this._heapProfilerModel.resetProfiles(); | 205 this._heapProfilerModel.resetProfiles(); |
| 209 } | 206 } |
| 210 }; | 207 }; |
| OLD | NEW |