Title: [97977] trunk/Source/WebCore
Revision
97977
Author
pfeld...@chromium.org
Date
2011-10-20 07:51:48 -0700 (Thu, 20 Oct 2011)

Log Message

Web Inspector: minor CPU profiling UX improvements
https://bugs.webkit.org/show_bug.cgi?id=70499

Store profile type. Store time percentage toggle state.

Reviewed by Yury Semikhatsky.

* inspector/front-end/ProfileDataGridTree.js:
* inspector/front-end/ProfileView.js:
(WebInspector.CPUProfileView.profileCallback):
(WebInspector.CPUProfileView.prototype._changeView.set else):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (97976 => 97977)


--- trunk/Source/WebCore/ChangeLog	2011-10-20 14:29:22 UTC (rev 97976)
+++ trunk/Source/WebCore/ChangeLog	2011-10-20 14:51:48 UTC (rev 97977)
@@ -1,3 +1,17 @@
+2011-10-20  Pavel Feldman  <pfeld...@google.com>
+
+        Web Inspector: minor CPU profiling UX improvements
+        https://bugs.webkit.org/show_bug.cgi?id=70499
+
+        Store profile type. Store time percentage toggle state.
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/ProfileDataGridTree.js:
+        * inspector/front-end/ProfileView.js:
+        (WebInspector.CPUProfileView.profileCallback):
+        (WebInspector.CPUProfileView.prototype._changeView.set else):
+
 2011-10-20  Vsevolod Vlasov  <vse...@chromium.org>
 
         Web Inspector: Advanced search results should keep working after pretty print toggled.

Modified: trunk/Source/WebCore/inspector/front-end/ProfileDataGridTree.js (97976 => 97977)


--- trunk/Source/WebCore/inspector/front-end/ProfileDataGridTree.js	2011-10-20 14:29:22 UTC (rev 97976)
+++ trunk/Source/WebCore/inspector/front-end/ProfileDataGridTree.js	2011-10-20 14:51:48 UTC (rev 97977)
@@ -58,17 +58,17 @@
         data["function"] = this.functionName;
         data["calls"] = this.numberOfCalls;
 
-        if (this.profileView.showSelfTimeAsPercent)
+        if (this.profileView.showSelfTimeAsPercent.get())
             data["self"] = WebInspector.UIString("%.2f%%", this.selfPercent);
         else
             data["self"] = formatMilliseconds(this.selfTime);
 
-        if (this.profileView.showTotalTimeAsPercent)
+        if (this.profileView.showTotalTimeAsPercent.get())
             data["total"] = WebInspector.UIString("%.2f%%", this.totalPercent);
         else
             data["total"] = formatMilliseconds(this.totalTime);
 
-        if (this.profileView.showAverageTimeAsPercent)
+        if (this.profileView.showAverageTimeAsPercent.get())
             data["average"] = WebInspector.UIString("%.2f%%", this.averagePercent);
         else
             data["average"] = formatMilliseconds(this.averageTime);

Modified: trunk/Source/WebCore/inspector/front-end/ProfileView.js (97976 => 97977)


--- trunk/Source/WebCore/inspector/front-end/ProfileView.js	2011-10-20 14:29:22 UTC (rev 97976)
+++ trunk/Source/WebCore/inspector/front-end/ProfileView.js	2011-10-20 14:51:48 UTC (rev 97977)
@@ -30,11 +30,12 @@
     WebInspector.View.call(this);
 
     this.element.addStyleClass("profile-view");
+    
+    this.showSelfTimeAsPercent = WebInspector.settings.createSetting("cpuProfilerShowSelfTimeAsPercent", true);
+    this.showTotalTimeAsPercent = WebInspector.settings.createSetting("cpuProfilerShowTotalTimeAsPercent", true);
+    this.showAverageTimeAsPercent = WebInspector.settings.createSetting("cpuProfilerShowAverageTimeAsPercent", true);
+    this._viewType = WebInspector.settings.createSetting("cpuProfilerView", WebInspector.CPUProfileView._TypeHeavy);
 
-    this.showSelfTimeAsPercent = true;
-    this.showTotalTimeAsPercent = true;
-    this.showAverageTimeAsPercent = true;
-
     var columns = { "self": { title: WebInspector.UIString("Self"), width: "72px", sort: "descending", sortable: true },
                     "total": { title: WebInspector.UIString("Total"), width: "72px", sortable: true },
                     "average": { title: WebInspector.UIString("Average"), width: "72px", sortable: true },
@@ -54,7 +55,6 @@
     this.viewSelectElement = document.createElement("select");
     this.viewSelectElement.className = "status-bar-item";
     this.viewSelectElement.addEventListener("change", this._changeView.bind(this), false);
-    this.view = "Heavy";
 
     var heavyViewOption = document.createElement("option");
     heavyViewOption.label = WebInspector.UIString("Heavy (Bottom Up)");
@@ -62,6 +62,7 @@
     treeViewOption.label = WebInspector.UIString("Tree (Top Down)");
     this.viewSelectElement.appendChild(heavyViewOption);
     this.viewSelectElement.appendChild(treeViewOption);
+    this.viewSelectElement.selectedIndex = this._viewType.get() === WebInspector.CPUProfileView._TypeHeavy ? 0 : 1;
 
     this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item");
     this.percentButton.addEventListener("click", this._percentClicked.bind(this), false);
@@ -80,27 +81,24 @@
 
     this.profile = ""
 
-    var self = this;
     function profileCallback(error, profile)
     {
         if (error)
             return;
-        self.profile.head = profile.head;
-        self._assignParentsInProfile();
-
-        self.profileDataGridTree = self.bottomUpProfileDataGridTree;
-        self.profileDataGridTree.sort(WebInspector.ProfileDataGridTree.propertyComparator("selfTime", false));
-
-        self.refresh();
-
-        self._updatePercentButton();
+        this.profile.head = profile.head;
+        this._assignParentsInProfile();
+        this._changeView();
+        this._updatePercentButton();
     }
 
-    this._linkifier = WebInspector.debuggerPresentationModel.createLinkifier();
+    this._linkifier = WebInspector.debuggerPresentationModel.createLinkifier(new WebInspector.DebuggerPresentationModel.DefaultLinkifierFormatter(30));
 
-    ProfilerAgent.getProfile(this.profile.typeId, this.profile.uid, profileCallback);
+    ProfilerAgent.getProfile(this.profile.typeId, this.profile.uid, profileCallback.bind(this));
 }
 
