| 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 copyright | 8 * * Redistributions of source code must retain the above copyright |
| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 .then(_ => { | 205 .then(_ => { |
| 206 var list = this._profiles(); | 206 var list = this._profiles(); |
| 207 var profileIndex = list.indexOf(this._profile); | 207 var profileIndex = list.indexOf(this._profile); |
| 208 this._baseSelect.setSelectedIndex(Math.max(0, profileIndex - 1)); | 208 this._baseSelect.setSelectedIndex(Math.max(0, profileIndex - 1)); |
| 209 if (this._trackingOverviewGrid) | 209 if (this._trackingOverviewGrid) |
| 210 this._trackingOverviewGrid._updateGrid(); | 210 this._trackingOverviewGrid._updateGrid(); |
| 211 }); | 211 }); |
| 212 } | 212 } |
| 213 | 213 |
| 214 /** | 214 /** |
| 215 * @param {!Profiler.HeapSnapshotCommon.Statistics} statistics | 215 * @param {!HeapSnapshotModel.Statistics} statistics |
| 216 */ | 216 */ |
| 217 _gotStatistics(statistics) { | 217 _gotStatistics(statistics) { |
| 218 this._statisticsView.setTotal(statistics.total); | 218 this._statisticsView.setTotal(statistics.total); |
| 219 this._statisticsView.addRecord(statistics.code, Common.UIString('Code'), '#f
77'); | 219 this._statisticsView.addRecord(statistics.code, Common.UIString('Code'), '#f
77'); |
| 220 this._statisticsView.addRecord(statistics.strings, Common.UIString('Strings'
), '#5e5'); | 220 this._statisticsView.addRecord(statistics.strings, Common.UIString('Strings'
), '#5e5'); |
| 221 this._statisticsView.addRecord(statistics.jsArrays, Common.UIString('JS Arra
ys'), '#7af'); | 221 this._statisticsView.addRecord(statistics.jsArrays, Common.UIString('JS Arra
ys'), '#7af'); |
| 222 this._statisticsView.addRecord(statistics.native, Common.UIString('Typed Arr
ays'), '#fc5'); | 222 this._statisticsView.addRecord(statistics.native, Common.UIString('Typed Arr
ays'), '#fc5'); |
| 223 this._statisticsView.addRecord(statistics.system, Common.UIString('System Ob
jects'), '#98f'); | 223 this._statisticsView.addRecord(statistics.system, Common.UIString('System Ob
jects'), '#98f'); |
| 224 this._statisticsView.addRecord(statistics.total, Common.UIString('Total')); | 224 this._statisticsView.addRecord(statistics.total, Common.UIString('Total')); |
| 225 } | 225 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 296 node.select(); | 296 node.select(); |
| 297 } | 297 } |
| 298 | 298 |
| 299 /** | 299 /** |
| 300 * @override | 300 * @override |
| 301 * @param {!UI.SearchableView.SearchConfig} searchConfig | 301 * @param {!UI.SearchableView.SearchConfig} searchConfig |
| 302 * @param {boolean} shouldJump | 302 * @param {boolean} shouldJump |
| 303 * @param {boolean=} jumpBackwards | 303 * @param {boolean=} jumpBackwards |
| 304 */ | 304 */ |
| 305 performSearch(searchConfig, shouldJump, jumpBackwards) { | 305 performSearch(searchConfig, shouldJump, jumpBackwards) { |
| 306 var nextQuery = new Profiler.HeapSnapshotCommon.SearchConfig( | 306 var nextQuery = new HeapSnapshotModel.SearchConfig( |
| 307 searchConfig.query.trim(), searchConfig.caseSensitive, searchConfig.isRe
gex, shouldJump, | 307 searchConfig.query.trim(), searchConfig.caseSensitive, searchConfig.isRe
gex, shouldJump, |
| 308 jumpBackwards || false); | 308 jumpBackwards || false); |
| 309 | 309 |
| 310 this._searchThrottler.schedule(this._performSearch.bind(this, nextQuery)); | 310 this._searchThrottler.schedule(this._performSearch.bind(this, nextQuery)); |
| 311 } | 311 } |
| 312 | 312 |
| 313 /** | 313 /** |
| 314 * @param {!Profiler.HeapSnapshotCommon.SearchConfig} nextQuery | 314 * @param {!HeapSnapshotModel.SearchConfig} nextQuery |
| 315 * @return {!Promise<?>} | 315 * @return {!Promise<?>} |
| 316 */ | 316 */ |
| 317 _performSearch(nextQuery) { | 317 _performSearch(nextQuery) { |
| 318 // Call searchCanceled since it will reset everything we need before doing a
new search. | 318 // Call searchCanceled since it will reset everything we need before doing a
new search. |
| 319 this.searchCanceled(); | 319 this.searchCanceled(); |
| 320 | 320 |
| 321 if (!this._currentPerspective.supportsSearch()) | 321 if (!this._currentPerspective.supportsSearch()) |
| 322 return Promise.resolve(); | 322 return Promise.resolve(); |
| 323 | 323 |
| 324 this.currentQuery = nextQuery; | 324 this.currentQuery = nextQuery; |
| (...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1409 this._workerProxy = new Profiler.HeapSnapshotWorkerProxy(this._handleWorkerE
vent.bind(this)); | 1409 this._workerProxy = new Profiler.HeapSnapshotWorkerProxy(this._handleWorkerE
vent.bind(this)); |
| 1410 this._workerProxy.addEventListener(Profiler.HeapSnapshotWorkerProxy.Events.W
ait, setProfileWait, this); | 1410 this._workerProxy.addEventListener(Profiler.HeapSnapshotWorkerProxy.Events.W
ait, setProfileWait, this); |
| 1411 this._receiver = this._workerProxy.createLoader(this.uid, this._snapshotRece
ived.bind(this)); | 1411 this._receiver = this._workerProxy.createLoader(this.uid, this._snapshotRece
ived.bind(this)); |
| 1412 } | 1412 } |
| 1413 | 1413 |
| 1414 /** | 1414 /** |
| 1415 * @param {string} eventName | 1415 * @param {string} eventName |
| 1416 * @param {*} data | 1416 * @param {*} data |
| 1417 */ | 1417 */ |
| 1418 _handleWorkerEvent(eventName, data) { | 1418 _handleWorkerEvent(eventName, data) { |
| 1419 if (Profiler.HeapSnapshotProgressEvent.BrokenSnapshot === eventName) { | 1419 if (HeapSnapshotModel.HeapSnapshotProgressEvent.BrokenSnapshot === eventName
) { |
| 1420 var error = /** @type {string} */ (data); | 1420 var error = /** @type {string} */ (data); |
| 1421 Common.console.error(error); | 1421 Common.console.error(error); |
| 1422 return; | 1422 return; |
| 1423 } | 1423 } |
| 1424 | 1424 |
| 1425 if (Profiler.HeapSnapshotProgressEvent.Update !== eventName) | 1425 if (HeapSnapshotModel.HeapSnapshotProgressEvent.Update !== eventName) |
| 1426 return; | 1426 return; |
| 1427 var subtitle = /** @type {string} */ (data); | 1427 var subtitle = /** @type {string} */ (data); |
| 1428 this.updateStatus(subtitle); | 1428 this.updateStatus(subtitle); |
| 1429 } | 1429 } |
| 1430 | 1430 |
| 1431 /** | 1431 /** |
| 1432 * @override | 1432 * @override |
| 1433 */ | 1433 */ |
| 1434 dispose() { | 1434 dispose() { |
| 1435 if (this._workerProxy) | 1435 if (this._workerProxy) |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1679 this._profileType.removeEventListener( | 1679 this._profileType.removeEventListener( |
| 1680 Profiler.TrackingHeapSnapshotProfileType.TrackingStopped, this._onStopTr
acking, this); | 1680 Profiler.TrackingHeapSnapshotProfileType.TrackingStopped, this._onStopTr
acking, this); |
| 1681 } | 1681 } |
| 1682 | 1682 |
| 1683 _onHeapStatsUpdate(event) { | 1683 _onHeapStatsUpdate(event) { |
| 1684 this._profileSamples = event.data; | 1684 this._profileSamples = event.data; |
| 1685 this._scheduleUpdate(); | 1685 this._scheduleUpdate(); |
| 1686 } | 1686 } |
| 1687 | 1687 |
| 1688 /** | 1688 /** |
| 1689 * @param {?Profiler.HeapSnapshotCommon.Samples} samples | 1689 * @param {?HeapSnapshotModel.Samples} samples |
| 1690 */ | 1690 */ |
| 1691 _setSamples(samples) { | 1691 _setSamples(samples) { |
| 1692 if (!samples) | 1692 if (!samples) |
| 1693 return; | 1693 return; |
| 1694 console.assert(!this._profileSamples.timestamps.length, 'Should only call th
is method when loading from file.'); | 1694 console.assert(!this._profileSamples.timestamps.length, 'Should only call th
is method when loading from file.'); |
| 1695 console.assert(samples.timestamps.length); | 1695 console.assert(samples.timestamps.length); |
| 1696 this._profileSamples = new Profiler.TrackingHeapSnapshotProfileType.Samples(
); | 1696 this._profileSamples = new Profiler.TrackingHeapSnapshotProfileType.Samples(
); |
| 1697 this._profileSamples.sizes = samples.sizes; | 1697 this._profileSamples.sizes = samples.sizes; |
| 1698 this._profileSamples.ids = samples.lastAssignedIds; | 1698 this._profileSamples.ids = samples.lastAssignedIds; |
| 1699 this._profileSamples.timestamps = samples.timestamps; | 1699 this._profileSamples.timestamps = samples.timestamps; |
| (...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2074 this.clear(); | 2074 this.clear(); |
| 2075 snapshot.allocationStack(snapshotNodeIndex, this._didReceiveAllocationStack.
bind(this)); | 2075 snapshot.allocationStack(snapshotNodeIndex, this._didReceiveAllocationStack.
bind(this)); |
| 2076 } | 2076 } |
| 2077 | 2077 |
| 2078 clear() { | 2078 clear() { |
| 2079 this.element.removeChildren(); | 2079 this.element.removeChildren(); |
| 2080 this._linkifier.reset(); | 2080 this._linkifier.reset(); |
| 2081 } | 2081 } |
| 2082 | 2082 |
| 2083 /** | 2083 /** |
| 2084 * @param {?Array.<!Profiler.HeapSnapshotCommon.AllocationStackFrame>} frames | 2084 * @param {?Array.<!HeapSnapshotModel.AllocationStackFrame>} frames |
| 2085 */ | 2085 */ |
| 2086 _didReceiveAllocationStack(frames) { | 2086 _didReceiveAllocationStack(frames) { |
| 2087 if (!frames) { | 2087 if (!frames) { |
| 2088 var stackDiv = this.element.createChild('div', 'no-heap-allocation-stack')
; | 2088 var stackDiv = this.element.createChild('div', 'no-heap-allocation-stack')
; |
| 2089 stackDiv.createTextChild(Common.UIString( | 2089 stackDiv.createTextChild(Common.UIString( |
| 2090 'Stack was not recorded for this object because it had been allocated
before this profile recording started.')); | 2090 'Stack was not recorded for this object because it had been allocated
before this profile recording started.')); |
| 2091 return; | 2091 return; |
| 2092 } | 2092 } |
| 2093 | 2093 |
| 2094 var stackDiv = this.element.createChild('div', 'heap-allocation-stack'); | 2094 var stackDiv = this.element.createChild('div', 'heap-allocation-stack'); |
| 2095 for (var i = 0; i < frames.length; i++) { | 2095 for (var i = 0; i < frames.length; i++) { |
| 2096 var frame = frames[i]; | 2096 var frame = frames[i]; |
| 2097 var frameDiv = stackDiv.createChild('div', 'stack-frame'); | 2097 var frameDiv = stackDiv.createChild('div', 'stack-frame'); |
| 2098 var name = frameDiv.createChild('div'); | 2098 var name = frameDiv.createChild('div'); |
| 2099 name.textContent = UI.beautifyFunctionName(frame.functionName); | 2099 name.textContent = UI.beautifyFunctionName(frame.functionName); |
| 2100 if (frame.scriptId) { | 2100 if (frame.scriptId) { |
| 2101 var urlElement = this._linkifier.linkifyScriptLocation( | 2101 var urlElement = this._linkifier.linkifyScriptLocation( |
| 2102 this._target, String(frame.scriptId), frame.scriptName, frame.line -
1, frame.column - 1); | 2102 this._target, String(frame.scriptId), frame.scriptName, frame.line -
1, frame.column - 1); |
| 2103 frameDiv.appendChild(urlElement); | 2103 frameDiv.appendChild(urlElement); |
| 2104 } | 2104 } |
| 2105 } | 2105 } |
| 2106 } | 2106 } |
| 2107 }; | 2107 }; |
| OLD | NEW |