Title: [118503] trunk/Source/WebCore
Revision
118503
Author
[email protected]
Date
2012-05-25 02:44:42 -0700 (Fri, 25 May 2012)

Log Message

Web Inspector: make some profiler methods private
https://bugs.webkit.org/show_bug.cgi?id=87479

Reviewed by Vsevolod Vlasov.

- Removed unused methods.
- Renamed private methods so that their names start with underscore.
- ProfileLauncherView methods are called directly from ProfilesPanel instead
  of sending events.

* inspector/front-end/CPUProfileView.js:
* inspector/front-end/CSSSelectorProfileView.js:
(WebInspector.CSSSelectorProfileType.prototype.buttonClicked):
(WebInspector.CSSSelectorProfileType.prototype._startRecordingProfile):
(WebInspector.CSSSelectorProfileType.prototype.createTemporaryProfile):
* inspector/front-end/ProfileLauncherView.js:
(WebInspector.ProfileLauncherView.prototype.profileStarted):
(WebInspector.ProfileLauncherView.prototype.profileFinished):
* inspector/front-end/ProfilesPanel.js:
(WebInspector.ProfileType.prototype.createProfile):
(WebInspector.ProfilesPanel.prototype.toggleRecordButton):
(WebInspector.ProfilesPanel.prototype._reset):
(WebInspector.ProfilesPanel.prototype._populateProfiles.populateCallback.var):
(WebInspector.ProfilesPanel.prototype._populateProfiles.populateCallback):
(WebInspector.ProfilesPanel.prototype._populateProfiles):
(WebInspector.ProfilesPanel.prototype.setRecordingProfile):
(WebInspector.ProfilesPanel.prototype.takeHeapSnapshot.done):
(WebInspector.ProfilesPanel.prototype.takeHeapSnapshot):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (118502 => 118503)


--- trunk/Source/WebCore/ChangeLog	2012-05-25 09:41:17 UTC (rev 118502)
+++ trunk/Source/WebCore/ChangeLog	2012-05-25 09:44:42 UTC (rev 118503)
@@ -1,3 +1,34 @@
+2012-05-25  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: make some profiler methods private
+        https://bugs.webkit.org/show_bug.cgi?id=87479
+
+        Reviewed by Vsevolod Vlasov.
+
+        - Removed unused methods.
+        - Renamed private methods so that their names start with underscore. 
+        - ProfileLauncherView methods are called directly from ProfilesPanel instead
+          of sending events.
+
+        * inspector/front-end/CPUProfileView.js:
+        * inspector/front-end/CSSSelectorProfileView.js:
+        (WebInspector.CSSSelectorProfileType.prototype.buttonClicked):
+        (WebInspector.CSSSelectorProfileType.prototype._startRecordingProfile):
+        (WebInspector.CSSSelectorProfileType.prototype.createTemporaryProfile):
+        * inspector/front-end/ProfileLauncherView.js:
+        (WebInspector.ProfileLauncherView.prototype.profileStarted):
+        (WebInspector.ProfileLauncherView.prototype.profileFinished):
+        * inspector/front-end/ProfilesPanel.js:
+        (WebInspector.ProfileType.prototype.createProfile):
+        (WebInspector.ProfilesPanel.prototype.toggleRecordButton):
+        (WebInspector.ProfilesPanel.prototype._reset):
+        (WebInspector.ProfilesPanel.prototype._populateProfiles.populateCallback.var):
+        (WebInspector.ProfilesPanel.prototype._populateProfiles.populateCallback):
+        (WebInspector.ProfilesPanel.prototype._populateProfiles):
+        (WebInspector.ProfilesPanel.prototype.setRecordingProfile):
+        (WebInspector.ProfilesPanel.prototype.takeHeapSnapshot.done):
+        (WebInspector.ProfilesPanel.prototype.takeHeapSnapshot):
+
 2012-05-25  Keishi Hattori  <[email protected]>
 
         Bad checkValidity result on recently "enabled" form fields

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