+WebInspector.CPUProfileView._TypeTree = "Tree";
+WebInspector.CPUProfileView._TypeHeavy = "Heavy";
+
 WebInspector.CPUProfileView.prototype = {
     get statusBarItems()
     {
@@ -412,19 +410,19 @@
         profileNode.revealAndSelect();
     },
 
-    _changeView: function(event)
+    _changeView: function()
     {
-        if (!event || !this.profile)
+        if (!this.profile)
             return;
 
-        if (event.target.selectedIndex == 1 && this.view == "Heavy") {
+        if (this.viewSelectElement.selectedIndex == 1) {
             this.profileDataGridTree = this.topDownProfileDataGridTree;
             this._sortProfile();
-            this.view = "Tree";
-        } else if (event.target.selectedIndex == 0 && this.view == "Tree") {
+            this._viewType.set(WebInspector.CPUProfileView._TypeTree);
+        } else if (this.viewSelectElement.selectedIndex == 0) {
             this.profileDataGridTree = this.bottomUpProfileDataGridTree;
             this._sortProfile();
-            this.view = "Heavy";
+            this._viewType.set(WebInspector.CPUProfileView._TypeHeavy);
         }
 
         if (!this.currentQuery || !this._searchFinishedCallback || !this._searchResults)
@@ -439,16 +437,16 @@
 
     _percentClicked: function(event)
     {
-        var currentState = this.showSelfTimeAsPercent && this.showTotalTimeAsPercent && this.showAverageTimeAsPercent;
-        this.showSelfTimeAsPercent = !currentState;
-        this.showTotalTimeAsPercent = !currentState;
-        this.showAverageTimeAsPercent = !currentState;
+        var currentState = this.showSelfTimeAsPercent.get() && this.showTotalTimeAsPercent.get() && this.showAverageTimeAsPercent.get();
+        this.showSelfTimeAsPercent.set(!currentState);
+        this.showTotalTimeAsPercent.set(!currentState);
+        this.showAverageTimeAsPercent.set(!currentState);
         this.refreshShowAsPercents();
     },
 
     _updatePercentButton: function()
     {
-        if (this.showSelfTimeAsPercent && this.showTotalTimeAsPercent && this.showAverageTimeAsPercent) {
+        if (this.showSelfTimeAsPercent.get() && this.showTotalTimeAsPercent.get() && this.showAverageTimeAsPercent.get()) {
             this.percentButton.title = WebInspector.UIString("Show absolute total and self times.");
             this.percentButton.toggled = true;
         } else {
@@ -536,11 +534,11 @@
             return;
 
         if (cell.hasStyleClass("total-column"))
-            this.showTotalTimeAsPercent = !this.showTotalTimeAsPercent;
+            this.showTotalTimeAsPercent.set(!this.showTotalTimeAsPercent.get());
         else if (cell.hasStyleClass("self-column"))
-            this.showSelfTimeAsPercent = !this.showSelfTimeAsPercent;
+            this.showSelfTimeAsPercent.set(!this.showSelfTimeAsPercent.get());
         else if (cell.hasStyleClass("average-column"))
-            this.showAverageTimeAsPercent = !this.showAverageTimeAsPercent;
+            this.showAverageTimeAsPercent.set(!this.showAverageTimeAsPercent.get());
 
         this.refreshShowAsPercents();
 

Modified: trunk/Source/WebCore/inspector/front-end/networkLogView.css (97976 => 97977)


--- trunk/Source/WebCore/inspector/front-end/networkLogView.css	2011-10-20 14:29:22 UTC (rev 97976)
+++ trunk/Source/WebCore/inspector/front-end/networkLogView.css	2011-10-20 14:51:48 UTC (rev 97977)
@@ -125,15 +125,6 @@
     color: white;
 }
 
-.network-log-grid tr.highlighted-row {
-    -webkit-animation: "fadeout" 2s 0s;
-}
-
-@-webkit-keyframes fadeout {
-    from {background-color: rgba(56, 121, 217, 1); }
-    to { background-color: rgba(56, 121, 217, 0); }
-}
-
 .network-header-subtitle {
     color: gray;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to