Title: [103803] trunk
Revision
103803
Author
apav...@chromium.org
Date
2011-12-29 09:02:43 -0800 (Thu, 29 Dec 2011)

Log Message

Web Inspector: Implement CSS selector profiler
https://bugs.webkit.org/show_bug.cgi?id=74004

Reviewed by Pavel Feldman.

Source/WebCore:

This implementation of CSS selector profiler measures the total time required to match a certain selector
against DOM nodes and apply the style declaration properties to the particular element,
as well as the number of selector  matches (i.e. the number of nodes that matched the selector.)
The results are approximate due to internal matching algorithm optimizations (shared styles et al.)
Multiple selectors with the same selectorText are coalesced into a single record.

* English.lproj/localizedStrings.js:
* WebCore.gypi:
* WebCore.vcproj/WebCore.vcproj:
* inspector/compile-front-end.sh:
* inspector/front-end/CSSSelectorProfileView.js: Added.
(WebInspector.CSSSelectorDataGridNode):
(WebInspector.CSSSelectorDataGridNode.prototype.get rawData):
(WebInspector.CSSSelectorProfileView):
(WebInspector.CSSSelectorProfileView.prototype.get statusBarItems):
(WebInspector.CSSSelectorProfileView.prototype.get profile):
(WebInspector.CSSSelectorProfileView.prototype.set profile):
(WebInspector.CSSSelectorProfileView.prototype._createProfileNodes):
(WebInspector.CSSSelectorProfileView.prototype.rebuildGridItems):
(WebInspector.CSSSelectorProfileView.prototype.refreshData):
(WebInspector.CSSSelectorProfileView.prototype.refreshShowAsPercents):
(WebInspector.CSSSelectorProfileView.prototype._sortProfile.get selectorComparator):
(WebInspector.CSSSelectorProfileView.prototype._sortProfile.timeComparator):
(WebInspector.CSSSelectorProfileView.prototype._sortProfile.matchesComparator):
(WebInspector.CSSSelectorProfileView.prototype._sortProfile):
(WebInspector.CSSSelectorProfileType):
(WebInspector.CSSSelectorProfileType.prototype.get buttonTooltip):
(WebInspector.CSSSelectorProfileType.prototype.buttonClicked):
(WebInspector.CSSSelectorProfileType.prototype.get treeItemTitle):
(WebInspector.CSSSelectorProfileType.prototype.get description):
(WebInspector.CSSSelectorProfileType.prototype.reset):
(WebInspector.CSSSelectorProfileType.prototype.isRecordingProfile):
(WebInspector.CSSSelectorProfileType.prototype.setRecordingProfile):
(WebInspector.CSSSelectorProfileType.prototype.startRecordingProfile):
(WebInspector.CSSSelectorProfileType.prototype.stopRecordingProfile):
(WebInspector.CSSSelectorProfileType.prototype.createSidebarTreeElementForProfile):
(WebInspector.CSSSelectorProfileType.prototype.createView):
* inspector/front-end/DetailedHeapshotView.js:
* inspector/front-end/ProfileView.js:
* inspector/front-end/ProfilesPanel.js:
(WebInspector.ProfileType.prototype.reset):
(WebInspector.ProfilesPanel.prototype._reset):
(WebInspector.ProfilesPanel.prototype.addProfileHeader):
(WebInspector.ProfilesPanel.prototype._removeTemporaryProfile):
(WebInspector.ProfilesPanel.prototype.setRecordingProfile):
(WebInspector.ProfilesPanel.prototype.takeHeapSnapshot):
(WebInspector.ProfilesPanel.prototype._reportHeapSnapshotProgress):
(WebInspector.ProfilerDispatcher.prototype.addProfileHeader):
* inspector/front-end/WebKit.qrc:
* inspector/front-end/inspector.html:
* inspector/front-end/profilesPanel.css:

LayoutTests:

* inspector/profiler/detailed-heapshots-test.js:
(initialize_DetailedHeapshotTest):
* inspector/profiler/profiler-test.js:
(initialize_ProfilerTest.InspectorTest.startProfilerTest.startTest):
(initialize_ProfilerTest.InspectorTest.startProfilerTest):

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (103802 => 103803)


