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 19 matching lines...) Expand all Loading... |
30 case 'self': | 30 case 'self': |
31 return Common.UIString('Self Size (bytes)'); | 31 return Common.UIString('Self Size (bytes)'); |
32 case 'total': | 32 case 'total': |
33 return Common.UIString('Total Size (bytes)'); | 33 return Common.UIString('Total Size (bytes)'); |
34 } | 34 } |
35 return ''; | 35 return ''; |
36 } | 36 } |
37 | 37 |
38 /** | 38 /** |
39 * @override | 39 * @override |
40 * @return {!UI.FlameChartDataProvider} | 40 * @return {!PerfUI.FlameChartDataProvider} |
41 */ | 41 */ |
42 createFlameChartDataProvider() { | 42 createFlameChartDataProvider() { |
43 return new Profiler.HeapFlameChartDataProvider(this.profile, this._profileHe
ader.target()); | 43 return new Profiler.HeapFlameChartDataProvider(this.profile, this._profileHe
ader.target()); |
44 } | 44 } |
45 }; | 45 }; |
46 | 46 |
47 /** | 47 /** |
48 * @unrestricted | 48 * @unrestricted |
49 */ | 49 */ |
50 Profiler.SamplingHeapProfileType = class extends Profiler.ProfileType { | 50 Profiler.SamplingHeapProfileType = class extends Profiler.ProfileType { |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() |
| 140 .target() |
140 .heapProfilerModel.stopSampling() | 141 .heapProfilerModel.stopSampling() |
141 .then(didStopProfiling.bind(this)) | 142 .then(didStopProfiling.bind(this)) |
142 .then(SDK.targetManager.resumeAllTargets.bind(SDK.targetManager)) | 143 .then(SDK.targetManager.resumeAllTargets.bind(SDK.targetManager)) |
143 .then(fireEvent.bind(this)); | 144 .then(fireEvent.bind(this)); |
144 } | 145 } |
145 | 146 |
146 /** | 147 /** |
147 * @override | 148 * @override |
148 * @param {string} title | 149 * @param {string} title |
149 * @return {!Profiler.ProfileHeader} | 150 * @return {!Profiler.ProfileHeader} |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
320 * @param {number} value | 321 * @param {number} value |
321 * @param {number=} precision | 322 * @param {number=} precision |
322 * @return {string} | 323 * @return {string} |
323 */ | 324 */ |
324 formatValue(value, precision) { | 325 formatValue(value, precision) { |
325 return Common.UIString('%s\u2009KB', Number.withThousandsSeparator(value / 1
e3)); | 326 return Common.UIString('%s\u2009KB', Number.withThousandsSeparator(value / 1
e3)); |
326 } | 327 } |
327 | 328 |
328 /** | 329 /** |
329 * @override | 330 * @override |
330 * @return {!UI.FlameChart.TimelineData} | 331 * @return {!PerfUI.FlameChart.TimelineData} |
331 */ | 332 */ |
332 _calculateTimelineData() { | 333 _calculateTimelineData() { |
333 /** | 334 /** |
334 * @param {!SDK.ProfileNode} node | 335 * @param {!SDK.ProfileNode} node |
335 * @return {number} | 336 * @return {number} |
336 */ | 337 */ |
337 function nodesCount(node) { | 338 function nodesCount(node) { |
338 return node.children.reduce((count, node) => count + nodesCount(node), 1); | 339 return node.children.reduce((count, node) => count + nodesCount(node), 1); |
339 } | 340 } |
340 var count = nodesCount(this._profile.root); | 341 var count = nodesCount(this._profile.root); |
(...skipping 20 matching lines...) Expand all Loading... |
361 ++depth; | 362 ++depth; |
362 node.children.forEach(addNode); | 363 node.children.forEach(addNode); |
363 --depth; | 364 --depth; |
364 maxDepth = Math.max(maxDepth, depth); | 365 maxDepth = Math.max(maxDepth, depth); |
365 position = start + node.total; | 366 position = start + node.total; |
366 } | 367 } |
367 addNode(this._profile.root); | 368 addNode(this._profile.root); |
368 | 369 |
369 this._maxStackDepth = maxDepth + 1; | 370 this._maxStackDepth = maxDepth + 1; |
370 this._entryNodes = entryNodes; | 371 this._entryNodes = entryNodes; |
371 this._timelineData = new UI.FlameChart.TimelineData(entryLevels, entryTotalT
imes, entryStartTimes, null); | 372 this._timelineData = new PerfUI.FlameChart.TimelineData(entryLevels, entryTo
talTimes, entryStartTimes, null); |
372 | 373 |
373 return this._timelineData; | 374 return this._timelineData; |
374 } | 375 } |
375 | 376 |
376 /** | 377 /** |
377 * @override | 378 * @override |
378 * @param {number} entryIndex | 379 * @param {number} entryIndex |
379 * @return {?Element} | 380 * @return {?Element} |
380 */ | 381 */ |
381 prepareHighlightedEntryInfo(entryIndex) { | 382 prepareHighlightedEntryInfo(entryIndex) { |
(...skipping 12 matching lines...) Expand all Loading... |
394 pushEntryInfoRow(Common.UIString('Self size'), Number.bytesToString(node.sel
f)); | 395 pushEntryInfoRow(Common.UIString('Self size'), Number.bytesToString(node.sel
f)); |
395 pushEntryInfoRow(Common.UIString('Total size'), Number.bytesToString(node.to
tal)); | 396 pushEntryInfoRow(Common.UIString('Total size'), Number.bytesToString(node.to
tal)); |
396 var linkifier = new Components.Linkifier(); | 397 var linkifier = new Components.Linkifier(); |
397 var link = linkifier.maybeLinkifyConsoleCallFrame(this._target, node.callFra
me); | 398 var link = linkifier.maybeLinkifyConsoleCallFrame(this._target, node.callFra
me); |
398 if (link) | 399 if (link) |
399 pushEntryInfoRow(Common.UIString('URL'), link.textContent); | 400 pushEntryInfoRow(Common.UIString('URL'), link.textContent); |
400 linkifier.dispose(); | 401 linkifier.dispose(); |
401 return Profiler.ProfileView.buildPopoverTable(entryInfo); | 402 return Profiler.ProfileView.buildPopoverTable(entryInfo); |
402 } | 403 } |
403 }; | 404 }; |
OLD | NEW |