Diff
Modified: trunk/LayoutTests/ChangeLog (143158 => 143159)
--- trunk/LayoutTests/ChangeLog 2013-02-18 07:47:23 UTC (rev 143158)
+++ trunk/LayoutTests/ChangeLog 2013-02-18 07:51:52 UTC (rev 143159)
@@ -1,3 +1,12 @@
+2013-02-15 Eugene Klyuchnikov <[email protected]>
+
+ Web Inspector: Introduce ProfilesPanelDescriptor.
+ https://bugs.webkit.org/show_bug.cgi?id=109906
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/profiler/heap-snapshot-test.js: Adopted changes.
+
2013-02-17 Takashi Toyoshima <[email protected]>
Unreviewed, update test expectation for chromium.
Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js (143158 => 143159)
--- trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js 2013-02-18 07:47:23 UTC (rev 143158)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js 2013-02-18 07:51:52 UTC (rev 143159)
@@ -722,7 +722,7 @@
var snapshot = generator();
var profileType = WebInspector.panels.profiles.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId);
var profile = ""
- title: UserInitiatedProfileName + "." + uid,
+ title: WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName + "." + uid,
uid: uid,
maxJSObjectId: snapshot.maxJSObjectId
});
Modified: trunk/Source/WebCore/ChangeLog (143158 => 143159)
--- trunk/Source/WebCore/ChangeLog 2013-02-18 07:47:23 UTC (rev 143158)
+++ trunk/Source/WebCore/ChangeLog 2013-02-18 07:51:52 UTC (rev 143159)
@@ -1,3 +1,29 @@
+2013-02-15 Eugene Klyuchnikov <[email protected]>
+
+ Web Inspector: Introduce ProfilesPanelDescriptor.
+ https://bugs.webkit.org/show_bug.cgi?id=109906
+
+ Reviewed by Pavel Feldman.
+
+ Some constants/methods should be accesible before ProfilesPanel
+ is instantiated.
+
+ Extracted methods to check if profile is "user-initiated" and what is
+ its index.
+
+ Also profile URL regexp moved to ProfilesPanelDescriptor.
+
+ * inspector/front-end/ProfilesPanelDescriptor.js: Added.
+ * WebCore.gypi: Added ProfilesPanelDescriptor.js
+ * WebCore.vcproj/WebCore.vcproj: Ditto.
+ * inspector/compile-front-end.py: Ditto.
+ * inspector/front-end/WebKit.qrc: Ditto.
+ * inspector/front-end/inspector.html: Ditto.
+ * inspector/front-end/HeapSnapshotView.js: Adopted changes.
+ * inspector/front-end/ProfilesPanel.js: Ditto.
+ * inspector/front-end/externs.js: Ditto.
+ * inspector/front-end/inspector.js: Ditto.
+
2013-02-17 Dimitri Glazkov <[email protected]>
Stop passing around SelectorChecker in SelectorQuery, now that it's stack-allocated.
Modified: trunk/Source/WebCore/WebCore.gypi (143158 => 143159)
--- trunk/Source/WebCore/WebCore.gypi 2013-02-18 07:47:23 UTC (rev 143158)
+++ trunk/Source/WebCore/WebCore.gypi 2013-02-18 07:51:52 UTC (rev 143159)
@@ -5254,6 +5254,7 @@
'inspector/front-end/Placard.js',
'inspector/front-end/Popover.js',
'inspector/front-end/PresentationConsoleMessageHelper.js',
+ 'inspector/front-end/ProfilesPanelDescriptor.js',
'inspector/front-end/Progress.js',
'inspector/front-end/ProgressIndicator.js',
'inspector/front-end/PropertiesSection.js',
Modified: trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj (143158 => 143159)
--- trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2013-02-18 07:47:23 UTC (rev 143158)
+++ trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj 2013-02-18 07:51:52 UTC (rev 143159)
@@ -77626,6 +77626,10 @@
>
</File>
<File
+ RelativePath="..\inspector\front-end\ProfilesPanelDescriptor.js"
+ >
+ </File>
+ <File
RelativePath="..\inspector\front-end\Progress.js"
>
</File>
Modified: trunk/Source/WebCore/inspector/compile-front-end.py (143158 => 143159)
--- trunk/Source/WebCore/inspector/compile-front-end.py 2013-02-18 07:47:23 UTC (rev 143158)
+++ trunk/Source/WebCore/inspector/compile-front-end.py 2013-02-18 07:51:52 UTC (rev 143159)
@@ -348,6 +348,7 @@
"NativeMemorySnapshotView.js",
"ProfileDataGridTree.js",
"ProfilesPanel.js",
+ "ProfilesPanelDescriptor.js",
"ProfileLauncherView.js",
"TopDownProfileDataGridTree.js",
"CanvasProfileView.js",
Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js (143158 => 143159)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js 2013-02-18 07:47:23 UTC (rev 143158)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js 2013-02-18 07:51:52 UTC (rev 143159)
@@ -698,8 +698,8 @@
for (var i = this.baseSelectElement.length, n = list.length; i < n; ++i) {
var baseOption = document.createElement("option");
var title = list[i].title;
- if (!title.indexOf(UserInitiatedProfileName))
- title = WebInspector.UIString("Snapshot %d", title.substring(UserInitiatedProfileName.length + 1));
+ if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title))
+ title = WebInspector.UIString("Snapshot %d", WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex(title));
baseOption.label = title;
this.baseSelectElement.appendChild(baseOption);
}
@@ -724,11 +724,12 @@
var profile = ""
var filterOption = document.createElement("option");
var title = list[i].title;
- if (!title.indexOf(UserInitiatedProfileName)) {
+ if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title)) {
+ var profileIndex = WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex(title);
if (!i)
- title = WebInspector.UIString("Objects allocated before Snapshot %d", title.substring(UserInitiatedProfileName.length + 1));
+ title = WebInspector.UIString("Objects allocated before Snapshot %d", profileIndex);
else
- title = WebInspector.UIString("Objects allocated between Snapshots %d and %d", title.substring(UserInitiatedProfileName.length + 1) - 1, title.substring(UserInitiatedProfileName.length + 1));
+ title = WebInspector.UIString("Objects allocated between Snapshots %d and %d", profileIndex - 1, profileIndex);
}
filterOption.label = title;
this.filterSelectElement.appendChild(filterOption);
Modified: trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js (143158 => 143159)
--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2013-02-18 07:47:23 UTC (rev 143158)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js 2013-02-18 07:51:52 UTC (rev 143159)
@@ -340,7 +340,7 @@
}
var profileType = this.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId);
- var temporaryProfile = profileType.createTemporaryProfile(UserInitiatedProfileName + "." + file.name);
+ var temporaryProfile = profileType.createTemporaryProfile(WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName + "." + file.name);
this.addProfileHeader(temporaryProfile);
temporaryProfile._fromFile = true;
@@ -556,7 +556,7 @@
this._profiles.push(profile);
this._profilesIdMap[this._makeKey(profile.uid, typeId)] = profile;
- if (!profile.title.startsWith(UserInitiatedProfileName)) {
+ if (!WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(profile.title)) {
var profileTitleKey = this._makeTitleKey(profile.title, typeId);
if (!(profileTitleKey in this._profileGroups))
this._profileGroups[profileTitleKey] = [];
@@ -789,7 +789,7 @@
*/
showProfileForURL: function(url)
{
- var match = url.match(WebInspector.ProfileURLRegExp);
+ var match = url.match(WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp);
if (!match)
return;
this.showProfile(this._profilesIdMap[this._makeKey(Number(match[3]), match[1])]);
@@ -1395,8 +1395,8 @@
this.profile = ""
this._titleFormat = titleFormat;
- if (this.profile.title.startsWith(UserInitiatedProfileName))
- this._profileNumber = this.profile.title.substring(UserInitiatedProfileName.length + 1);
+ if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(this.profile.title))
+ this._profileNumber = WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex(this.profile.title);
WebInspector.SidebarTreeElement.call(this, className, "", "", profile, false);
@@ -1420,7 +1420,7 @@
{
if (this._mainTitle)
return this._mainTitle;
- if (this.profile.title.startsWith(UserInitiatedProfileName))
+ if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(this.profile.title))
return WebInspector.UIString(this._titleFormat, this._profileNumber);
return this.profile.title;
},
Added: trunk/Source/WebCore/inspector/front-end/ProfilesPanelDescriptor.js (0 => 143159)
--- trunk/Source/WebCore/inspector/front-end/ProfilesPanelDescriptor.js (rev 0)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanelDescriptor.js 2013-02-18 07:51:52 UTC (rev 143159)
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2013 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 GOOGLE INC. AND ITS CONTRIBUTORS
+ * "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 GOOGLE INC.
+ * OR ITS 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.PanelDescriptor}
+ */
+WebInspector.ProfilesPanelDescriptor = function()
+{
+ WebInspector.PanelDescriptor.call(this, "profiles", WebInspector.UIString("Profiles"), "ProfilesPanel", "ProfilesPanel.js");
+}
+
+WebInspector.ProfilesPanelDescriptor.prototype = {
+ __proto__: WebInspector.PanelDescriptor.prototype
+}
+
+WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp = /webkit-profile:\/\/(.+)\/(.+)#([0-9]+)/;
+
+WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName = "org.webkit.profiles.user-initiated";
+
+/**
+ * @param {string} title
+ * @return {boolean}
+ */
+WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile = function(title)
+{
+ return title.startsWith(WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName);
+}
+
+/**
+ * @param {string} title
+ * @return {number}
+ * @throw {string}
+ */
+WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex = function(title)
+{
+ if (!WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title))
+ throw "Not user-initiated profile title.";
+ var suffix = title.substring(WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName.length + 1);
+ return parseInt(suffix, 10);
+}
Modified: trunk/Source/WebCore/inspector/front-end/WebKit.qrc (143158 => 143159)
--- trunk/Source/WebCore/inspector/front-end/WebKit.qrc 2013-02-18 07:47:23 UTC (rev 143158)
+++ trunk/Source/WebCore/inspector/front-end/WebKit.qrc 2013-02-18 07:51:52 UTC (rev 143159)
@@ -139,6 +139,7 @@
<file>ProfileDataGridTree.js</file>
<file>ProfileLauncherView.js</file>
<file>ProfilesPanel.js</file>
+ <file>ProfilesPanelDescriptor.js</file>
<file>Progress.js</file>
<file>ProgressIndicator.js</file>
<file>PropertiesSection.js</file>
Modified: trunk/Source/WebCore/inspector/front-end/externs.js (143158 => 143159)
--- trunk/Source/WebCore/inspector/front-end/externs.js 2013-02-18 07:47:23 UTC (rev 143158)
+++ trunk/Source/WebCore/inspector/front-end/externs.js 2013-02-18 07:51:52 UTC (rev 143159)
@@ -329,8 +329,5 @@
/** @constructor */
WebInspector.CodeMirrorTextEditor = function(url, delegate) { }
-WebInspector.ProfileURLRegExp = "";
-
-
/** @type {boolean} */
window.dispatchStandaloneTestRunnerMessages;
Modified: trunk/Source/WebCore/inspector/front-end/inspector.html (143158 => 143159)
--- trunk/Source/WebCore/inspector/front-end/inspector.html 2013-02-18 07:47:23 UTC (rev 143158)
+++ trunk/Source/WebCore/inspector/front-end/inspector.html 2013-02-18 07:51:52 UTC (rev 143159)
@@ -177,6 +177,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/inspector.js (143158 => 143159)
--- trunk/Source/WebCore/inspector/front-end/inspector.js 2013-02-18 07:47:23 UTC (rev 143158)
+++ trunk/Source/WebCore/inspector/front-end/inspector.js 2013-02-18 07:51:52 UTC (rev 143159)
@@ -42,7 +42,7 @@
var network = new WebInspector.NetworkPanelDescriptor();
var scripts = new WebInspector.ScriptsPanelDescriptor();
var timeline = new WebInspector.TimelinePanelDescriptor();
- var profiles = new WebInspector.PanelDescriptor("profiles", WebInspector.UIString("Profiles"), "ProfilesPanel", "ProfilesPanel.js");
+ var profiles = new WebInspector.ProfilesPanelDescriptor();
var audits = new WebInspector.PanelDescriptor("audits", WebInspector.UIString("Audits"), "AuditsPanel", "AuditsPanel.js");
var console = new WebInspector.PanelDescriptor("console", WebInspector.UIString("Console"), "ConsolePanel");
var allDescriptors = [elements, resources, network, scripts, timeline, profiles, audits, console];
@@ -274,7 +274,7 @@
_profilesLinkifier: function(title)
{
- var profileStringMatches = WebInspector.ProfileURLRegExp.exec(title);
+ var profileStringMatches = WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp.exec(title);
if (profileStringMatches) {
var profilesPanel = /** @ type {WebInspector.ProfilesPanel} */ WebInspector.panel("profiles");
title = WebInspector.ProfilesPanel._instance.displayTitleForProfileLink(profileStringMatches[2], profileStringMatches[1]);
@@ -582,7 +582,7 @@
WebInspector.documentClick = function(event)
{
var anchor = event.target.enclosingNodeOrSelfWithNodeName("a");
- if (!anchor || (anchor.target === "_blank" && !WebInspector.ProfileURLRegExp.exec(anchor.href)))
+ if (!anchor || (anchor.target === "_blank" && !WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp.exec(anchor.href)))
return;
// Prevent the link from navigating, since we don't do any navigation by following links normally.
@@ -593,7 +593,7 @@
if (WebInspector.isBeingEdited(event.target) || WebInspector._showAnchorLocation(anchor))
return;
- const profileMatch = WebInspector.ProfileURLRegExp.exec(anchor.href);
+ const profileMatch = WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp.exec(anchor.href);
if (profileMatch) {
WebInspector.showProfileForURL(anchor.href);
return;
@@ -1004,8 +1004,6 @@
doc.addEventListener("click", this.documentClick.bind(this), true);
}
-WebInspector.ProfileURLRegExp = /webkit-profile:\/\/(.+)\/(.+)#([0-9]+)/;
-
WebInspector.Zoom = {
Table: [0.25, 0.33, 0.5, 0.66, 0.75, 0.9, 1, 1.1, 1.25, 1.5, 1.75, 2, 2.5, 3, 4, 5],
DefaultOffset: 6