--- trunk/LayoutTests/ChangeLog	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/LayoutTests/ChangeLog	2011-12-29 17:02:43 UTC (rev 103803)
@@ -1,3 +1,16 @@
+2011-12-23  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: Implement CSS selector profiler
+        https://bugs.webkit.org/show_bug.cgi?id=74004
+
+        Reviewed by Pavel Feldman.
+
+        * inspector/profiler/detailed-heapshots-test.js:
+        (initialize_DetailedHeapshotTest):
+        * inspector/profiler/profiler-test.js:
+        (initialize_ProfilerTest.InspectorTest.startProfilerTest.startTest):
+        (initialize_ProfilerTest.InspectorTest.startProfilerTest):
+
 2011-12-29  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r103798.

Modified: trunk/LayoutTests/inspector/profiler/detailed-heapshots-test.js (103802 => 103803)


--- trunk/LayoutTests/inspector/profiler/detailed-heapshots-test.js	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/LayoutTests/inspector/profiler/detailed-heapshots-test.js	2011-12-29 17:02:43 UTC (rev 103803)
@@ -369,7 +369,7 @@
     }
     InspectorTest.override(ProfilerAgent, "getProfile", pushGeneratedSnapshot);
     InspectorTest._takeAndOpenSnapshotCallback = callback;
-    WebInspector.panels.profiles._addProfileHeader(profile);
+    WebInspector.panels.profiles.addProfileHeader(profile);
     WebInspector.panels.profiles.showProfile(profile);
 };
 

Modified: trunk/LayoutTests/inspector/profiler/profiler-test.js (103802 => 103803)


--- trunk/LayoutTests/inspector/profiler/profiler-test.js	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/LayoutTests/inspector/profiler/profiler-test.js	2011-12-29 17:02:43 UTC (rev 103803)
@@ -7,7 +7,7 @@
     function startTest()
     {
         InspectorTest.addResult("Profiler was enabled.");
-        InspectorTest.addSniffer(WebInspector.panels.profiles, "_addProfileHeader", InspectorTest._profileHeaderAdded, true);
+        InspectorTest.addSniffer(WebInspector.panels.profiles, "addProfileHeader", InspectorTest._profileHeaderAdded, true);
         InspectorTest.addSniffer(WebInspector.CPUProfileView.prototype, "refresh", InspectorTest._profileViewRefresh, true);
         InspectorTest.safeWrap(callback)();
     }

Modified: trunk/Source/WebCore/ChangeLog (103802 => 103803)


