Changeset 118503 in webkit


Ignore:
Timestamp:
May 25, 2012 2:44:42 AM (12 years ago)
Author:
yurys@chromium.org
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):

Location:
trunk/Source/WebCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r118501 r118503  
     12012-05-25  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: make some profiler methods private
     4        https://bugs.webkit.org/show_bug.cgi?id=87479
     5
     6        Reviewed by Vsevolod Vlasov.
     7
     8        - Removed unused methods.
     9        - Renamed private methods so that their names start with underscore.
     10        - ProfileLauncherView methods are called directly from ProfilesPanel instead
     11          of sending events.
     12
     13        * inspector/front-end/CPUProfileView.js:
     14        * inspector/front-end/CSSSelectorProfileView.js:
     15        (WebInspector.CSSSelectorProfileType.prototype.buttonClicked):
     16        (WebInspector.CSSSelectorProfileType.prototype._startRecordingProfile):
     17        (WebInspector.CSSSelectorProfileType.prototype.createTemporaryProfile):
     18        * inspector/front-end/ProfileLauncherView.js:
     19        (WebInspector.ProfileLauncherView.prototype.profileStarted):
     20        (WebInspector.ProfileLauncherView.prototype.profileFinished):
     21        * inspector/front-end/ProfilesPanel.js:
     22        (WebInspector.ProfileType.prototype.createProfile):
     23        (WebInspector.ProfilesPanel.prototype.toggleRecordButton):
     24        (WebInspector.ProfilesPanel.prototype._reset):
     25        (WebInspector.ProfilesPanel.prototype._populateProfiles.populateCallback.var):
     26        (WebInspector.ProfilesPanel.prototype._populateProfiles.populateCallback):
     27        (WebInspector.ProfilesPanel.prototype._populateProfiles):
     28        (WebInspector.ProfilesPanel.prototype.setRecordingProfile):
     29        (WebInspector.ProfilesPanel.prototype.takeHeapSnapshot.done):
     30        (WebInspector.ProfilesPanel.prototype.takeHeapSnapshot):
     31
    1322012-05-25  Keishi Hattori  <keishi@webkit.org>
    233
  • trunk/Source/WebCore/inspector/front-end/CPUProfileView.js

    r117582 r118503  
    113113    },
    114114
    115     get profile()
    116     {
    117         return this._profile;
    118     },
    119 
    120     set profile(profile)
    121     {
    122         this._profile = profile;
    123     },
    124 
    125115    get bottomUpProfileDataGridTree()
    126116    {
  • trunk/Source/WebCore/inspector/front-end/CSSSelectorProfileView.js

    r117581 r118503  
    292292    {
    293293        if (this._recording) {
    294             this.stopRecordingProfile();
     294            this._stopRecordingProfile();
    295295            return false;
    296296        } else {
    297             this.startRecordingProfile();
     297            this._startRecordingProfile();
    298298            return true;
    299299        }
     
    315315    },
    316316
    317     isRecordingProfile: function()
    318     {
    319         return this._recording;
    320     },
    321 
    322317    setRecordingProfile: function(isProfiling)
    323318    {
     
    325320    },
    326321
    327     startRecordingProfile: function()
     322    _startRecordingProfile: function()
    328323    {
    329324        this._recording = true;
     
    332327    },
    333328
    334     stopRecordingProfile: function()
     329    _stopRecordingProfile: function()
    335330    {
    336331        /**
     
    363358        title = title || WebInspector.UIString("Recording\u2026");
    364359        return new WebInspector.CSSProfileHeader(this, title);
    365     },
    366 
    367     /**
    368      * @override
    369      * @param {CSSAgent.SelectorProfile} profile
    370      * @return {WebInspector.ProfileHeader}
    371      */
    372     createProfile: function(profile)
    373     {
    374         throw new Error("Unreachable");
    375360    }
    376361}
  • trunk/Source/WebCore/inspector/front-end/ProfileLauncherView.js

    r117581 r118503  
    6363
    6464WebInspector.ProfileLauncherView.prototype = {
    65     setUpEventListeners: function()
    66     {
    67         this._panel.addEventListener(WebInspector.ProfilesPanel.EventTypes.ProfileStarted, this._onProfileStarted, this);
    68         this._panel.addEventListener(WebInspector.ProfilesPanel.EventTypes.ProfileFinished, this._onProfileFinished, this);
    69     },
    70 
    7165    /**
    7266     * @param {WebInspector.ProfileType} profileType
     
    116110    },
    117111
    118     _onProfileStarted: function(event)
     112    profileStarted: function()
    119113    {
    120114        this._isProfiling = true;
     
    122116    },
    123117
    124     _onProfileFinished: function(event)
     118    profileFinished: function()
    125119    {
    126120        this._isProfiling = false;
  • trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js

    r117940 r118503  
    8989    },
    9090
    91     // Must be implemented by subclasses.
    9291    /**
    9392     * @param {ProfilerAgent.ProfileHeader} profile
     
    9695    createProfile: function(profile)
    9796    {
    98         throw new Error("Needs implemented.");
     97        throw new Error("Not supported for " + this._name + " profiles.");
    9998    }
    10099}
     
    236235    this._launcherView.addEventListener(WebInspector.ProfileLauncherView.EventTypes.ProfileTypeSelected, this._onProfileTypeSelected, this);
    237236    this._reset();
    238     this._launcherView.setUpEventListeners();
    239237
    240238    this._registerProfileType(new WebInspector.CPUProfileType());
     
    253251
    254252    WebInspector.ObjectPropertiesSection.addContextMenuProvider(new WebInspector.RevealInHeapSnapshotContextMenuProvider());
    255 }
    256 
    257 WebInspector.ProfilesPanel.EventTypes = {
    258     ProfileStarted: "profile-started",
    259     ProfileFinished: "profile-finished"
    260253}
    261254
     
    310303    {
    311304        var isProfiling = this._selectedProfileType.buttonClicked();
    312         this.dispatchEventToListeners(isProfiling ? WebInspector.ProfilesPanel.EventTypes.ProfileStarted : WebInspector.ProfilesPanel.EventTypes.ProfileFinished);
     305        if (isProfiling)
     306            this._launcherView.profileStarted();
     307        else
     308            this._launcherView.profileFinished();
    313309    },
    314310
     
    383379
    384380        this.removeAllListeners();
    385         this._launcherView.setUpEventListeners();
    386381
    387382        this._updateInterface();
     
    640635        if (temporaryProfile)
    641636            this._removeProfileHeader(temporaryProfile);
    642     },
    643 
    644     /**
    645      * @param {ProfilerAgent.ProfileHeader} profile
    646      */
    647     hasProfile: function(profile)
    648     {
    649         return !!this._profilesIdMap[this._makeKey(profile.uid, profile.typeId)];
    650637    },
    651638
     
    1003990            for (var i = 0; i < profileHeadersLength; ++i) {
    1004991                var profileHeader = profileHeaders[i];
    1005                 if (!this.hasProfile(profileHeader)) {
    1006                     var profileType = this.getProfileType(profileHeader.typeId);
    1007                     this.addProfileHeader(profileType.createProfile(profileHeader));
    1008                 }
     992                var profileType = this.getProfileType(profileHeader.typeId);
     993                this.addProfileHeader(profileType.createProfile(profileHeader));
    1009994            }
    1010995        }
     
    10411026        this.recordButton.toggled = isProfiling;
    10421027        this.recordButton.title = profileTypeObject.buttonTooltip;
    1043         this.dispatchEventToListeners(isProfiling ? WebInspector.ProfilesPanel.EventTypes.ProfileStarted : WebInspector.ProfilesPanel.EventTypes.ProfileFinished);
     1028        if (isProfiling)
     1029            this._launcherView.profileStarted();
     1030        else
     1031            this._launcherView.profileFinished();
    10441032    },
    10451033
     
    10511039            this.addProfileHeader(profileTypeObject.createTemporaryProfile());
    10521040        }
    1053         this.dispatchEventToListeners(WebInspector.ProfilesPanel.EventTypes.ProfileStarted);
     1041        this._launcherView.profileStarted();
    10541042        function done() {
    1055             this.dispatchEventToListeners(WebInspector.ProfilesPanel.EventTypes.ProfileFinished);
     1043            this._launcherView.profileFinished();
    10561044        }
    10571045        ProfilerAgent.takeHeapSnapshot(done.bind(this));
Note: See TracChangeset for help on using the changeset viewer.