| 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 640 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 651 | 651 |
| 652 _updateBaseOptions: function() | 652 _updateBaseOptions: function() |
| 653 { | 653 { |
| 654 var list = this._profiles(); | 654 var list = this._profiles(); |
| 655 // We're assuming that snapshots can only be added. | 655 // We're assuming that snapshots can only be added. |
| 656 if (this.baseSelect.size() === list.length) | 656 if (this.baseSelect.size() === list.length) |
| 657 return; | 657 return; |
| 658 | 658 |
| 659 for (var i = this.baseSelect.size(), n = list.length; i < n; ++i) { | 659 for (var i = this.baseSelect.size(), n = list.length; i < n; ++i) { |
| 660 var title = list[i].title; | 660 var title = list[i].title; |
| 661 if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(titl
e)) | |
| 662 title = WebInspector.UIString("Snapshot %d", WebInspector.Profil
esPanelDescriptor.userInitiatedProfileIndex(title)); | |
| 663 this.baseSelect.createOption(title); | 661 this.baseSelect.createOption(title); |
| 664 } | 662 } |
| 665 }, | 663 }, |
| 666 | 664 |
| 667 _updateFilterOptions: function() | 665 _updateFilterOptions: function() |
| 668 { | 666 { |
| 669 var list = this._profiles(); | 667 var list = this._profiles(); |
| 670 // We're assuming that snapshots can only be added. | 668 // We're assuming that snapshots can only be added. |
| 671 if (this.filterSelect.size() - 1 === list.length) | 669 if (this.filterSelect.size() - 1 === list.length) |
| 672 return; | 670 return; |
| 673 | 671 |
| 674 if (!this.filterSelect.size()) | 672 if (!this.filterSelect.size()) |
| 675 this.filterSelect.createOption(WebInspector.UIString("All objects"))
; | 673 this.filterSelect.createOption(WebInspector.UIString("All objects"))
; |
| 676 | 674 |
| 677 if (this.profile.fromFile()) | |
| 678 return; | |
| 679 for (var i = this.filterSelect.size() - 1, n = list.length; i < n; ++i)
{ | 675 for (var i = this.filterSelect.size() - 1, n = list.length; i < n; ++i)
{ |
| 680 var profile = list[i]; | |
| 681 var title = list[i].title; | 676 var title = list[i].title; |
| 682 if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(titl
e)) { | 677 if (!i) |
| 683 var profileIndex = WebInspector.ProfilesPanelDescriptor.userInit
iatedProfileIndex(title); | 678 title = WebInspector.UIString("Objects allocated before %s", tit
le); |
| 684 if (!i) | 679 else |
| 685 title = WebInspector.UIString("Objects allocated before Snap
shot %d", profileIndex); | 680 title = WebInspector.UIString("Objects allocated between %s and
%s", list[i - 1].title, title); |
| 686 else | |
| 687 title = WebInspector.UIString("Objects allocated between Sna
pshots %d and %d", profileIndex - 1, profileIndex); | |
| 688 } | |
| 689 this.filterSelect.createOption(title); | 681 this.filterSelect.createOption(title); |
| 690 } | 682 } |
| 691 }, | 683 }, |
| 692 | 684 |
| 693 /** | 685 /** |
| 694 * @param {WebInspector.Event} event | 686 * @param {WebInspector.Event} event |
| 695 */ | 687 */ |
| 696 _onProfileHeaderAdded: function(event) | 688 _onProfileHeaderAdded: function(event) |
| 697 { | 689 { |
| 698 if (!event.data || event.data.type !== this._profileTypeId) | 690 if (!event.data || event.data.type !== this._profileTypeId) |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1302 _snapshotReceived: function(snapshotProxy) | 1294 _snapshotReceived: function(snapshotProxy) |
| 1303 { | 1295 { |
| 1304 this._receiver = null; | 1296 this._receiver = null; |
| 1305 if (snapshotProxy) | 1297 if (snapshotProxy) |
| 1306 this._snapshotProxy = snapshotProxy; | 1298 this._snapshotProxy = snapshotProxy; |
| 1307 this._didCompleteSnapshotTransfer(); | 1299 this._didCompleteSnapshotTransfer(); |
| 1308 var worker = /** @type {WebInspector.HeapSnapshotWorkerProxy} */ (this._
snapshotProxy.worker); | 1300 var worker = /** @type {WebInspector.HeapSnapshotWorkerProxy} */ (this._
snapshotProxy.worker); |
| 1309 this.isTemporary = false; | 1301 this.isTemporary = false; |
| 1310 worker.startCheckingForLongRunningCalls(); | 1302 worker.startCheckingForLongRunningCalls(); |
| 1311 this.notifySnapshotReceived(); | 1303 this.notifySnapshotReceived(); |
| 1304 |
| 1305 if (this.fromFile()) { |
| 1306 function didGetMaxNodeId(id) |
| 1307 { |
| 1308 this.maxJSObjectId = id; |
| 1309 } |
| 1310 snapshotProxy.maxJsNodeId(didGetMaxNodeId.bind(this)); |
| 1311 } |
| 1312 }, | 1312 }, |
| 1313 | 1313 |
| 1314 notifySnapshotReceived: function() | 1314 notifySnapshotReceived: function() |
| 1315 { | 1315 { |
| 1316 this._profileType._snapshotReceived(this); | 1316 this._profileType._snapshotReceived(this); |
| 1317 }, | 1317 }, |
| 1318 | 1318 |
| 1319 finishHeapSnapshot: function() | 1319 finishHeapSnapshot: function() |
| 1320 { | 1320 { |
| 1321 if (this._transferHandler) { | 1321 if (this._transferHandler) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1353 this._fileName = this._fileName || "Heap-" + new Date().toISO8601Compact
() + this._profileType.fileExtension(); | 1353 this._fileName = this._fileName || "Heap-" + new Date().toISO8601Compact
() + this._profileType.fileExtension(); |
| 1354 fileOutputStream.open(this._fileName, onOpen.bind(this)); | 1354 fileOutputStream.open(this._fileName, onOpen.bind(this)); |
| 1355 }, | 1355 }, |
| 1356 | 1356 |
| 1357 /** | 1357 /** |
| 1358 * @override | 1358 * @override |
| 1359 * @param {File} file | 1359 * @param {File} file |
| 1360 */ | 1360 */ |
| 1361 loadFromFile: function(file) | 1361 loadFromFile: function(file) |
| 1362 { | 1362 { |
| 1363 this.title = file.name; | |
| 1364 this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026"); | 1363 this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026"); |
| 1365 this.sidebarElement.wait = true; | 1364 this.sidebarElement.wait = true; |
| 1366 this._setupWorker(); | 1365 this._setupWorker(); |
| 1367 | 1366 |
| 1368 var delegate = new WebInspector.HeapSnapshotLoadFromFileDelegate(this); | 1367 var delegate = new WebInspector.HeapSnapshotLoadFromFileDelegate(this); |
| 1369 var fileReader = this._createFileReader(file, delegate); | 1368 var fileReader = this._createFileReader(file, delegate); |
| 1370 fileReader.start(this._receiver); | 1369 fileReader.start(this._receiver); |
| 1371 }, | 1370 }, |
| 1372 | 1371 |
| 1373 _createFileReader: function(file, delegate) | 1372 _createFileReader: function(file, delegate) |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1846 zeroTime: function() | 1845 zeroTime: function() |
| 1847 { | 1846 { |
| 1848 return this._minimumBoundaries; | 1847 return this._minimumBoundaries; |
| 1849 }, | 1848 }, |
| 1850 | 1849 |
| 1851 boundarySpan: function() | 1850 boundarySpan: function() |
| 1852 { | 1851 { |
| 1853 return this._maximumBoundaries - this._minimumBoundaries; | 1852 return this._maximumBoundaries - this._minimumBoundaries; |
| 1854 } | 1853 } |
| 1855 } | 1854 } |
| OLD | NEW |