--- trunk/Source/WebCore/ChangeLog	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/Source/WebCore/ChangeLog	2011-12-29 17:02:43 UTC (rev 103803)
@@ -1,3 +1,62 @@
+2011-12-28  Alexander Pavlov  <apav...@chromium.org>
+
+        Web Inspector: Implement CSS selector profiler
+        https://bugs.webkit.org/show_bug.cgi?id=74004
+
+        Reviewed by Pavel Feldman.
+
+        This implementation of CSS selector profiler measures the total time required to match a certain selector
+        against DOM nodes and apply the style declaration properties to the particular element,
+        as well as the number of selector  matches (i.e. the number of nodes that matched the selector.)
+        The results are approximate due to internal matching algorithm optimizations (shared styles et al.)
+        Multiple selectors with the same selectorText are coalesced into a single record.
+
+        * English.lproj/localizedStrings.js:
+        * WebCore.gypi:
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/compile-front-end.sh:
+        * inspector/front-end/CSSSelectorProfileView.js: Added.
+        (WebInspector.CSSSelectorDataGridNode):
+        (WebInspector.CSSSelectorDataGridNode.prototype.get rawData):
+        (WebInspector.CSSSelectorProfileView):
+        (WebInspector.CSSSelectorProfileView.prototype.get statusBarItems):
+        (WebInspector.CSSSelectorProfileView.prototype.get profile):
+        (WebInspector.CSSSelectorProfileView.prototype.set profile):
+        (WebInspector.CSSSelectorProfileView.prototype._createProfileNodes):
+        (WebInspector.CSSSelectorProfileView.prototype.rebuildGridItems):
+        (WebInspector.CSSSelectorProfileView.prototype.refreshData):
+        (WebInspector.CSSSelectorProfileView.prototype.refreshShowAsPercents):
+        (WebInspector.CSSSelectorProfileView.prototype._sortProfile.get selectorComparator):
+        (WebInspector.CSSSelectorProfileView.prototype._sortProfile.timeComparator):
+        (WebInspector.CSSSelectorProfileView.prototype._sortProfile.matchesComparator):
+        (WebInspector.CSSSelectorProfileView.prototype._sortProfile):
+        (WebInspector.CSSSelectorProfileType):
+        (WebInspector.CSSSelectorProfileType.prototype.get buttonTooltip):
+        (WebInspector.CSSSelectorProfileType.prototype.buttonClicked):
+        (WebInspector.CSSSelectorProfileType.prototype.get treeItemTitle):
+        (WebInspector.CSSSelectorProfileType.prototype.get description):
+        (WebInspector.CSSSelectorProfileType.prototype.reset):
+        (WebInspector.CSSSelectorProfileType.prototype.isRecordingProfile):
+        (WebInspector.CSSSelectorProfileType.prototype.setRecordingProfile):
+        (WebInspector.CSSSelectorProfileType.prototype.startRecordingProfile):
+        (WebInspector.CSSSelectorProfileType.prototype.stopRecordingProfile):
+        (WebInspector.CSSSelectorProfileType.prototype.createSidebarTreeElementForProfile):
+        (WebInspector.CSSSelectorProfileType.prototype.createView):
+        * inspector/front-end/DetailedHeapshotView.js:
+        * inspector/front-end/ProfileView.js:
+        * inspector/front-end/ProfilesPanel.js:
+        (WebInspector.ProfileType.prototype.reset):
+        (WebInspector.ProfilesPanel.prototype._reset):
+        (WebInspector.ProfilesPanel.prototype.addProfileHeader):
+        (WebInspector.ProfilesPanel.prototype._removeTemporaryProfile):
+        (WebInspector.ProfilesPanel.prototype.setRecordingProfile):
+        (WebInspector.ProfilesPanel.prototype.takeHeapSnapshot):
+        (WebInspector.ProfilesPanel.prototype._reportHeapSnapshotProgress):
+        (WebInspector.ProfilerDispatcher.prototype.addProfileHeader):
+        * inspector/front-end/WebKit.qrc:
+        * inspector/front-end/inspector.html:
+        * inspector/front-end/profilesPanel.css:
+
 2011-12-29  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r103798.

Modified: trunk/Source/WebCore/English.lproj/localizedStrings.js


(Binary files differ)

Modified: trunk/Source/WebCore/WebCore.gypi (103802 => 103803)


--- trunk/Source/WebCore/WebCore.gypi	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/Source/WebCore/WebCore.gypi	2011-12-29 17:02:43 UTC (rev 103803)
@@ -6387,6 +6387,7 @@
             'inspector/front-end/CookiesTable.js',
             'inspector/front-end/CSSCompletions.js',
             'inspector/front-end/CSSKeywordCompletions.js',
+            'inspector/front-end/CSSSelectorProfileView.js',
             'inspector/front-end/CSSStyleModel.js',
             'inspector/front-end/Database.js',
             'inspector/front-end/DatabaseQueryView.js',

Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (103802 => 103803)


--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj	2011-12-29 17:02:43 UTC (rev 103803)
@@ -71533,6 +71533,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\inspector\front-end\CSSSelectorProfileView.js"
+					>
+				</File>
+				<File
 					RelativePath="..\inspector\front-end\CSSStyleModel.js"
 					>
 				</File>

Modified: trunk/Source/WebCore/inspector/compile-front-end.sh (103802 => 103803)


