Index: chrome/tools/test/reference_build/chrome_linux/resources/inspector/ProfilesPanel.js |
diff --git a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/ProfilesPanel.js b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/ProfilesPanel.js |
index 413246c88288a1714768a5e55f5027000d512ae0..c010033730916abf048d88576a0b095a22f506dd 100644 |
--- a/chrome/tools/test/reference_build/chrome_linux/resources/inspector/ProfilesPanel.js |
+++ b/chrome/tools/test/reference_build/chrome_linux/resources/inspector/ProfilesPanel.js |
@@ -55,22 +55,32 @@ WebInspector.ProfilesPanel = function() |
this.sidebarTree = new TreeOutline(this.sidebarTreeElement); |
+ this.profilesListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("CPU PROFILES"), null, true); |
+ this.sidebarTree.appendChild(this.profilesListTreeElement); |
+ this.profilesListTreeElement.expand(); |
+ |
+ this.snapshotsListTreeElement = new WebInspector.SidebarSectionTreeElement(WebInspector.UIString("HEAP SNAPSHOTS"), null, true); |
+ if (Preferences.heapProfilerPresent) { |
+ this.sidebarTree.appendChild(this.snapshotsListTreeElement); |
+ this.snapshotsListTreeElement.expand(); |
+ } |
+ |
this.profileViews = document.createElement("div"); |
this.profileViews.id = "profile-views"; |
this.element.appendChild(this.profileViews); |
- this.enableToggleButton = document.createElement("button"); |
- this.enableToggleButton.className = "enable-toggle-status-bar-item status-bar-item"; |
+ this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item"); |
this.enableToggleButton.addEventListener("click", this._toggleProfiling.bind(this), false); |
- this.recordButton = document.createElement("button"); |
- this.recordButton.title = WebInspector.UIString("Start profiling."); |
- this.recordButton.id = "record-profile-status-bar-item"; |
- this.recordButton.className = "status-bar-item"; |
+ this.recordButton = new WebInspector.StatusBarButton(WebInspector.UIString("Start profiling."), "record-profile-status-bar-item"); |
this.recordButton.addEventListener("click", this._recordClicked.bind(this), false); |
this.recording = false; |
+ this.snapshotButton = new WebInspector.StatusBarButton(WebInspector.UIString("Take heap snapshot."), "heap-snapshot-status-bar-item"); |
+ this.snapshotButton.visible = Preferences.heapProfilerPresent; |
+ this.snapshotButton.addEventListener("click", this._snapshotClicked.bind(this), false); |
+ |
this.profileViewStatusBarItemsContainer = document.createElement("div"); |
this.profileViewStatusBarItemsContainer.id = "profile-view-status-bar-items"; |
@@ -87,7 +97,7 @@ WebInspector.ProfilesPanel.prototype = { |
get statusBarItems() |
{ |
- return [this.enableToggleButton, this.recordButton, this.profileViewStatusBarItemsContainer]; |
+ return [this.enableToggleButton.element, this.recordButton.element, this.snapshotButton.element, this.profileViewStatusBarItemsContainer]; |
}, |
show: function() |
@@ -137,7 +147,8 @@ WebInspector.ProfilesPanel.prototype = { |
this.sidebarTreeElement.removeStyleClass("some-expandable"); |
- this.sidebarTree.removeChildren(); |
+ this.profilesListTreeElement.removeChildren(); |
+ this.snapshotsListTreeElement.removeChildren(); |
this.profileViews.removeChildren(); |
this.profileViewStatusBarItemsContainer.removeChildren(); |
@@ -155,7 +166,7 @@ WebInspector.ProfilesPanel.prototype = { |
this._profiles.push(profile); |
this._profilesIdMap[profile.uid] = profile; |
- var sidebarParent = this.sidebarTree; |
+ var sidebarParent = this.profilesListTreeElement; |
var small = false; |
var alternateTitle; |
@@ -266,8 +277,10 @@ WebInspector.ProfilesPanel.prototype = { |
groupNumber = ++this._profileGroupsForLinks[title]; |
- if (groupNumber >= 2) |
- title += " " + WebInspector.UIString("Run %d", groupNumber); |
+ if (groupNumber > 2) |
+ // The title is used in the console message announcing that a profile has started so it gets |
+ // incremented twice as often as it's displayed |
+ title += " " + WebInspector.UIString("Run %d", groupNumber / 2); |
} |
return title; |
@@ -315,26 +328,36 @@ WebInspector.ProfilesPanel.prototype = { |
this.recording = isProfiling; |
if (isProfiling) { |
- this.recordButton.addStyleClass("toggled-on"); |
+ this.recordButton.toggled = true; |
this.recordButton.title = WebInspector.UIString("Stop profiling."); |
} else { |
- this.recordButton.removeStyleClass("toggled-on"); |
+ this.recordButton.toggled = false; |
this.recordButton.title = WebInspector.UIString("Start profiling."); |
} |
}, |
+ |
+ resize: function() |
+ { |
+ var visibleView = this.visibleView; |
+ if (visibleView && "resize" in visibleView) |
+ visibleView.resize(); |
+ }, |
_updateInterface: function() |
{ |
if (InspectorController.profilerEnabled()) { |
this.enableToggleButton.title = WebInspector.UIString("Profiling enabled. Click to disable."); |
- this.enableToggleButton.addStyleClass("toggled-on"); |
- this.recordButton.removeStyleClass("hidden"); |
+ this.enableToggleButton.toggled = true; |
+ this.recordButton.visible = true; |
+ if (Preferences.heapProfilerPresent) |
+ this.snapshotButton.visible = true; |
this.profileViewStatusBarItemsContainer.removeStyleClass("hidden"); |
this.panelEnablerView.visible = false; |
} else { |
this.enableToggleButton.title = WebInspector.UIString("Profiling disabled. Click to enable."); |
- this.enableToggleButton.removeStyleClass("toggled-on"); |
- this.recordButton.addStyleClass("hidden"); |
+ this.enableToggleButton.toggled = false; |
+ this.recordButton.visible = false; |
+ this.snapshotButton.visible = false; |
this.profileViewStatusBarItemsContainer.addStyleClass("hidden"); |
this.panelEnablerView.visible = true; |
} |
@@ -350,19 +373,24 @@ WebInspector.ProfilesPanel.prototype = { |
InspectorController.stopProfiling(); |
}, |
+ _snapshotClicked: function() |
+ { |
+ InspectorController.takeHeapSnapshot(); |
+ }, |
+ |
_enableProfiling: function() |
{ |
if (InspectorController.profilerEnabled()) |
return; |
- this._toggleProfiling(); |
+ this._toggleProfiling(this.panelEnablerView.alwaysEnabled); |
}, |
- _toggleProfiling: function() |
+ _toggleProfiling: function(optionalAlways) |
{ |
if (InspectorController.profilerEnabled()) |
- InspectorController.disableProfiler(); |
+ InspectorController.disableProfiler(true); |
else |
- InspectorController.enableProfiler(); |
+ InspectorController.enableProfiler(!!optionalAlways); |
}, |
_populateProfiles: function() |
@@ -422,6 +450,10 @@ WebInspector.ProfilesPanel.prototype = { |
this.profileViews.style.left = width + "px"; |
this.profileViewStatusBarItemsContainer.style.left = width + "px"; |
this.sidebarResizeElement.style.left = (width - 3) + "px"; |
+ |
+ var visibleView = this.visibleView; |
+ if (visibleView && "resize" in visibleView) |
+ visibleView.resize(); |
} |
} |