Changeset 143159 in webkit


Ignore:
Timestamp:
Feb 17, 2013 11:51:52 PM (11 years ago)
Author:
eustas@chromium.org
Message:

Web Inspector: Introduce ProfilesPanelDescriptor.
https://bugs.webkit.org/show_bug.cgi?id=109906

Reviewed by Pavel Feldman.

Source/WebCore:

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.

LayoutTests:

  • inspector/profiler/heap-snapshot-test.js: Adopted changes.
Location:
trunk
Files:
1 added
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r143157 r143159  
     12013-02-15  Eugene Klyuchnikov  <eustas@chromium.org>
     2
     3        Web Inspector: Introduce ProfilesPanelDescriptor.
     4        https://bugs.webkit.org/show_bug.cgi?id=109906
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/profiler/heap-snapshot-test.js: Adopted changes.
     9
    1102013-02-17  Takashi Toyoshima  <toyoshim@chromium.org>
    211
  • trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js

    r142460 r143159  
    723723    var profileType = WebInspector.panels.profiles.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId);
    724724    var profile = profileType.createProfile({
    725         title: UserInitiatedProfileName + "." + uid,
     725        title: WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName + "." + uid,
    726726        uid: uid,
    727727        maxJSObjectId: snapshot.maxJSObjectId
  • trunk/Source/WebCore/ChangeLog

    r143152 r143159  
     12013-02-15  Eugene Klyuchnikov  <eustas@chromium.org>
     2
     3        Web Inspector: Introduce ProfilesPanelDescriptor.
     4        https://bugs.webkit.org/show_bug.cgi?id=109906
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Some constants/methods should be accesible before ProfilesPanel
     9        is instantiated.
     10
     11        Extracted methods to check if profile is "user-initiated" and what is
     12        its index.
     13
     14        Also profile URL regexp moved to ProfilesPanelDescriptor.
     15
     16        * inspector/front-end/ProfilesPanelDescriptor.js: Added.
     17        * WebCore.gypi: Added ProfilesPanelDescriptor.js
     18        * WebCore.vcproj/WebCore.vcproj: Ditto.
     19        * inspector/compile-front-end.py: Ditto.
     20        * inspector/front-end/WebKit.qrc: Ditto.
     21        * inspector/front-end/inspector.html: Ditto.
     22        * inspector/front-end/HeapSnapshotView.js: Adopted changes.
     23        * inspector/front-end/ProfilesPanel.js: Ditto.
     24        * inspector/front-end/externs.js: Ditto.
     25        * inspector/front-end/inspector.js: Ditto.
     26
    1272013-02-17  Dimitri Glazkov  <dglazkov@chromium.org>
    228
  • trunk/Source/WebCore/WebCore.gypi

    r143136 r143159  
    52555255            'inspector/front-end/Popover.js',
    52565256            'inspector/front-end/PresentationConsoleMessageHelper.js',
     5257            'inspector/front-end/ProfilesPanelDescriptor.js',
    52575258            'inspector/front-end/Progress.js',
    52585259            'inspector/front-end/ProgressIndicator.js',
  • trunk/Source/WebCore/WebCore.vcproj/WebCore.vcproj

    r143090 r143159  
    7762777627                                </File>
    7762877628                                <File
     77629                                        RelativePath="..\inspector\front-end\ProfilesPanelDescriptor.js"
     77630                                        >
     77631                                </File>
     77632                                <File
    7762977633                                        RelativePath="..\inspector\front-end\Progress.js"
    7763077634                                        >
  • trunk/Source/WebCore/inspector/compile-front-end.py

    r142976 r143159  
    349349            "ProfileDataGridTree.js",
    350350            "ProfilesPanel.js",
     351            "ProfilesPanelDescriptor.js",
    351352            "ProfileLauncherView.js",
    352353            "TopDownProfileDataGridTree.js",
  • trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js

    r142870 r143159  
    699699            var baseOption = document.createElement("option");
    700700            var title = list[i].title;
    701             if (!title.indexOf(UserInitiatedProfileName))
    702                 title = WebInspector.UIString("Snapshot %d", title.substring(UserInitiatedProfileName.length + 1));
     701            if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title))
     702                title = WebInspector.UIString("Snapshot %d", WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex(title));
    703703            baseOption.label = title;
    704704            this.baseSelectElement.appendChild(baseOption);
     
    725725            var filterOption = document.createElement("option");
    726726            var title = list[i].title;
    727             if (!title.indexOf(UserInitiatedProfileName)) {
     727            if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(title)) {
     728                var profileIndex = WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex(title);
    728729                if (!i)
    729                     title = WebInspector.UIString("Objects allocated before Snapshot %d", title.substring(UserInitiatedProfileName.length + 1));
     730                    title = WebInspector.UIString("Objects allocated before Snapshot %d", profileIndex);
    730731                else
    731                     title = WebInspector.UIString("Objects allocated between Snapshots %d and %d", title.substring(UserInitiatedProfileName.length + 1) - 1, title.substring(UserInitiatedProfileName.length + 1));
     732                    title = WebInspector.UIString("Objects allocated between Snapshots %d and %d", profileIndex - 1, profileIndex);
    732733            }
    733734            filterOption.label = title;
  • trunk/Source/WebCore/inspector/front-end/ProfilesPanel.js

    r142870 r143159  
    341341
    342342        var profileType = this.getProfileType(WebInspector.HeapSnapshotProfileType.TypeId);
    343         var temporaryProfile = profileType.createTemporaryProfile(UserInitiatedProfileName + "." + file.name);
     343        var temporaryProfile = profileType.createTemporaryProfile(WebInspector.ProfilesPanelDescriptor.UserInitiatedProfileName + "." + file.name);
    344344        this.addProfileHeader(temporaryProfile);
    345345
     
    557557        this._profilesIdMap[this._makeKey(profile.uid, typeId)] = profile;
    558558
    559         if (!profile.title.startsWith(UserInitiatedProfileName)) {
     559        if (!WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(profile.title)) {
    560560            var profileTitleKey = this._makeTitleKey(profile.title, typeId);
    561561            if (!(profileTitleKey in this._profileGroups))
     
    790790    showProfileForURL: function(url)
    791791    {
    792         var match = url.match(WebInspector.ProfileURLRegExp);
     792        var match = url.match(WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp);
    793793        if (!match)
    794794            return;
     
    13961396    this._titleFormat = titleFormat;
    13971397
    1398     if (this.profile.title.startsWith(UserInitiatedProfileName))
    1399         this._profileNumber = this.profile.title.substring(UserInitiatedProfileName.length + 1);
     1398    if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(this.profile.title))
     1399        this._profileNumber = WebInspector.ProfilesPanelDescriptor.userInitiatedProfileIndex(this.profile.title);
    14001400
    14011401    WebInspector.SidebarTreeElement.call(this, className, "", "", profile, false);
     
    14211421        if (this._mainTitle)
    14221422            return this._mainTitle;
    1423         if (this.profile.title.startsWith(UserInitiatedProfileName))
     1423        if (WebInspector.ProfilesPanelDescriptor.isUserInitiatedProfile(this.profile.title))
    14241424            return WebInspector.UIString(this._titleFormat, this._profileNumber);
    14251425        return this.profile.title;
  • trunk/Source/WebCore/inspector/front-end/WebKit.qrc

    r142862 r143159  
    140140    <file>ProfileLauncherView.js</file>
    141141    <file>ProfilesPanel.js</file>
     142    <file>ProfilesPanelDescriptor.js</file>
    142143    <file>Progress.js</file>
    143144    <file>ProgressIndicator.js</file>
  • trunk/Source/WebCore/inspector/front-end/externs.js

    r143000 r143159  
    330330WebInspector.CodeMirrorTextEditor = function(url, delegate) { }
    331331
    332 WebInspector.ProfileURLRegExp = "";
    333 
    334 
    335332/** @type {boolean} */
    336333window.dispatchStandaloneTestRunnerMessages;
  • trunk/Source/WebCore/inspector/front-end/inspector.html

    r142610 r143159  
    178178    <script type="text/javascript" src="ElementsPanelDescriptor.js"></script>
    179179    <script type="text/javascript" src="NetworkPanelDescriptor.js"></script>
     180    <script type="text/javascript" src="ProfilesPanelDescriptor.js"></script>
    180181    <script type="text/javascript" src="ScriptsPanelDescriptor.js"></script>
    181182    <script type="text/javascript" src="TimelinePanelDescriptor.js"></script>
  • trunk/Source/WebCore/inspector/front-end/inspector.js

    r142614 r143159  
    4343        var scripts = new WebInspector.ScriptsPanelDescriptor();
    4444        var timeline = new WebInspector.TimelinePanelDescriptor();
    45         var profiles = new WebInspector.PanelDescriptor("profiles", WebInspector.UIString("Profiles"), "ProfilesPanel", "ProfilesPanel.js");
     45        var profiles = new WebInspector.ProfilesPanelDescriptor();
    4646        var audits = new WebInspector.PanelDescriptor("audits", WebInspector.UIString("Audits"), "AuditsPanel", "AuditsPanel.js");
    4747        var console = new WebInspector.PanelDescriptor("console", WebInspector.UIString("Console"), "ConsolePanel");
     
    275275    _profilesLinkifier: function(title)
    276276    {
    277         var profileStringMatches = WebInspector.ProfileURLRegExp.exec(title);
     277        var profileStringMatches = WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp.exec(title);
    278278        if (profileStringMatches) {
    279279            var profilesPanel = /** @ type {WebInspector.ProfilesPanel} */ WebInspector.panel("profiles");
     
    583583{
    584584    var anchor = event.target.enclosingNodeOrSelfWithNodeName("a");
    585     if (!anchor || (anchor.target === "_blank" && !WebInspector.ProfileURLRegExp.exec(anchor.href)))
     585    if (!anchor || (anchor.target === "_blank" && !WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp.exec(anchor.href)))
    586586        return;
    587587
     
    594594            return;
    595595
    596         const profileMatch = WebInspector.ProfileURLRegExp.exec(anchor.href);
     596        const profileMatch = WebInspector.ProfilesPanelDescriptor.ProfileURLRegExp.exec(anchor.href);
    597597        if (profileMatch) {
    598598            WebInspector.showProfileForURL(anchor.href);
     
    10051005}
    10061006
    1007 WebInspector.ProfileURLRegExp = /webkit-profile:\/\/(.+)\/(.+)#([0-9]+)/;
    1008 
    10091007WebInspector.Zoom = {
    10101008    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],
Note: See TracChangeset for help on using the changeset viewer.