--- trunk/Source/WebCore/inspector/compile-front-end.sh	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/Source/WebCore/inspector/compile-front-end.sh	2011-12-29 17:02:43 UTC (rev 103803)
@@ -193,6 +193,7 @@
 # To be compiled...
 # 
 # [Profiler]
+# CSSSelectorProfileView
 # BottomUpProfileDataGridTree
 # DetailedHeapshotGridNodes
 # DetailedHeapshotView

Added: trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js (0 => 103803)


--- trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js	                        (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js	2011-12-29 17:02:43 UTC (rev 103803)
@@ -0,0 +1,319 @@
+/*
+ * Copyright (C) 2011 Google Inc. All Rights Reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+/**
+ * @constructor
+ * @extends WebInspector.DataGridNode
+ * @param {WebInspector.CSSSelectorProfileView} profileView
+ */
+WebInspector.CSSSelectorDataGridNode = function(profileView, data)
+{
+    WebInspector.DataGridNode.call(this, data, false);
+    this._profileView = profileView;
+}
+
+WebInspector.CSSSelectorDataGridNode.prototype = {
+    get data()
+    {
+        var data = ""
+        data.selector = this._data.selector;
+        data.matches = this._data.matchCount;
+
+        if (this._profileView.showTimeAsPercent.get())
+            data.time = Number(this._data.timePercent).toFixed(1) + "%";
+        else
+            data.time = Number.secondsToString(this._data.time / 1000, true);
+
+        return data;
+    },
+
+    get rawData()
+    {
+        return this._data;
+    }
+}
+
+WebInspector.CSSSelectorDataGridNode.prototype.__proto__ = WebInspector.DataGridNode.prototype;
+
+/**
+ * @constructor
+ * @extends WebInspector.View
+ * @param {CSSAgent.SelectorProfile} profile
+ */
+WebInspector.CSSSelectorProfileView = function(profile)
+{
+    WebInspector.View.call(this);
+
+    this.element.addStyleClass("profile-view");
+
+    this.showTimeAsPercent = WebInspector.settings.createSetting("selectorProfilerShowTimeAsPercent", true);
+
+    var columns = { "selector": { title: WebInspector.UIString("Selector"), width: "650px", sortable: true },
+                    "time": { title: WebInspector.UIString("Total"), width: "72px", sort: "descending", sortable: true },
+                    "matches": { title: WebInspector.UIString("Matches"), width: "72px", sortable: true } };
+
+    this.dataGrid = new WebInspector.DataGrid(columns);
+    this.dataGrid.addEventListener("sorting changed", this._sortProfile, this);
+    this.dataGrid.element.addEventListener("mousedown", this._mouseDownInDataGrid.bind(this), true);
+    this.dataGrid.show(this.element);
+
+    this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item");
+    this.percentButton.addEventListener("click", this._percentClicked, this);
+
+    this.profile = ""
+
+    this._createProfileNodes();
+    this._sortProfile();
+    this._updatePercentButton();
+}
+
+WebInspector.CSSSelectorProfileView.prototype = {
+    get statusBarItems()
+    {
+        return [this.percentButton.element];
+    },
+
+    get profile()
+    {
+        return this._profile;
+    },
+
+    set profile(profile)
+    {
+        this._profile = profile;
+    },
+
+    _createProfileNodes: function()
+    {
+        var data = ""
+        if (!data) {
+            // The profiler may have been terminated with the "Clear all profiles." button.
+            return;
+        }
+
+        this.profile.children = [];
+        for (var i = 0; i < data.length; ++i) {
+            data[i].timePercent = data[i].time * 100 / this.profile.totalTime;
+            var node = new WebInspector.CSSSelectorDataGridNode(this, data[i]);
+            this.profile.children.push(node);
+        }
+    },
+
+    rebuildGridItems: function()
+    {
+        this.dataGrid.removeChildren();
+
+        var children = this.profile.children;
+        var count = children.length;
+
+        for (var index = 0; index < count; ++index)
+            this.dataGrid.appendChild(children[index]);
+    },
+
+    refreshData: function()
+    {
+        var child = this.dataGrid.children[0];
+        while (child) {
+            child.refresh();
+            child = child.traverseNextNode(false, null, true);
+        }
+    },
+
+    refreshShowAsPercents: function()
+    {
+        this._updatePercentButton();
+        this.refreshData();
+    },
+
+    _percentClicked: function(event)
+    {
+        this.showTimeAsPercent.set(!this.showTimeAsPercent.get());
+        this.refreshShowAsPercents();
+    },
+
+    _updatePercentButton: function()
+    {
+        if (this.showTimeAsPercent.get()) {
+            this.percentButton.title = WebInspector.UIString("Show absolute times.");
+            this.percentButton.toggled = true;
+        } else {
+            this.percentButton.title = WebInspector.UIString("Show times as percentages.");
+            this.percentButton.toggled = false;
+        }
+    },
+
+    _sortProfile: function()
+    {
+        var sortAscending = this.dataGrid.sortOrder === "ascending";
+        var sortColumnIdentifier = this.dataGrid.sortColumnIdentifier;
+
+        function selectorComparator(a, b)
+        {
+            var result = b.rawData.selector.localeCompare(a.rawData.selector);
+            return sortAscending ? -result : result;
+        }
+
+        function timeComparator(a, b)
+        {
+            const result = b.rawData.time - a.rawData.time;
+            return sortAscending ? -result : result;
+        }
+
+        function matchesComparator(a, b)
+        {
+            const result = b.rawData.matchCount - a.rawData.matchCount;
+            return sortAscending ? -result : result;
+        }
+
+        var comparator;
+        switch (sortColumnIdentifier) {
+        case "time":
+            comparator = timeComparator;
+            break;
+        case "matches":
+            comparator = matchesComparator;
+            break;
+        case "selector":
+            comparator = selectorComparator;
+            break;
+        }
+
+        this.profile.children.sort(comparator);
+
+        this.rebuildGridItems();
+    },
+
+    _mouseDownInDataGrid: function(event)
+    {
+        if (event.detail < 2)
+            return;
+
+        var cell = event.target.enclosingNodeOrSelfWithNodeName("td");
+        if (!cell)
+            return;
+
+        if (cell.hasStyleClass("time-column"))
+            this.showTimeAsPercent.set(!this.showTimeAsPercent.get());
+        else
+            return;
+
+        this.refreshShowAsPercents();
+
+        event.preventDefault();
+        event.stopPropagation();
+    }
+}
+
+WebInspector.CSSSelectorProfileView.prototype.__proto__ = WebInspector.View.prototype;
+
+/**
+ * @constructor
+ */
+WebInspector.CSSSelectorProfileType = function()
+{
+    WebInspector.ProfileType.call(this, WebInspector.CSSSelectorProfileType.TypeId, WebInspector.UIString("Collect CSS Selector Profile"));
+    this._recording = false;
+    this._profileUid = 1;
+    WebInspector.CSSSelectorProfileType.instance = this;
+}
+
+WebInspector.CSSSelectorProfileType.TypeId = "SELECTOR";
+
+WebInspector.CSSSelectorProfileType.prototype = {
+    get buttonTooltip()
+    {
+        return this._recording ? WebInspector.UIString("Stop CSS selector profiling.") : WebInspector.UIString("Start CSS selector profiling.");
+    },
+
+    buttonClicked: function()
+    {
+        if (this._recording)
+            this.stopRecordingProfile();
+        else
+            this.startRecordingProfile();
+    },
+
+    get treeItemTitle()
+    {
+        return WebInspector.UIString("CSS SELECTOR PROFILES");
+    },
+
+    get description()
+    {
+        return WebInspector.UIString("CSS selector profiles show how long the selector matching has taken in total and how many times a certain selector has matched DOM elements (the results are approximate due to matching algorithm optimizations.)");
+    },
+
+    reset: function()
+    {
+        this._profileUid = 1;
+    },
+
+    isRecordingProfile: function()
+    {
+        return this._recording;
+    },
+
+    setRecordingProfile: function(isProfiling)
+    {
+        this._recording = isProfiling;
+    },
+
+    startRecordingProfile: function()
+    {
+        this._recording = true;
+        CSSAgent.startSelectorProfiler();
+        WebInspector.panels.profiles.setRecordingProfile(WebInspector.CSSSelectorProfileType.TypeId, true);
+    },
+
+    stopRecordingProfile: function()
+    {
+        function callback(error, profile)
+        {
+            if (error)
+                return;
+
+            profile.uid = this._profileUid++;
+            profile.title = WebInspector.UIString("Profile %d", profile.uid) + String.sprintf(" (%s)", Number.secondsToString(profile.totalTime / 1000));
+            profile.typeId = WebInspector.CSSSelectorProfileType.TypeId;
+            WebInspector.panels.profiles.addProfileHeader(profile);
+            WebInspector.panels.profiles.setRecordingProfile(WebInspector.CSSSelectorProfileType.TypeId, false);
+        }
+
+        this._recording = false;
+        CSSAgent.stopSelectorProfiler(callback.bind(this));
+    },
+
+    createSidebarTreeElementForProfile: function(profile)
+    {
+        return new WebInspector.ProfileSidebarTreeElement(profile, profile.title, "profile-sidebar-tree-item");
+    },
+
+    createView: function(profile)
+    {
+        return new WebInspector.CSSSelectorProfileView(profile);
+    }
+}
+
+WebInspector.CSSSelectorProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype;
Property changes on: trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js (103802 => 103803)


--- trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js	2011-12-29 17:02:43 UTC (rev 103803)
@@ -1308,11 +1308,6 @@
         return WebInspector.UIString("Take heap snapshot.");
     },
 
