Title: [135599] trunk/Source/WebCore
Revision
135599
Author
[email protected]
Date
2012-11-23 05:25:18 -0800 (Fri, 23 Nov 2012)

Log Message

Web Inspector: Refine JsDoc in ProfilesPanel.js
https://bugs.webkit.org/show_bug.cgi?id=103042

Patch by Eugene Klyuchnikov <[email protected]> on 2012-11-23
Reviewed by Yury Semikhatsky.

I'm going to make profiler output typed.

This will require some amount of refactoring.

Before refactoring I would like to make things
unambiguous by adding JsDoc where they are missing.

* inspector/front-end/ProfilesPanel.js:
(WebInspector.ProfilesPanel.prototype._onToggleProfiling):
Added to eliminate parameter type ambiguity.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (135598 => 135599)


--- trunk/Source/WebCore/ChangeLog	2012-11-23 13:11:46 UTC (rev 135598)
+++ trunk/Source/WebCore/ChangeLog	2012-11-23 13:25:18 UTC (rev 135599)
@@ -1,3 +1,21 @@
+2012-11-23  Eugene Klyuchnikov  <[email protected]>
+
+        Web Inspector: Refine JsDoc in ProfilesPanel.js
+        https://bugs.webkit.org/show_bug.cgi?id=103042
+
+        Reviewed by Yury Semikhatsky.
+
+        I'm going to make profiler output typed.
+
+        This will require some amount of refactoring.
+
+        Before refactoring I would like to make things
+        unambiguous by adding JsDoc where they are missing.
+
+        * inspector/front-end/ProfilesPanel.js:
+        (WebInspector.ProfilesPanel.prototype._onToggleProfiling):
+        Added to eliminate parameter type ambiguity.
+
 2012-11-23  Kent Tamura  <[email protected]>
 
         Correct input[type=number] value sanitization for user-input

Modified: trunk/Source/WebCore/inspector/front-end/CPUProfileView.js (135598 => 135599)


--- trunk/Source/WebCore/inspector/front-end/CPUProfileView.js	2012-11-23 13:11:46 UTC (rev 135598)
+++ trunk/Source/WebCore/inspector/front-end/CPUProfileView.js	2012-11-23 13:25:18 UTC (rev 135599)
@@ -630,7 +630,7 @@
 /**
  * @constructor
  * @extends {WebInspector.ProfileHeader}
- * @param {WebInspector.CPUProfileType} type
+ * @param {!WebInspector.CPUProfileType} type
  * @param {string} title
  * @param {number=} uid
  */

Modified: trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js (135598 => 135599)


--- trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js	2012-11-23 13:11:46 UTC (rev 135598)
+++ trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js	2012-11-23 13:25:18 UTC (rev 135599)
@@ -373,7 +373,7 @@
 /**
  * @constructor
  * @extends {WebInspector.ProfileHeader}
- * @param {WebInspector.CSSSelectorProfileType} type
+ * @param {!WebInspector.CSSSelectorProfileType} type
  * @param {string} title
  * @param {number=} uid
  * @param {CSSAgent.SelectorProfile=} protocolData

Modified: trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js (135598 => 135599)


--- trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js	2012-11-23 13:11:46 UTC (rev 135598)
+++ trunk/Source/WebCore/inspector/front-end/CanvasProfileView.js	2012-11-23 13:25:18 UTC (rev 135599)
@@ -276,7 +276,7 @@
 /**
  * @constructor
  * @extends {WebInspector.ProfileHeader}
- * @param {WebInspector.CanvasProfileType} type
+ * @param {!WebInspector.CanvasProfileType} type
  * @param {string} title
  * @param {number=} uid
  */

Modified: trunk/Source/WebCore/inspector/front-end/FileUtils.js (135598 => 135599)


--- trunk/Source/WebCore/inspector/front-end/FileUtils.js	2012-11-23 13:11:46 UTC (rev 135598)
+++ trunk/Source/WebCore/inspector/front-end/FileUtils.js	2012-11-23 13:25:18 UTC (rev 135599)
@@ -295,7 +295,7 @@
 }
 
 /**
- * @param {function(File)} callback
+ * @param {function(!File)} callback
  * @return {Node}
  */
 WebInspector.createFileSelectorElement = function(callback) {

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js (135598 => 135599)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js	2012-11-23 13:11:46 UTC (rev 135598)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotDataGrids.js	2012-11-23 13:25:18 UTC (rev 135599)
@@ -585,7 +585,7 @@
         this.snapshot.aggregates(false, key, filter, this._aggregatesReceived.bind(this, key));
     },
 
