| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 /** | 4 /** |
| 5 * @implements {UI.Searchable} | 5 * @implements {UI.Searchable} |
| 6 * @unrestricted | 6 * @unrestricted |
| 7 */ | 7 */ |
| 8 Profiler.HeapProfileView = class extends Profiler.ProfileView { | 8 Profiler.HeapProfileView = class extends Profiler.ProfileView { |
| 9 /** | 9 /** |
| 10 * @param {!Profiler.SamplingHeapProfileHeader} profileHeader | 10 * @param {!Profiler.SamplingHeapProfileHeader} profileHeader |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 get treeItemTitle() { | 90 get treeItemTitle() { |
| 91 return Common.UIString('ALLOCATION PROFILES'); | 91 return Common.UIString('ALLOCATION PROFILES'); |
| 92 } | 92 } |
| 93 | 93 |
| 94 get description() { | 94 get description() { |
| 95 return Common.UIString('Allocation profiles show memory allocations from you
r JavaScript functions.'); | 95 return Common.UIString('Allocation profiles show memory allocations from you
r JavaScript functions.'); |
| 96 } | 96 } |
| 97 | 97 |
| 98 startRecordingProfile() { | 98 startRecordingProfile() { |
| 99 var target = UI.context.flavor(SDK.Target); | 99 var target = UI.context.flavor(SDK.Target); |
| 100 if (this._profileBeingRecorded || !target) | 100 if (this.profileBeingRecorded() || !target) |
| 101 return; | 101 return; |
| 102 var profile = new Profiler.SamplingHeapProfileHeader(target, this); | 102 var profile = new Profiler.SamplingHeapProfileHeader(target, this); |
| 103 this.setProfileBeingRecorded(profile); | 103 this.setProfileBeingRecorded(profile); |
| 104 SDK.targetManager.suspendAllTargets(); | 104 SDK.targetManager.suspendAllTargets(); |
| 105 this.addProfile(profile); | 105 this.addProfile(profile); |
| 106 profile.updateStatus(Common.UIString('Recording\u2026')); | 106 profile.updateStatus(Common.UIString('Recording\u2026')); |
| 107 this._recording = true; | 107 this._recording = true; |
| 108 target.heapProfilerModel.startSampling(); | 108 target.heapProfilerModel.startSampling(); |
| 109 } | 109 } |
| 110 | 110 |
| 111 stopRecordingProfile() { | 111 stopRecordingProfile() { |
| 112 this._recording = false; | 112 this._recording = false; |
| 113 if (!this._profileBeingRecorded || !this._profileBeingRecorded.target()) | 113 if (!this.profileBeingRecorded() || !this.profileBeingRecorded().target()) |
| 114 return; | 114 return; |
| 115 | 115 |
| 116 var recordedProfile; | 116 var recordedProfile; |
| 117 | 117 |
| 118 /** | 118 /** |
| 119 * @param {?Protocol.HeapProfiler.SamplingHeapProfile} profile | 119 * @param {?Protocol.HeapProfiler.SamplingHeapProfile} profile |
| 120 * @this {Profiler.SamplingHeapProfileType} | 120 * @this {Profiler.SamplingHeapProfileType} |
| 121 */ | 121 */ |
| 122 function didStopProfiling(profile) { | 122 function didStopProfiling(profile) { |
| 123 if (!this._profileBeingRecorded) | 123 if (!this.profileBeingRecorded()) |
| 124 return; | 124 return; |
| 125 console.assert(profile); | 125 console.assert(profile); |
| 126 this._profileBeingRecorded.setProtocolProfile(profile); | 126 this.profileBeingRecorded().setProtocolProfile(profile); |
| 127 this._profileBeingRecorded.updateStatus(''); | 127 this.profileBeingRecorded().updateStatus(''); |
| 128 recordedProfile = this._profileBeingRecorded; | 128 recordedProfile = this.profileBeingRecorded(); |
| 129 this.setProfileBeingRecorded(null); | 129 this.setProfileBeingRecorded(null); |
| 130 } | 130 } |
| 131 | 131 |
| 132 /** | 132 /** |
| 133 * @this {Profiler.SamplingHeapProfileType} | 133 * @this {Profiler.SamplingHeapProfileType} |
| 134 */ | 134 */ |
| 135 function fireEvent() { | 135 function fireEvent() { |
| 136 this.dispatchEventToListeners(Profiler.ProfileType.Events.ProfileComplete,
recordedProfile); | 136 this.dispatchEventToListeners(Profiler.ProfileType.Events.ProfileComplete,
recordedProfile); |
| 137 } | 137 } |
| 138 | 138 |
| 139 this._profileBeingRecorded.target() | 139 this.profileBeingRecorded().target() |
| 140 .heapProfilerModel.stopSampling() | 140 .heapProfilerModel.stopSampling() |
| 141 .then(didStopProfiling.bind(this)) | 141 .then(didStopProfiling.bind(this)) |
| 142 .then(SDK.targetManager.resumeAllTargets.bind(SDK.targetManager)) | 142 .then(SDK.targetManager.resumeAllTargets.bind(SDK.targetManager)) |
| 143 .then(fireEvent.bind(this)); | 143 .then(fireEvent.bind(this)); |
| 144 } | 144 } |
| 145 | 145 |
| 146 /** | 146 /** |
| 147 * @override | 147 * @override |
| 148 * @param {string} title | 148 * @param {string} title |
| 149 * @return {!Profiler.ProfileHeader} | 149 * @return {!Profiler.ProfileHeader} |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 287 | 287 |
| 288 /** | 288 /** |
| 289 * @unrestricted | 289 * @unrestricted |
| 290 */ | 290 */ |
| 291 Profiler.HeapFlameChartDataProvider = class extends Profiler.ProfileFlameChartDa
taProvider { | 291 Profiler.HeapFlameChartDataProvider = class extends Profiler.ProfileFlameChartDa
taProvider { |
| 292 /** | 292 /** |
| 293 * @param {!SDK.ProfileTreeModel} profile | 293 * @param {!SDK.ProfileTreeModel} profile |
| 294 * @param {?SDK.Target} target | 294 * @param {?SDK.Target} target |
| 295 */ | 295 */ |
| 296 constructor(profile, target) { | 296 constructor(profile, target) { |
| 297 super(target); | 297 super(); |
| 298 this._profile = profile; | 298 this._profile = profile; |
| 299 this._target = target; |
| 299 } | 300 } |
| 300 | 301 |
| 301 /** | 302 /** |
| 302 * @override | 303 * @override |
| 303 * @return {number} | 304 * @return {number} |
| 304 */ | 305 */ |
| 305 minimumBoundary() { | 306 minimumBoundary() { |
| 306 return 0; | 307 return 0; |
| 307 } | 308 } |
| 308 | 309 |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 pushEntryInfoRow(Common.UIString('Self size'), Number.bytesToString(node.sel
f)); | 394 pushEntryInfoRow(Common.UIString('Self size'), Number.bytesToString(node.sel
f)); |
| 394 pushEntryInfoRow(Common.UIString('Total size'), Number.bytesToString(node.to
tal)); | 395 pushEntryInfoRow(Common.UIString('Total size'), Number.bytesToString(node.to
tal)); |
| 395 var linkifier = new Components.Linkifier(); | 396 var linkifier = new Components.Linkifier(); |
| 396 var link = linkifier.maybeLinkifyConsoleCallFrame(this._target, node.callFra
me); | 397 var link = linkifier.maybeLinkifyConsoleCallFrame(this._target, node.callFra
me); |
| 397 if (link) | 398 if (link) |
| 398 pushEntryInfoRow(Common.UIString('URL'), link.textContent); | 399 pushEntryInfoRow(Common.UIString('URL'), link.textContent); |
| 399 linkifier.dispose(); | 400 linkifier.dispose(); |
| 400 return Profiler.ProfileView.buildPopoverTable(entryInfo); | 401 return Profiler.ProfileView.buildPopoverTable(entryInfo); |
| 401 } | 402 } |
| 402 }; | 403 }; |
| OLD | NEW |