OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 /** | 5 /** |
6 * @fileoverview Heap profiler panel implementation. | 6 * @fileoverview Heap profiler panel implementation. |
7 */ | 7 */ |
8 | 8 |
9 WebInspector.HeapProfilerPanel = function() { | 9 WebInspector.HeapProfilerPanel = function() { |
10 WebInspector.Panel.call(this); | 10 WebInspector.Panel.call(this); |
(...skipping 13 matching lines...) Expand all Loading... |
24 this.sidebarTreeElement = document.createElement("ol"); | 24 this.sidebarTreeElement = document.createElement("ol"); |
25 this.sidebarTreeElement.className = "sidebar-tree"; | 25 this.sidebarTreeElement.className = "sidebar-tree"; |
26 this.sidebarElement.appendChild(this.sidebarTreeElement); | 26 this.sidebarElement.appendChild(this.sidebarTreeElement); |
27 | 27 |
28 this.sidebarTree = new TreeOutline(this.sidebarTreeElement); | 28 this.sidebarTree = new TreeOutline(this.sidebarTreeElement); |
29 | 29 |
30 this.snapshotViews = document.createElement("div"); | 30 this.snapshotViews = document.createElement("div"); |
31 this.snapshotViews.id = "heap-snapshot-views"; | 31 this.snapshotViews.id = "heap-snapshot-views"; |
32 this.element.appendChild(this.snapshotViews); | 32 this.element.appendChild(this.snapshotViews); |
33 | 33 |
34 this.snapshotButton = document.createElement("button"); | 34 this.snapshotButton = new WebInspector.StatusBarButton(WebInspector.UIString
("Take heap snapshot."), "heap-snapshot-status-bar-item"); |
35 this.snapshotButton.title = WebInspector.UIString("Take heap snapshot."); | |
36 this.snapshotButton.className = "heap-snapshot-status-bar-item status-bar-it
em"; | |
37 this.snapshotButton.addEventListener("click", this._snapshotClicked.bind(thi
s), false); | 35 this.snapshotButton.addEventListener("click", this._snapshotClicked.bind(thi
s), false); |
38 | 36 |
39 this.snapshotViewStatusBarItemsContainer = document.createElement("div"); | 37 this.snapshotViewStatusBarItemsContainer = document.createElement("div"); |
40 this.snapshotViewStatusBarItemsContainer.id = "heap-snapshot-status-bar-item
s"; | 38 this.snapshotViewStatusBarItemsContainer.id = "heap-snapshot-status-bar-item
s"; |
41 | 39 |
42 this.reset(); | 40 this.reset(); |
43 }; | 41 }; |
44 | 42 |
45 WebInspector.HeapProfilerPanel.prototype = { | 43 WebInspector.HeapProfilerPanel.prototype = { |
46 toolbarItemClass: "heap-profiler", | 44 toolbarItemClass: "heap-profiler", |
47 | 45 |
48 get toolbarItemLabel() { | 46 get toolbarItemLabel() { |
49 return WebInspector.UIString("Heap"); | 47 return WebInspector.UIString("Heap"); |
50 }, | 48 }, |
51 | 49 |
52 get statusBarItems() { | 50 get statusBarItems() { |
53 return [this.snapshotButton, this.snapshotViewStatusBarItemsContainer]; | 51 return [this.snapshotButton.element, this.snapshotViewStatusBarItemsCont
ainer]; |
54 }, | 52 }, |
55 | 53 |
56 show: function() { | 54 show: function() { |
57 WebInspector.Panel.prototype.show.call(this); | 55 WebInspector.Panel.prototype.show.call(this); |
58 this._updateSidebarWidth(); | 56 this._updateSidebarWidth(); |
59 }, | 57 }, |
60 | 58 |
61 reset: function() { | 59 reset: function() { |
62 if (this._snapshots) { | 60 if (this._snapshots) { |
63 var snapshotsLength = this._snapshots.length; | 61 var snapshotsLength = this._snapshots.length; |
(...skipping 609 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
673 if (!comparator) { | 671 if (!comparator) { |
674 comparator = function(lhs, rhs) { | 672 comparator = function(lhs, rhs) { |
675 var l = lhs[property], r = rhs[property]; | 673 var l = lhs[property], r = rhs[property]; |
676 var result = l < r ? -1 : (l > r ? 1 : 0); | 674 var result = l < r ? -1 : (l > r ? 1 : 0); |
677 return isAscending ? result : -result; | 675 return isAscending ? result : -result; |
678 }; | 676 }; |
679 this.propertyComparators[(isAscending ? 1 : 0)][property] = comparator; | 677 this.propertyComparators[(isAscending ? 1 : 0)][property] = comparator; |
680 } | 678 } |
681 return comparator; | 679 return comparator; |
682 }; | 680 }; |
OLD | NEW |