--- trunk/Source/WebCore/inspector/front-end/CPUProfileView.js	2012-05-25 09:41:17 UTC (rev 118502)
+++ trunk/Source/WebCore/inspector/front-end/CPUProfileView.js	2012-05-25 09:44:42 UTC (rev 118503)
@@ -112,16 +112,6 @@
         return [this.viewSelectElement, this.percentButton.element, this.focusButton.element, this.excludeButton.element, this.resetButton.element];
     },
 
-    get profile()
-    {
-        return this._profile;
-    },
-
-    set profile(profile)
-    {
-        this._profile = profile;
-    },
-
     get bottomUpProfileDataGridTree()
     {
         if (!this._bottomUpProfileDataGridTree) {

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


--- trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js	2012-05-25 09:41:17 UTC (rev 118502)
+++ trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js	2012-05-25 09:44:42 UTC (rev 118503)
@@ -291,10 +291,10 @@
     buttonClicked: function()
     {
         if (this._recording) {
-            this.stopRecordingProfile();
+            this._stopRecordingProfile();
             return false;
         } else {
-            this.startRecordingProfile();
+            this._startRecordingProfile();
             return true;
         }
     },
@@ -314,24 +314,19 @@
         this._profileUid = 1;
     },
 
-    isRecordingProfile: function()
-    {
-        return this._recording;
-    },
-
     setRecordingProfile: function(isProfiling)
     {
         this._recording = isProfiling;
     },
 
-    startRecordingProfile: function()
+    _startRecordingProfile: function()
     {
         this._recording = true;
         CSSAgent.startSelectorProfiler();
         WebInspector.panels.profiles.setRecordingProfile(WebInspector.CSSSelectorProfileType.TypeId, true);
     },
 
-    stopRecordingProfile: function()
+    _stopRecordingProfile: function()
     {
         /**
          * @param {?Protocol.Error} error
@@ -362,16 +357,6 @@
     {
         title = title || WebInspector.UIString("Recording\u2026");
         return new WebInspector.CSSProfileHeader(this, title);
-    },
-
-    /**
-     * @override
-     * @param {CSSAgent.SelectorProfile} profile
-     * @return {WebInspector.ProfileHeader}
-     */
-    createProfile: function(profile)
-    {
-        throw new Error("Unreachable");
     }
 }
 

Modified: trunk/Source/WebCore/inspector/front-end/ProfileLauncherView.js (118502 => 118503)


--- trunk/Source/WebCore/inspector/front-end/ProfileLauncherView.js	2012-05-25 09:41:17 UTC (rev 118502)
+++ trunk/Source/WebCore/inspector/front-end/ProfileLauncherView.js	2012-05-25 09:44:42 UTC (rev 118503)
@@ -62,12 +62,6 @@
 }
 
 WebInspector.ProfileLauncherView.prototype = {
-    setUpEventListeners: function()
-    {
-        this._panel.addEventListener(WebInspector.ProfilesPanel.EventTypes.ProfileStarted, this._onProfileStarted, this);
-        this._panel.addEventListener(WebInspector.ProfilesPanel.EventTypes.ProfileFinished, this._onProfileFinished, this);
-    },
-
     /**
      * @param {WebInspector.ProfileType} profileType
      */
@@ -115,13 +109,13 @@
         this.dispatchEventToListeners(WebInspector.ProfileLauncherView.EventTypes.ProfileTypeSelected, profileType);
     },
 
-    _onProfileStarted: function(event)
+    profileStarted: function()
     {
         this._isProfiling = true;
         this._updateControls();
     },
 
-    _onProfileFinished: function(event)
+    profileFinished: function()
     {
         this._isProfiling = false;
         this._updateControls();

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


--- trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2012-05-25 09:41:17 UTC (rev 118502)
+++ trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js	2012-05-25 09:44:42 UTC (rev 118503)
@@ -88,14 +88,13 @@
         throw new Error("Needs implemented.");
     },
 
-    // Must be implemented by subclasses.
     /**
      * @param {ProfilerAgent.ProfileHeader} profile
      * @return {WebInspector.ProfileHeader}
      */
     createProfile: function(profile)
     {
-        throw new Error("Needs implemented.");
+        throw new Error("Not supported for " + this._name + " profiles.");
     }
 }
 