-    _filterSelectIndexChanged: function(profiles, profileIndex)
+    filterSelectIndexChanged: function(profiles, profileIndex)
     {
         this._profileIndex = profileIndex;
 

Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js (135598 => 135599)


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js	2012-11-23 13:11:46 UTC (rev 135598)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js	2012-11-23 13:25:18 UTC (rev 135599)
@@ -386,7 +386,7 @@
     _changeFilter: function()
     {
         var profileIndex = this.filterSelectElement.selectedIndex - 1;
-        this.dataGrid._filterSelectIndexChanged(this._profiles(), profileIndex);
+        this.dataGrid.filterSelectIndexChanged(this._profiles(), profileIndex);
 
         if (!this.currentQuery || !this._searchFinishedCallback || !this._searchResults)
             return;
@@ -416,6 +416,9 @@
         this.dataGrid.changeNameFilter(filter);
     },
 
+    /**
+     * @return {!Array.<!WebInspector.ProfileHeader>}
+     */
     _profiles: function()
     {
         return this.parent.getProfiles(WebInspector.HeapSnapshotProfileType.TypeId);
@@ -803,7 +806,7 @@
 /**
  * @constructor
  * @extends {WebInspector.ProfileHeader}
- * @param {WebInspector.HeapSnapshotProfileType} type
+ * @param {!WebInspector.HeapSnapshotProfileType} type
  * @param {string} title
  * @param {number=} uid
  * @param {number=} maxJSObjectId

Modified: trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js (135598 => 135599)


--- trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js	2012-11-23 13:11:46 UTC (rev 135598)
+++ trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js	2012-11-23 13:25:18 UTC (rev 135599)
@@ -259,7 +259,7 @@
 /**
  * @constructor
  * @extends {WebInspector.ProfileHeader}
- * @param {WebInspector.NativeMemoryProfileType} type
+ * @param {!WebInspector.NativeMemoryProfileType} type
  * @param {string} title
  * @param {number=} uid
  */

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


--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2012-11-23 13:11:46 UTC (rev 135598)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2012-11-23 13:25:18 UTC (rev 135599)
@@ -27,6 +27,8 @@
 
 /**
  * @constructor
+ * @param {string} id
+ * @param {string} name
  */
 WebInspector.ProfileType = function(id, name)
 {
@@ -99,7 +101,7 @@
 
 /**
  * @constructor
- * @param {WebInspector.ProfileType} profileType
+ * @param {!WebInspector.ProfileType} profileType
  * @param {string} title
  * @param {number=} uid
  */
@@ -118,6 +120,9 @@
 }
 
 WebInspector.ProfileHeader.prototype = {
+    /**
+     * @return {!WebInspector.ProfileType}
+     */
     profileType: function()
     {
         return this._profileType;
@@ -132,11 +137,17 @@
         throw new Error("Needs implemented.");
     },
 
+    /**
+     * @return {?WebInspector.View}
+     */
     existingView: function()
     {
         return this._view;
     },
 
+    /**
+     * @return {!WebInspector.View}
+     */
     view: function()
     {
         if (!this._view)
@@ -146,6 +157,7 @@
 
     /**
      * @param {WebInspector.ProfilesPanel} profilesPanel
+     * @return {!WebInspector.View}
      */
     createView: function(profilesPanel)
     {
@@ -215,7 +227,7 @@
     this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
     if (Capabilities.profilerCausesRecompilation) {
         this._statusBarButtons.push(this.enableToggleButton);
-        this.enableToggleButton.addEventListener("click", this._toggleProfiling, this);
+        this.enableToggleButton.addEventListener("click", this._onToggleProfiling, this);
     }
     this.recordButton = new WebInspector.StatusBarButton("", "record-profile-status-bar-item");
     this.recordButton.addEventListener("click", this.toggleRecordButton, this);
@@ -268,6 +280,9 @@
         this.element.appendChild(this._fileSelectorElement);
     },
 
+    /**
+     * @param {!File} file
+     */
     _loadFromFile: function(file)
     {
         if (!file.name.endsWith(".heapsnapshot")) {
@@ -332,9 +347,12 @@
         this._reset();
     },
 
+    /**
+     * @param {WebInspector.Event} event
+     */
     _onProfileTypeSelected: function(event)
     {
-        this._selectedProfileType = event.data;
+        this._selectedProfileType = /** @type {!WebInspector.ProfileType} */ (event.data);
         this.recordButton.title = this._selectedProfileType.buttonTooltip;
     },
 
@@ -417,6 +435,9 @@
         profileType.treeElement.childrenListElement.addEventListener("contextmenu", this._handleContextMenuEvent.bind(this), true);
     },
 
+    /**
+     * @param {Event} event
+     */
     _handleContextMenuEvent: function(event)
     {
         var element = event.srcElement;
@@ -590,7 +611,7 @@
 
     /**
      * @param {string} typeId
-     * @return {Array.<WebInspector.ProfileHeader>}
+     * @return {!Array.<!WebInspector.ProfileHeader>}
      */
     getProfiles: function(typeId)
     {
@@ -981,13 +1002,23 @@
         this._toggleProfiling(this.panelEnablerView.alwaysEnabled);
     },
 
-    _toggleProfiling: function(optionalAlways)
+    /**
+     * @param {WebInspector.Event} event
+     */
+    _onToggleProfiling: function(event) {
+        this._toggleProfiling(true);
+    },
+
+    /**
+     * @param {boolean} always
+     */
+    _toggleProfiling: function(always)
     {
         if (this._profilerEnabled) {
             WebInspector.settings.profilerEnabled.set(false);
             ProfilerAgent.disable(this._profilerWasDisabled.bind(this));
         } else {
-            WebInspector.settings.profilerEnabled.set(!!optionalAlways);
+            WebInspector.settings.profilerEnabled.set(always);
             ProfilerAgent.enable(this._profilerWasEnabled.bind(this));
         }
     },
@@ -1018,6 +1049,9 @@
         this._profilesWereRequested = true;
     },
 
+    /**
+     * @param {!WebInspector.Event} event
+     */
     sidebarResized: function(event)
     {
         this.onResize();
@@ -1125,10 +1159,11 @@
 /**
  * @constructor
  * @implements {ProfilerAgent.Dispatcher}
+ * @param {WebInspector.ProfilesPanel} profilesPanel
  */
-WebInspector.ProfilerDispatcher = function(profiler)
+WebInspector.ProfilerDispatcher = function(profilesPanel)
 {
-    this._profiler = profiler;
+    this._profilesPanel = profilesPanel;
 }
 
 WebInspector.ProfilerDispatcher.prototype = {
@@ -1137,8 +1172,8 @@
      */
     addProfileHeader: function(profile)
     {
-        var profileType = this._profiler.getProfileType(profile.typeId);
-        this._profiler.addProfileHeader(profileType.createProfile(profile));
+        var profileType = this._profilesPanel.getProfileType(profile.typeId);
+        this._profilesPanel.addProfileHeader(profileType.createProfile(profile));
     },
 
     /**
@@ -1148,7 +1183,7 @@
      */
     addHeapSnapshotChunk: function(uid, chunk)
     {
-        this._profiler._addHeapSnapshotChunk(uid, chunk);
+        this._profilesPanel._addHeapSnapshotChunk(uid, chunk);
     },
 
     /**
@@ -1157,7 +1192,7 @@
      */
     finishHeapSnapshot: function(uid)
     {
-        this._profiler._finishHeapSnapshot(uid);
+        this._profilesPanel._finishHeapSnapshot(uid);
     },
 
     /**
@@ -1166,7 +1201,7 @@
      */
     setRecordingProfile: function(isProfiling)
     {
-        this._profiler.setRecordingProfile(WebInspector.CPUProfileType.TypeId, isProfiling);
+        this._profilesPanel.setRecordingProfile(WebInspector.CPUProfileType.TypeId, isProfiling);
     },
 
     /**
@@ -1174,7 +1209,7 @@
      */
     resetProfiles: function()
     {
-        this._profiler._reset();
+        this._profilesPanel._reset();
     },
 
     /**
@@ -1184,13 +1219,16 @@
      */
     reportHeapSnapshotProgress: function(done, total)
     {
-        this._profiler._reportHeapSnapshotProgress(done, total);
+        this._profilesPanel._reportHeapSnapshotProgress(done, total);
     }
 }
 
 /**
  * @constructor
  * @extends {WebInspector.SidebarTreeElement}
+ * @param {!WebInspector.ProfileHeader} profile
+ * @param {string} titleFormat
+ * @param {string} className
  */
 WebInspector.ProfileSidebarTreeElement = function(profile, titleFormat, className)
 {
@@ -1247,6 +1285,9 @@
         this.bubbleElement.addStyleClass("search-matches");
     },
 
+    /**
+     * @param {!Event} event
+     */
     handleContextMenuEvent: function(event)
     {
         var profile = ""
@@ -1291,6 +1332,7 @@
 /**
  * @constructor
  * @extends {WebInspector.SidebarTreeElement}
+ * @param {!WebInspector.ProfilesPanel} panel
  */
 WebInspector.ProfilesSidebarTreeElement = function(panel)
 {
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to