Web Inspector: Change profile start button caption depending on profile type.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Mar 2013 15:28:32 +0000 (15:28 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 7 Mar 2013 15:28:32 +0000 (15:28 +0000)
https://bugs.webkit.org/show_bug.cgi?id=111698

Change the start profiling button caption to "Snapshot" for
snapshot-like profile types, e.g. JS heap snapshot, native memory snapshot.

Patch by Alexei Filippov <alph@chromium.org> on 2013-03-07
Reviewed by Yury Semikhatsky.

* English.lproj/localizedStrings.js:
* inspector/front-end/HeapSnapshotView.js:
(WebInspector.HeapSnapshotProfileType.prototype.isInstantProfile):
* inspector/front-end/NativeMemorySnapshotView.js:
(WebInspector.NativeSnapshotProfileType.prototype.isInstantProfile):
(WebInspector.NativeMemoryProfileType.prototype.isInstantProfile):
* inspector/front-end/ProfileLauncherView.js:
(WebInspector.ProfileLauncherView):
(WebInspector.ProfileLauncherView.prototype.addProfileType):
(WebInspector.ProfileLauncherView.prototype._updateControls):
(WebInspector.MultiProfileLauncherView.prototype._updateControls):
(WebInspector.MultiProfileLauncherView.prototype._profileTypeChanged):
* inspector/front-end/ProfilesPanel.js:
(WebInspector.ProfileType.prototype.isInstantProfile):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@145074 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/English.lproj/localizedStrings.js
Source/WebCore/inspector/front-end/HeapSnapshotView.js
Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js
Source/WebCore/inspector/front-end/ProfileLauncherView.js
Source/WebCore/inspector/front-end/ProfilesPanel.js

index 75cf3f4..a24847a 100644 (file)
@@ -1,3 +1,28 @@
+2013-03-07  Alexei Filippov  <alph@chromium.org>
+
+        Web Inspector: Change profile start button caption depending on profile type.
+        https://bugs.webkit.org/show_bug.cgi?id=111698
+
+        Change the start profiling button caption to "Snapshot" for
+        snapshot-like profile types, e.g. JS heap snapshot, native memory snapshot.
+
+        Reviewed by Yury Semikhatsky.
+
+        * English.lproj/localizedStrings.js:
+        * inspector/front-end/HeapSnapshotView.js:
+        (WebInspector.HeapSnapshotProfileType.prototype.isInstantProfile):
+        * inspector/front-end/NativeMemorySnapshotView.js:
+        (WebInspector.NativeSnapshotProfileType.prototype.isInstantProfile):
+        (WebInspector.NativeMemoryProfileType.prototype.isInstantProfile):
+        * inspector/front-end/ProfileLauncherView.js:
+        (WebInspector.ProfileLauncherView):
+        (WebInspector.ProfileLauncherView.prototype.addProfileType):
+        (WebInspector.ProfileLauncherView.prototype._updateControls):
+        (WebInspector.MultiProfileLauncherView.prototype._updateControls):
+        (WebInspector.MultiProfileLauncherView.prototype._profileTypeChanged):
+        * inspector/front-end/ProfilesPanel.js:
+        (WebInspector.ProfileType.prototype.isInstantProfile):
+
 2013-03-07  Bruno de Oliveira Abinader  <bruno.abinader@basyskom.com>
 
         [texmap] Remove direct access to clip state from clip stack
index b0f2a21..99d4dec 100644 (file)
@@ -423,6 +423,7 @@ localizedStrings["Stylesheet"] = "Stylesheet";
 localizedStrings["Stylesheets"] = "Stylesheets";
 localizedStrings["Swap dimensions"] = "Swap dimensions";
 localizedStrings["Subtree Modified"] = "Subtree Modified";
+localizedStrings["Take Snapshot"] = "Take Snapshot";
 localizedStrings["Take heap snapshot."] = "Take heap snapshot.";
 localizedStrings["Take Heap Snapshot"] = "Take Heap Snapshot";
 localizedStrings["The breakpoint on line %d will stop only if this expression is true:"] = "The breakpoint on line %d will stop only if this expression is true:";
index f14dca3..5d0e8c8 100644 (file)
@@ -774,6 +774,15 @@ WebInspector.HeapSnapshotProfileType.prototype = {
      * @override
      * @return {boolean}
      */
+    isInstantProfile: function()
+    {
+        return true;
+    },
+
+    /**
+     * @override
+     * @return {boolean}
+     */
     buttonClicked: function()
     {
         this._takeHeapSnapshot();
index 70fcd71..17adcb3 100644 (file)
@@ -256,6 +256,15 @@ WebInspector.NativeSnapshotProfileType.prototype = {
      * @override
      * @return {boolean}
      */
+    isInstantProfile: function()
+    {
+        return true;
+    },
+
+    /**
+     * @override
+     * @return {boolean}
+     */
     buttonClicked: function()
     {
         var profileHeader = new WebInspector.NativeSnapshotProfileHeader(this, WebInspector.UIString("Snapshot %d", this._nextProfileUid), this._nextProfileUid);
@@ -455,6 +464,15 @@ WebInspector.NativeMemoryProfileType.prototype = {
      * @override
      * @return {boolean}
      */
+    isInstantProfile: function()
+    {
+        return true;
+    },
+
+    /**
+     * @override
+     * @return {boolean}
+     */
     buttonClicked: function()
     {
         var profileHeader = new WebInspector.NativeMemoryProfileHeader(this, WebInspector.UIString("Snapshot %d", this._nextProfileUid), this._nextProfileUid);
index baa7cb4..af301ac 100644 (file)
@@ -38,7 +38,6 @@ WebInspector.ProfileLauncherView = function(profilesPanel)
     WebInspector.View.call(this);
 
     this._panel = profilesPanel;
-    this._profileRunning = false;
 
     this.element.addStyleClass("profile-launcher-view");
     this.element.addStyleClass("panel-enabler-view");
@@ -61,6 +60,7 @@ WebInspector.ProfileLauncherView.prototype = {
         var decorationElement = profileType.decorationElement();
         if (decorationElement)
             this._innerContentElement.appendChild(decorationElement);
+        this._isInstantProfile = profileType.isInstantProfile();
     },
 
     _controlButtonClicked: function()
@@ -70,7 +70,10 @@ WebInspector.ProfileLauncherView.prototype = {
 
     _updateControls: function()
     {
-        if (this._isProfiling) {
+        if (this._isInstantProfile) {
+            this._controlButton.removeStyleClass("running");
+            this._controlButton.textContent = WebInspector.UIString("Take Snapshot");
+        } else if (this._isProfiling) {
             this._controlButton.addStyleClass("running");
             this._controlButton.textContent = WebInspector.UIString("Stop");
         } else {
@@ -150,13 +153,7 @@ WebInspector.MultiProfileLauncherView.prototype = {
 
     _updateControls: function()
     {
-        if (this._isProfiling) {
-            this._controlButton.addStyleClass("running");
-            this._controlButton.textContent = WebInspector.UIString("Stop");
-        } else {
-            this._controlButton.removeStyleClass("running");
-            this._controlButton.textContent = WebInspector.UIString("Start");
-        }
+        WebInspector.ProfileLauncherView.prototype._updateControls.call(this);
         var items = this._profileTypeSelectorForm.elements;
         for (var i = 0; i < items.length; ++i) {
             if (items[i].type === "radio")
@@ -170,6 +167,8 @@ WebInspector.MultiProfileLauncherView.prototype = {
     _profileTypeChanged: function(profileType, event)
     {
         this.dispatchEventToListeners(WebInspector.MultiProfileLauncherView.EventTypes.ProfileTypeSelected, profileType);
+        this._isInstantProfile = profileType.isInstantProfile();
+        this._updateControls();
     },
 
     profileStarted: function()
index 1b40ec4..fc609f0 100644 (file)
@@ -89,6 +89,14 @@ WebInspector.ProfileType.prototype = {
     },
 
     /**
+     * @return {boolean}
+     */
+    isInstantProfile: function()
+    {
+        return false;
+    },
+
+    /**
      * @return {!Array.<!WebInspector.ProfileHeader>}
      */
     getProfiles: function()