-    get buttonStyle()
-    {
-        return "heap-snapshot-status-bar-item status-bar-item";
-    },
-
     buttonClicked: function()
     {
         WebInspector.panels.profiles.takeHeapSnapshot();

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


--- trunk/Source/WebCore/inspector/front-end/ProfileView.js	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/Source/WebCore/inspector/front-end/ProfileView.js	2011-12-29 17:02:43 UTC (rev 103803)
@@ -582,11 +582,6 @@
         return this._recording ? WebInspector.UIString("Stop CPU profiling.") : WebInspector.UIString("Start CPU profiling.");
     },
 
-    get buttonStyle()
-    {
-        return this._recording ? "record-cpu-profile-status-bar-item status-bar-item toggled-on" : "record-cpu-profile-status-bar-item status-bar-item";
-    },
-
     buttonClicked: function()
     {
         if (this._recording) {

Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (103802 => 103803)


--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2011-12-29 17:02:43 UTC (rev 103803)
@@ -39,16 +39,6 @@
         return "";
     },
 
-    get buttonStyle()
-    {
-        return undefined;
-    },
-
-    get buttonCaption()
-    {
-        return this.name;
-    },
-
     get id()
     {
         return this._id;
@@ -75,6 +65,10 @@
         return profile._profileView;
     },
 
+    reset: function()
+    {
+    },
+
     get description()
     {
         return "";
@@ -148,6 +142,7 @@
     this._launcherView.setUpEventListeners();
 
     this._registerProfileType(new WebInspector.CPUProfileType());
+    this._registerProfileType(new WebInspector.CSSSelectorProfileType());
     if (Capabilities.heapProfilerPresent)
         this._registerProfileType(new WebInspector.DetailedHeapshotProfileType());
 
@@ -231,9 +226,11 @@
         this.searchCanceled();
 
         for (var id in this._profileTypesByIdMap) {
-            var treeElement = this._profileTypesByIdMap[id].treeElement;
+            var profileType = this._profileTypesByIdMap[id];
+            var treeElement = profileType.treeElement;
             treeElement.removeChildren();
             treeElement.hidden = true;
+            profileType.reset();
         }
 
         this._profiles = [];
@@ -283,10 +280,10 @@
         return escape(text) + '/' + escape(profileTypeId);
     },
 
-    _addProfileHeader: function(profile)
+    addProfileHeader: function(profile)
     {
         if (this.hasTemporaryProfile(profile.typeId))
-            this._removeProfileHeader(this._temporaryRecordingProfile);
+            this._removeTemporaryProfile();
 
         var typeId = profile.typeId;
         var profileType = this.getProfileType(typeId);
@@ -358,6 +355,12 @@
         this.recordButton.title = this._selectedProfileType.buttonTooltip;
     },
 
+    _removeTemporaryProfile: function()
+    {
+        this._removeProfileHeader(this._temporaryRecordingProfile);
+        delete this._temporaryRecordingProfile;
+    },
+
     _removeProfileHeader: function(profile)
     {
         var typeId = profile.typeId;
@@ -799,7 +802,7 @@
             var profileHeadersLength = profileHeaders.length;
             for (var i = 0; i < profileHeadersLength; ++i)
                 if (!this.hasProfile(profileHeaders[i]))
-                   this._addProfileHeader(profileHeaders[i]);
+                   this.addProfileHeader(profileHeaders[i]);
         }
 
         ProfilerAgent.getProfileHeaders(populateCallback.bind(this));
@@ -827,13 +830,11 @@
                 };
             }
             if (isProfiling) {
-                this._addProfileHeader(this._temporaryRecordingProfile);
+                this.addProfileHeader(this._temporaryRecordingProfile);
                 if (profileType === WebInspector.CPUProfileType.TypeId)
                     WebInspector.userMetrics.ProfilesCPUProfileTaken.record();
-            } else {
-                this._removeProfileHeader(this._temporaryRecordingProfile);
-                delete this._temporaryRecordingProfile;
-            }
+            } else
+                this._removeTemporaryProfile()
         }
     },
 