@@ -235,7 +234,6 @@
     this._launcherView = new WebInspector.ProfileLauncherView(this);
     this._launcherView.addEventListener(WebInspector.ProfileLauncherView.EventTypes.ProfileTypeSelected, this._onProfileTypeSelected, this);
     this._reset();
-    this._launcherView.setUpEventListeners();
 
     this._registerProfileType(new WebInspector.CPUProfileType());
     if (!WebInspector.WorkerManager.isWorkerFrontend())
@@ -254,11 +252,6 @@
     WebInspector.ObjectPropertiesSection.addContextMenuProvider(new WebInspector.RevealInHeapSnapshotContextMenuProvider());
 }
 
-WebInspector.ProfilesPanel.EventTypes = {
-    ProfileStarted: "profile-started",
-    ProfileFinished: "profile-finished"
-}
-
 WebInspector.ProfilesPanel.prototype = {
     _createFileSelectorElement: function()
     {
@@ -309,7 +302,10 @@
     toggleRecordButton: function()
     {
         var isProfiling = this._selectedProfileType.buttonClicked();
-        this.dispatchEventToListeners(isProfiling ? WebInspector.ProfilesPanel.EventTypes.ProfileStarted : WebInspector.ProfilesPanel.EventTypes.ProfileFinished);
+        if (isProfiling)
+            this._launcherView.profileStarted();
+        else
+            this._launcherView.profileFinished();
     },
 
     wasShown: function()
@@ -382,7 +378,6 @@
         this.profileViewStatusBarItemsContainer.removeChildren();
 
         this.removeAllListeners();
-        this._launcherView.setUpEventListeners();
 
         this._updateInterface();
         this.profilesItemTreeElement.select();
@@ -642,14 +637,6 @@
     },
 
     /**
-     * @param {ProfilerAgent.ProfileHeader} profile
-     */
-    hasProfile: function(profile)
-    {
-        return !!this._profilesIdMap[this._makeKey(profile.uid, profile.typeId)];
-    },
-
-    /**
      * @param {string} typeId
      * @param {number} uid
      */
@@ -1002,10 +989,8 @@
             var profileHeadersLength = profileHeaders.length;
             for (var i = 0; i < profileHeadersLength; ++i) {
                 var profileHeader = profileHeaders[i];
-                if (!this.hasProfile(profileHeader)) {
-                    var profileType = this.getProfileType(profileHeader.typeId);
-                    this.addProfileHeader(profileType.createProfile(profileHeader));
-                }
+                var profileType = this.getProfileType(profileHeader.typeId);
+                this.addProfileHeader(profileType.createProfile(profileHeader));
             }
         }
 
@@ -1040,7 +1025,10 @@
             this._removeTemporaryProfile(profileType);
         this.recordButton.toggled = isProfiling;
         this.recordButton.title = profileTypeObject.buttonTooltip;
-        this.dispatchEventToListeners(isProfiling ? WebInspector.ProfilesPanel.EventTypes.ProfileStarted : WebInspector.ProfilesPanel.EventTypes.ProfileFinished);
+        if (isProfiling)
+            this._launcherView.profileStarted();
+        else
+            this._launcherView.profileFinished();
     },
 
     takeHeapSnapshot: function()
@@ -1050,9 +1038,9 @@
             var profileTypeObject = this.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId);
             this.addProfileHeader(profileTypeObject.createTemporaryProfile());
         }
-        this.dispatchEventToListeners(WebInspector.ProfilesPanel.EventTypes.ProfileStarted);
+        this._launcherView.profileStarted();
         function done() {
-            this.dispatchEventToListeners(WebInspector.ProfilesPanel.EventTypes.ProfileFinished);
+            this._launcherView.profileFinished();
         }
         ProfilerAgent.takeHeapSnapshot(done.bind(this));
         WebInspector.userMetrics.ProfilesHeapProfileTaken.record();
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to