[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

eric at webkit.org eric at webkit.org
Thu Oct 29 20:45:23 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 2b222ca059ab9b7af621b546d698975bc43968d0
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 15 16:50:23 2009 +0000

    2009-10-15  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Pavel Feldman.
    
            Refactor ProfilesPanel to support multiple profile types
    
            Data describing different profile types are now stored in distinct objects.
            https://bugs.webkit.org/show_bug.cgi?id=30332
    
            * WebCore.vcproj/WebCore.vcproj:
            * inspector/front-end/ProfileView.js:
            (WebInspector.CPUProfileView.profileCallback):
            (WebInspector.CPUProfileView):
            (WebInspector.CPUProfileView.prototype._sortData):
            (WebInspector.CPUProfileType):
            (WebInspector.CPUProfileType.prototype.get buttonTooltip):
            (WebInspector.CPUProfileType.prototype.get buttonStyle):
            (WebInspector.CPUProfileType.prototype.buttonClicked):
            (WebInspector.CPUProfileType.prototype.setRecordingProfile):
            (WebInspector.CPUProfile):
            (WebInspector.CPUProfile.prototype.get title):
            (WebInspector.CPUProfile.prototype.get uid):
            (WebInspector.CPUProfile.prototype.get head):
            (WebInspector.CPUProfile.prototype.createView):
            (WebInspector.CPUProfile.prototype.viewForProfile):
            * inspector/front-end/ProfilesPanel.js:
            (WebInspector.ProfileType):
            (WebInspector.ProfileType.prototype.get buttonTooltip):
            (WebInspector.ProfileType.prototype.get buttonStyle):
            (WebInspector.ProfileType.prototype.get buttonCaption):
            (WebInspector.ProfileType.prototype.get id):
            (WebInspector.ProfileType.prototype.get name):
            (WebInspector.ProfileType.prototype.buttonClicked):
            (WebInspector.ProfilesPanel):
            (WebInspector.ProfilesPanel.prototype.get statusBarItems.clickHandler):
            (WebInspector.ProfilesPanel.prototype.get statusBarItems):
            (WebInspector.ProfilesPanel.prototype.reset):
            (WebInspector.ProfilesPanel.prototype.registerProfileType):
            (WebInspector.ProfilesPanel.prototype._makeKey):
            (WebInspector.ProfilesPanel.prototype.addProfileHeader):
            (WebInspector.ProfilesPanel.prototype.showProfile):
            (WebInspector.ProfilesPanel.prototype.getProfileType):
            (WebInspector.ProfilesPanel.prototype.showProfileForURL):
            (WebInspector.ProfilesPanel.prototype.updateProfileTypeButtons):
            (WebInspector.ProfilesPanel.prototype.displayTitleForProfileLink):
            (WebInspector.ProfilesPanel.prototype.get searchableViews):
            (WebInspector.ProfilesPanel.prototype._updateInterface):
            * inspector/front-end/inspector.js:
            (WebInspector._createPanels):
            (WebInspector.documentClick.followLink):
            (WebInspector.documentClick):
            (WebInspector.addProfileHeader):
            (WebInspector.setRecordingProfile):
            (WebInspector.linkifyStringAsFragment):
            (WebInspector.showProfileForURL):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49632 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 308ff1c..bae3829 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,59 @@
+2009-10-15  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Pavel Feldman.
+
+        Refactor ProfilesPanel to support multiple profile types
+
+        Data describing different profile types are now stored in distinct objects.
+        https://bugs.webkit.org/show_bug.cgi?id=30332
+
+        * WebCore.vcproj/WebCore.vcproj:
+        * inspector/front-end/ProfileView.js:
+        (WebInspector.CPUProfileView.profileCallback):
+        (WebInspector.CPUProfileView):
+        (WebInspector.CPUProfileView.prototype._sortData):
+        (WebInspector.CPUProfileType):
+        (WebInspector.CPUProfileType.prototype.get buttonTooltip):
+        (WebInspector.CPUProfileType.prototype.get buttonStyle):
+        (WebInspector.CPUProfileType.prototype.buttonClicked):
+        (WebInspector.CPUProfileType.prototype.setRecordingProfile):
+        (WebInspector.CPUProfile):
+        (WebInspector.CPUProfile.prototype.get title):
+        (WebInspector.CPUProfile.prototype.get uid):
+        (WebInspector.CPUProfile.prototype.get head):
+        (WebInspector.CPUProfile.prototype.createView):
+        (WebInspector.CPUProfile.prototype.viewForProfile):
+        * inspector/front-end/ProfilesPanel.js:
+        (WebInspector.ProfileType):
+        (WebInspector.ProfileType.prototype.get buttonTooltip):
+        (WebInspector.ProfileType.prototype.get buttonStyle):
+        (WebInspector.ProfileType.prototype.get buttonCaption):
+        (WebInspector.ProfileType.prototype.get id):
+        (WebInspector.ProfileType.prototype.get name):
+        (WebInspector.ProfileType.prototype.buttonClicked):
+        (WebInspector.ProfilesPanel):
+        (WebInspector.ProfilesPanel.prototype.get statusBarItems.clickHandler):
+        (WebInspector.ProfilesPanel.prototype.get statusBarItems):
+        (WebInspector.ProfilesPanel.prototype.reset):
+        (WebInspector.ProfilesPanel.prototype.registerProfileType):
+        (WebInspector.ProfilesPanel.prototype._makeKey):
+        (WebInspector.ProfilesPanel.prototype.addProfileHeader):
+        (WebInspector.ProfilesPanel.prototype.showProfile):
+        (WebInspector.ProfilesPanel.prototype.getProfileType):
+        (WebInspector.ProfilesPanel.prototype.showProfileForURL):
+        (WebInspector.ProfilesPanel.prototype.updateProfileTypeButtons):
+        (WebInspector.ProfilesPanel.prototype.displayTitleForProfileLink):
+        (WebInspector.ProfilesPanel.prototype.get searchableViews):
+        (WebInspector.ProfilesPanel.prototype._updateInterface):
+        * inspector/front-end/inspector.js:
+        (WebInspector._createPanels):
+        (WebInspector.documentClick.followLink):
+        (WebInspector.documentClick):
+        (WebInspector.addProfileHeader):
+        (WebInspector.setRecordingProfile):
+        (WebInspector.linkifyStringAsFragment):
+        (WebInspector.showProfileForURL):
+
 2009-10-15  Pavel Feldman  <pfeldman at chromium.org>
 
         Reviewed by Timothy Hatcher.
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index f34fa53..c0ef57a 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -31667,6 +31667,14 @@
 					>
 				</File>
 				<File
+					RelativePath="..\inspector\front-end\ProfilesPanel.js"
+					>
+				</File>
+				<File
+					RelativePath="..\inspector\front-end\ProfileView.js"
+					>
+				</File>
+				<File
 					RelativePath="..\inspector\front-end\PropertiesSection.js"
 					>
 				</File>
@@ -31699,6 +31707,10 @@
 					>
 				</File>
 				<File
+					RelativePath="..\inspector\front-end\ScriptsPanel.js"
+					>
+				</File>
+				<File
 					RelativePath="..\inspector\front-end\ScriptView.js"
 					>
 				</File>
diff --git a/WebCore/inspector/front-end/ProfileView.js b/WebCore/inspector/front-end/ProfileView.js
index a8c3f14..ee96345 100644
--- a/WebCore/inspector/front-end/ProfileView.js
+++ b/WebCore/inspector/front-end/ProfileView.js
@@ -23,7 +23,9 @@
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-WebInspector.ProfileView = function(profile)
+// FIXME: Rename the file.
+
+WebInspector.CPUProfileView = function(profile)
 {
     WebInspector.View.call(this);
 
@@ -81,7 +83,7 @@ WebInspector.ProfileView = function(profile)
     var self = this;
     function profileCallback(profile)
     {
-        self.profile = profile;
+        self.profile.representedObject = profile;
         self._assignParentsInProfile();
       
         self.profileDataGridTree = self.bottomUpProfileDataGridTree;
@@ -96,7 +98,7 @@ WebInspector.ProfileView = function(profile)
     InspectorController.getProfile(callId, this.profile.uid);
 }
 
-WebInspector.ProfileView.prototype = {
+WebInspector.CPUProfileView.prototype = {
     get statusBarItems()
     {
         return [this.viewSelectElement, this.percentButton.element, this.focusButton.element, this.excludeButton.element, this.resetButton.element];
@@ -168,7 +170,7 @@ WebInspector.ProfileView.prototype = {
         WebInspector.View.prototype.hide.call(this);
         this._currentSearchResultIndex = -1;
     },
-    
+
     resize: function()
     {
         if (this.dataGrid)
@@ -503,7 +505,7 @@ WebInspector.ProfileView.prototype = {
 
     _sortData: function(event)
     {
-        this._sortProfile(this.profile);
+        this._sortProfile(this.profile.representedObject);
     },
 
     _sortProfile: function()
@@ -566,4 +568,77 @@ WebInspector.ProfileView.prototype = {
     }
 }
 
-WebInspector.ProfileView.prototype.__proto__ = WebInspector.View.prototype;
+WebInspector.CPUProfileView.prototype.__proto__ = WebInspector.View.prototype;
+
+WebInspector.CPUProfileType = function()
+{
+    WebInspector.ProfileType.call(this, WebInspector.CPUProfileType.TypeId, WebInspector.UIString("CPU PROFILES"));
+    this._recording = false;
+}
+
+WebInspector.CPUProfileType.TypeId = "CPU";
+
+WebInspector.CPUProfileType.prototype = {
+    get buttonTooltip()
+    {
+        return this._recording ? WebInspector.UIString("Stop profiling.") : WebInspector.UIString("Start profiling.");
+    },
+
+    get buttonStyle()
+    {
+        return this._recording ? "record-profile-status-bar-item status-bar-item toggled-on" : "record-profile-status-bar-item status-bar-item";
+    },
+
+    buttonClicked: function()
+    {
+        this._recording = !this._recording;
+
+        if (this._recording)
+            InspectorController.startProfiling();
+        else
+            InspectorController.stopProfiling();
+    },
+
+    setRecordingProfile: function(isProfiling)
+    {
+        this._recording = isProfiling;
+    }
+}
+
+WebInspector.CPUProfileType.prototype.__proto__ = WebInspector.ProfileType.prototype;
+
+WebInspector.CPUProfile = function(profile)
+{
+    this.representedObject = profile;
+    this.typeId = WebInspector.CPUProfileType.TypeId;
+}
+
+WebInspector.CPUProfile.prototype = {
+    get title()
+    {
+        return this.representedObject.title;
+    },
+
+    get uid()
+    {
+        return this.representedObject.uid;
+    },
+
+    get head()
+    {
+        return this.representedObject.head;
+    },
+
+    createView: function()
+    {
+        return new WebInspector.CPUProfileView(this);
+    },
+
+    // FIXME: Extract this into a superclass so that createView can be simply overridden by subclasses.
+    viewForProfile: function()
+    {
+        if (!this._profileView)
+            this._profileView = this.createView();
+        return this._profileView;
+    }
+}
diff --git a/WebCore/inspector/front-end/ProfilesPanel.js b/WebCore/inspector/front-end/ProfilesPanel.js
index ced9587..55e286e 100644
--- a/WebCore/inspector/front-end/ProfilesPanel.js
+++ b/WebCore/inspector/front-end/ProfilesPanel.js
@@ -25,11 +25,52 @@
 
 const UserInitiatedProfileName = "org.webkit.profiles.user-initiated";
 
+WebInspector.ProfileType = function(id, name)
+{
+    this._id = id;
+    this._name = name;
+}
+
+WebInspector.ProfileType.URLRegExp = /webkit-profile:\/\/(.+)\/(.+)#([0-9]+)/;
+
+WebInspector.ProfileType.prototype = {
+    get buttonTooltip()
+    {
+        return "";
+    },
+
+    get buttonStyle()
+    {
+        return undefined;
+    },
+
+    get buttonCaption()
+    {
+        return this.name;
+    },
+
+    get id()
+    {
+        return this._id;
+    },
+
+    get name()
+    {
+        return this._name;
+    },
+
+    buttonClicked: function()
+    {
+    }
+}
+
 WebInspector.ProfilesPanel = function()
 {
     WebInspector.Panel.call(this);
 
     this.element.addStyleClass("profiles");
+    this._profileTypesByIdMap = {};
+    this._profileTypeButtonsByIdMap = {};
 
     var panelEnablerHeading = WebInspector.UIString("You need to enable profiling before you can use the Profiles panel.");
     var panelEnablerDisclaimer = WebInspector.UIString("Enabling profiling will make scripts run slower.");
@@ -52,19 +93,8 @@ WebInspector.ProfilesPanel = function()
     this.sidebarTreeElement = document.createElement("ol");
     this.sidebarTreeElement.className = "sidebar-tree";
     this.sidebarElement.appendChild(this.sidebarTreeElement);
-
     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);
@@ -72,18 +102,10 @@ WebInspector.ProfilesPanel = function()
     this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
     this.enableToggleButton.addEventListener("click", this._toggleProfiling.bind(this), false);
 
-    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";
 
+    this._profiles = [];
     this.reset();
 }
 
@@ -97,7 +119,25 @@ WebInspector.ProfilesPanel.prototype = {
 
     get statusBarItems()
     {
-        return [this.enableToggleButton.element, this.recordButton.element, this.snapshotButton.element, this.profileViewStatusBarItemsContainer];
+        function clickHandler(profileType, buttonElement)
+        {
+            profileType.buttonClicked.call(profileType);
+            this.updateProfileTypeButtons();
+        }
+
+        var items = [this.enableToggleButton.element];
+        // FIXME: Generate a single "combo-button".
+        for (var typeId in this._profileTypesByIdMap) {
+            var profileType = this.getProfileType(typeId);
+            if (profileType.buttonStyle) {
+                var button = new WebInspector.StatusBarButton(profileType.buttonTooltip, profileType.buttonStyle, profileType.buttonCaption);
+                this._profileTypeButtonsByIdMap[typeId] = button.element;
+                button.element.addEventListener("click", clickHandler.bind(this, profileType, button.element), false);
+                items.push(button.element);
+            }
+        }
+        items.push(this.profileViewStatusBarItemsContainer);
+        return items;
     },
 
     show: function()
@@ -129,13 +169,8 @@ WebInspector.ProfilesPanel.prototype = {
 
     reset: function()
     {
-        if (this._profiles) {
-            var profiledLength = this._profiles.length;
-            for (var i = 0; i < profiledLength; ++i) {
-                var profile = this._profiles[i];
-                delete profile._profileView;
-            }
-        }
+        for (var i = 0; i < this._profiles.length; ++i)
+            delete this._profiles[i]._profileView;
 
         delete this.currentQuery;
         this.searchCanceled();
@@ -147,8 +182,9 @@ WebInspector.ProfilesPanel.prototype = {
 
         this.sidebarTreeElement.removeStyleClass("some-expandable");
 
-        this.profilesListTreeElement.removeChildren();
-        this.snapshotsListTreeElement.removeChildren();
+        for (var typeId in this._profileTypesByIdMap)
+            this.getProfileType(typeId).treeElement.removeChildren();
+
         this.profileViews.removeChildren();
 
         this.profileViewStatusBarItemsContainer.removeChildren();
@@ -161,20 +197,34 @@ WebInspector.ProfilesPanel.prototype = {
         this.sidebarTree.handleKeyEvent(event);
     },
 
-    addProfileHeader: function(profile)
+    registerProfileType: function(profileType)
     {
-        this._profiles.push(profile);
-        this._profilesIdMap[profile.uid] = profile;
+        this._profileTypesByIdMap[profileType.id] = profileType;
+        profileType.treeElement = new WebInspector.SidebarSectionTreeElement(profileType.name, null, true);
+        this.sidebarTree.appendChild(profileType.treeElement);
+        profileType.treeElement.expand();
+    },
+
+    _makeKey: function(text, profileTypeId)
+    {
+        return escape(text) + '/' + escape(profileTypeId);
+    },
 
-        var sidebarParent = this.profilesListTreeElement;
+    addProfileHeader: function(typeId, profile)
+    {
+        var sidebarParent = this.getProfileType(typeId).treeElement;
         var small = false;
         var alternateTitle;
 
+        this._profiles.push(profile);
+        this._profilesIdMap[this._makeKey(profile.uid, typeId)] = profile;
+
         if (profile.title.indexOf(UserInitiatedProfileName) !== 0) {
-            if (!(profile.title in this._profileGroups))
-                this._profileGroups[profile.title] = [];
+            var profileTitleKey = this._makeKey(profile.title, typeId);
+            if (!(profileTitleKey in this._profileGroups))
+                this._profileGroups[profileTitleKey] = [];
 
-            var group = this._profileGroups[profile.title];
+            var group = this._profileGroups[profileTitleKey];
             group.push(profile);
 
             if (group.length === 2) {
@@ -214,6 +264,8 @@ WebInspector.ProfilesPanel.prototype = {
         profile._profilesTreeElement = profileTreeElement;
 
         sidebarParent.appendChild(profileTreeElement);
+        if (!this.visibleView)
+            this.showProfile(profile);
     },
 
     showProfile: function(profile)
@@ -224,7 +276,7 @@ WebInspector.ProfilesPanel.prototype = {
         if (this.visibleView)
             this.visibleView.hide();
 
-        var view = this.profileViewForProfile(profile);
+        var view = profile.viewForProfile();
 
         view.show(this.profileViews);
 
@@ -245,18 +297,28 @@ WebInspector.ProfilesPanel.prototype = {
         this.showProfile(view.profile);
     },
 
-    profileViewForProfile: function(profile)
+    getProfileType: function(typeId)
     {
-        if (!profile)
-            return null;
-        if (!profile._profileView)
-            profile._profileView = new WebInspector.ProfileView(profile);
-        return profile._profileView;
+        return this._profileTypesByIdMap[typeId];
+    },
+
+    showProfileForURL: function(url)
+    {
+        var match = url.match(WebInspector.ProfileType.URLRegExp);
+        if (!match)
+            return;
+        this.showProfile(this._profilesIdMap[this._makeKey(match[3], match[1])]);
     },
 
-    showProfileById: function(uid)
+    updateProfileTypeButtons: function()
     {
-        this.showProfile(this._profilesIdMap[uid]);
+        for (var typeId in this._profileTypeButtonsByIdMap) {
+            var buttonElement = this._profileTypeButtonsByIdMap[typeId];
+            var profileType = this.getProfileType(typeId);
+            buttonElement.className = profileType.buttonStyle;
+            buttonElement.title = profileType.buttonTooltip;
+            // FIXME: Apply profileType.buttonCaption once captions are added to button controls.
+        }
     },
 
     closeVisibleView: function()
@@ -266,16 +328,17 @@ WebInspector.ProfilesPanel.prototype = {
         delete this.visibleView;
     },
 
-    displayTitleForProfileLink: function(title)
+    displayTitleForProfileLink: function(title, typeId)
     {
         title = unescape(title);
         if (title.indexOf(UserInitiatedProfileName) === 0) {
             title = WebInspector.UIString("Profile %d", title.substring(UserInitiatedProfileName.length + 1));
         } else {
-            if (!(title in this._profileGroupsForLinks))
-                this._profileGroupsForLinks[title] = 0;
+            var titleKey = this._makeKey(title, typeId);
+            if (!(titleKey in this._profileGroupsForLinks))
+                this._profileGroupsForLinks[titleKey] = 0;
 
-            groupNumber = ++this._profileGroupsForLinks[title];
+            groupNumber = ++this._profileGroupsForLinks[titleKey];
 
             if (groupNumber > 2)
                 // The title is used in the console message announcing that a profile has started so it gets
@@ -296,7 +359,7 @@ WebInspector.ProfilesPanel.prototype = {
 
         var profilesLength = this._profiles.length;
         for (var i = 0; i < profilesLength; ++i) {
-            var view = this.profileViewForProfile(this._profiles[i]);
+            var view = this._profiles[i].viewForProfile();
             if (!view.performSearch || view === visibleView)
                 continue;
             views.push(view);
@@ -323,19 +386,6 @@ WebInspector.ProfilesPanel.prototype = {
         }
     },
 
-    setRecordingProfile: function(isProfiling)
-    {
-        this.recording = isProfiling;
-
-        if (isProfiling) {
-            this.recordButton.toggled = true;
-            this.recordButton.title = WebInspector.UIString("Stop profiling.");
-        } else {
-            this.recordButton.toggled = false;
-            this.recordButton.title = WebInspector.UIString("Start profiling.");
-        }
-    },
-    
     resize: function()
     {
         var visibleView = this.visibleView;
@@ -345,39 +395,24 @@ WebInspector.ProfilesPanel.prototype = {
 
     _updateInterface: function()
     {
+        // FIXME: Replace ProfileType-specific button visibility changes by a single ProfileType-agnostic "combo-button" visibility change.
         if (InspectorController.profilerEnabled()) {
             this.enableToggleButton.title = WebInspector.UIString("Profiling enabled. Click to disable.");
             this.enableToggleButton.toggled = true;
-            this.recordButton.visible = true;
-            if (Preferences.heapProfilerPresent)
-                this.snapshotButton.visible = true;
+            for (var typeId in this._profileTypeButtonsByIdMap)
+                this._profileTypeButtonsByIdMap[typeId].removeStyleClass("hidden");
             this.profileViewStatusBarItemsContainer.removeStyleClass("hidden");
             this.panelEnablerView.visible = false;
         } else {
             this.enableToggleButton.title = WebInspector.UIString("Profiling disabled. Click to enable.");
             this.enableToggleButton.toggled = false;
-            this.recordButton.visible = false;
-            this.snapshotButton.visible = false;
+            for (var typeId in this._profileTypeButtonsByIdMap)
+                this._profileTypeButtonsByIdMap[typeId].addStyleClass("hidden");
             this.profileViewStatusBarItemsContainer.addStyleClass("hidden");
             this.panelEnablerView.visible = true;
         }
     },
 
-    _recordClicked: function()
-    {
-        this.recording = !this.recording;
-
-        if (this.recording)
-            InspectorController.startProfiling();
-        else
-            InspectorController.stopProfiling();
-    },
-
-    _snapshotClicked: function()
-    {
-        InspectorController.takeHeapSnapshot();
-    },
-
     _enableProfiling: function()
     {
         if (InspectorController.profilerEnabled())
@@ -397,7 +432,7 @@ WebInspector.ProfilesPanel.prototype = {
     {
         // FIXME: This code needs to be adjusted when more profiling types are added.
         // Currently defaults to CPU profiles.
-        var cpuProfiles = this.sidebarTree.children[0];
+        var cpuProfiles = this.getProfileType(WebInspector.CPUProfileType.TypeId).treeElement;
         if (cpuProfiles.children.length)
             return;
 
@@ -406,8 +441,6 @@ WebInspector.ProfilesPanel.prototype = {
             var profileHeadersLength = profileHeaders.length;
             for (var i = 0; i < profileHeadersLength; ++i)
                 WebInspector.addProfileHeader(profileHeaders[i]);
-            if (cpuProfiles.children[0])
-                cpuProfiles.children[0].select();
         }
 
         var callId = WebInspector.Callback.wrap(populateCallback);
diff --git a/WebCore/inspector/front-end/inspector.js b/WebCore/inspector/front-end/inspector.js
index 909a5b6..81d4cfb 100644
--- a/WebCore/inspector/front-end/inspector.js
+++ b/WebCore/inspector/front-end/inspector.js
@@ -139,8 +139,10 @@ var WebInspector = {
             this.panels.resources = new WebInspector.ResourcesPanel();
         if (hiddenPanels.indexOf("scripts") === -1)
             this.panels.scripts = new WebInspector.ScriptsPanel();
-        if (hiddenPanels.indexOf("profiles") === -1)
+        if (hiddenPanels.indexOf("profiles") === -1) {
             this.panels.profiles = new WebInspector.ProfilesPanel();
+            this.panels.profiles.registerProfileType(new WebInspector.CPUProfileType());
+        }
         if (hiddenPanels.indexOf("storage") === -1 && hiddenPanels.indexOf("databases") === -1)
             this.panels.storage = new WebInspector.StoragePanel();      
     },
@@ -554,10 +556,9 @@ WebInspector.documentClick = function(event)
 
             WebInspector.showResourceForURL(anchor.href, anchor.lineNumber, anchor.preferredPanel);
         } else {
-            var profileStringRegEx = new RegExp("webkit-profile://.+/.+#([0-9]+)");
-            var profileString = profileStringRegEx.exec(anchor.href);
+            var profileString = WebInspector.ProfileType.URLRegExp.exec(anchor.href);
             if (profileString)
-                WebInspector.showProfileById(profileString[1])
+                WebInspector.showProfileForURL(anchor.href);
         }
     }
 
@@ -1264,12 +1265,13 @@ WebInspector.log = function(message)
 
 WebInspector.addProfileHeader = function(profile)
 {
-    this.panels.profiles.addProfileHeader(profile);
+    this.panels.profiles.addProfileHeader(WebInspector.CPUProfileType.TypeId, new WebInspector.CPUProfile(profile));
 }
 
 WebInspector.setRecordingProfile = function(isProfiling)
 {
-    this.panels.profiles.setRecordingProfile(isProfiling);
+    this.panels.profiles.getProfileType(WebInspector.CPUProfileType.TypeId).setRecordingProfile(isProfiling);
+    this.panels.profiles.updateProfileTypeButtons();
 }
 
 WebInspector.drawLoadingPieChart = function(canvas, percent) {
@@ -1375,13 +1377,9 @@ WebInspector.linkifyStringAsFragment = function(string)
         var nonLink = string.substring(0, linkIndex);
         container.appendChild(document.createTextNode(nonLink));
 
-        var profileStringRegEx = new RegExp("webkit-profile://.+/(.+)#[0-9]+");
-        var profileStringMatches = profileStringRegEx.exec(title);
-        var profileTitle;
+        var profileStringMatches = WebInspector.ProfileType.URLRegExp.exec(title);
         if (profileStringMatches)
-            profileTitle = profileStringMatches[1];
-        if (profileTitle)
-            title = WebInspector.panels.profiles.displayTitleForProfileLink(profileTitle);
+            title = WebInspector.panels.profiles.displayTitleForProfileLink(profileStringMatches[2], profileStringMatches[1]);
 
         var realURL = (linkString.indexOf("www.") === 0 ? "http://" + linkString : linkString);
         container.appendChild(WebInspector.linkifyURLAsNode(realURL, title, null, (realURL in WebInspector.resourceURLMap)));
@@ -1394,9 +1392,9 @@ WebInspector.linkifyStringAsFragment = function(string)
     return container;
 }
 
-WebInspector.showProfileById = function(uid) {
+WebInspector.showProfileForURL = function(url) {
     WebInspector.showProfilesPanel();
-    WebInspector.panels.profiles.showProfileById(uid);
+    WebInspector.panels.profiles.showProfileForURL(url);
 }
 
 WebInspector.linkifyURLAsNode = function(url, linkText, classes, isExternal)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list