@@ -848,7 +849,7 @@
                     isTemporary: true
                 };
             }
-            this._addProfileHeader(this._temporaryRecordingProfile);
+            this.addProfileHeader(this._temporaryRecordingProfile);
         }
         ProfilerAgent.takeHeapSnapshot();
         WebInspector.userMetrics.ProfilesHeapProfileTaken.record();
@@ -860,7 +861,7 @@
             this._temporaryRecordingProfile.sidebarElement.subtitle = WebInspector.UIString("%.2f%%", (done / total) * 100);
             this._temporaryRecordingProfile.sidebarElement.wait = true;
             if (done >= total)
-                this._removeProfileHeader(this._temporaryRecordingProfile);
+                this._removeTemporaryProfile();
         }
     }
 }
@@ -881,7 +882,7 @@
 
     addProfileHeader: function(profile)
     {
-        this._profiler._addProfileHeader(profile);
+        this._profiler.addProfileHeader(profile);
     },
 
     addHeapSnapshotChunk: function(uid, chunk)

Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (103802 => 103803)


--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc	2011-12-29 17:02:43 UTC (rev 103803)
@@ -29,6 +29,7 @@
     <file>CookiesTable.js</file>
     <file>CSSCompletions.js</file>
     <file>CSSKeywordCompletions.js</file>
+    <file>CSSSelectorProfileView.js</file>
     <file>CSSStyleModel.js</file>
     <file>Database.js</file>
     <file>DatabaseQueryView.js</file>

Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (103802 => 103803)


--- trunk/Source/WebCore/inspector/front-end/inspector.html	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html	2011-12-29 17:02:43 UTC (rev 103803)
@@ -157,6 +157,7 @@
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
+    <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""
     <script type="text/_javascript_" src=""

Modified: trunk/Source/WebCore/inspector/front-end/profilesPanel.css (103802 => 103803)


--- trunk/Source/WebCore/inspector/front-end/profilesPanel.css	2011-12-29 16:39:08 UTC (rev 103802)
+++ trunk/Source/WebCore/inspector/front-end/profilesPanel.css	2011-12-29 17:02:43 UTC (rev 103803)
@@ -126,11 +126,6 @@
     color: white;
 }
 
-/* FIXME: should have its own glyph. */
-.heap-snapshot-status-bar-item .glyph {
-    -webkit-mask-position: -96px 0;
-}
-
 .percent-time-status-bar-item .glyph {
     -webkit-mask-position: -192px -24px;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to