Changeset 139998 in webkit


Ignore:
Timestamp:
Jan 17, 2013 10:50:59 AM (11 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Profiler: split "getProfile" to "getCPUProfile" and "loadHeapSnapshot"
https://bugs.webkit.org/show_bug.cgi?id=104545

Patch by Eugene Klyuchnikov <eustas@chromium.org> on 2013-01-17
Reviewed by Yury Semikhatsky.

Source/WebCore:

This change will allow stronger typing of profiler output.

  • inspector/Inspector.json:

Split "getProfile" to "getCPUProfile" and "getHeapSnapshot".

  • inspector/InspectorProfilerAgent.cpp: Ditto.
  • inspector/InspectorProfilerAgent.h: Ditto.
  • inspector/front-end/CPUProfileView.js: Adopd changes.
  • inspector/front-end/HeapSnapshotView.js: Ditto.

Source/WebKit/chromium:

Adopt changes: mimic old behavior.

  • src/WebDevToolsAgentImpl.cpp: Adopt signature changes.

Tools:

Adopt signature changes.

  • BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js:

(ProfilerAgent.getCPUProfile): Renamed.
(ProfilerAgent.getHeapSnapshot): Added.

LayoutTests:

Adopted new method signatures.

  • inspector/profiler/heap-snapshot-get-profile-crash.html:

Adopted new method signatures.

  • inspector/profiler/heap-snapshot-loader.html: Ditto.
  • inspector/profiler/heap-snapshot-test.js: Ditto.
Location:
trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r139995 r139998  
     12013-01-17  Eugene Klyuchnikov  <eustas@chromium.org>
     2
     3        Web Inspector: Profiler: split "getProfile" to "getCPUProfile" and "loadHeapSnapshot"
     4        https://bugs.webkit.org/show_bug.cgi?id=104545
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        Adopted new method signatures.
     9
     10        * inspector/profiler/heap-snapshot-get-profile-crash.html:
     11        Adopted new method signatures.
     12        * inspector/profiler/heap-snapshot-loader.html: Ditto.
     13        * inspector/profiler/heap-snapshot-test.js: Ditto.
     14
    1152013-01-17  Krzysztof Czech  <k.czech@samsung.com>
    216
  • trunk/LayoutTests/inspector/profiler/heap-snapshot-get-profile-crash.html

    r120456 r139998  
    1515                next();
    1616            }
    17             ProfilerAgent.getProfile("HEAP", -1, finish);
     17            ProfilerAgent.getHeapSnapshot(-1, finish);
    1818        }
    1919    ]);
  • trunk/LayoutTests/inspector/profiler/heap-snapshot-loader.html

    r138477 r139998  
    3131        var profileHeader = panel._profiles[0];
    3232
    33         function getProfileMock(profileTypeName, uid) {
     33        function getHeapSnapshotMock(uid) {
    3434            for (var i = 0, l = sourceStringified.length; i < l; i += partSize)
    3535                dispatcher.addHeapSnapshotChunk(uid, sourceStringified.slice(i, i + partSize));
     
    4040        {
    4141            if (overrideGetProfile)
    42                 InspectorTest.override(ProfilerAgent, "getProfile", getProfileMock);
     42                InspectorTest.override(ProfilerAgent, "getHeapSnapshot", getHeapSnapshotMock);
    4343            callback(profileHeader);
    4444        }
    4545        InspectorTest.addSniffer(profileHeader, "_snapshotReceived", snapshotLoaded);
    4646
    47         InspectorTest.override(ProfilerAgent, "getProfile", getProfileMock);
     47        InspectorTest.override(ProfilerAgent, "getHeapSnapshot", getHeapSnapshotMock);
    4848        panel.showProfile(profileHeader);
    4949    }
  • trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js

    r138477 r139998  
    728728    });
    729729    delete snapshot.maxJSObjectId;
    730     function pushGeneratedSnapshot(typeId, uid)
    731     {
    732         snapshot.snapshot.typeId = profile.typeId;
     730    function pushGeneratedSnapshot(uid)
     731    {
     732        snapshot.snapshot.typeId = "HEAP";
    733733        snapshot.snapshot.title = profile.title;
    734734        snapshot.snapshot.uid = profile.uid;
     
    736736        WebInspector.panels.profiles._finishHeapSnapshot(uid);
    737737    }
    738     InspectorTest.override(ProfilerAgent, "getProfile", pushGeneratedSnapshot);
     738    InspectorTest.override(ProfilerAgent, "getHeapSnapshot", pushGeneratedSnapshot);
    739739    InspectorTest._takeAndOpenSnapshotCallback = callback;
    740740    WebInspector.panels.profiles.addProfileHeader(profile);
  • trunk/Source/WebCore/ChangeLog

    r139997 r139998  
     12013-01-17  Eugene Klyuchnikov  <eustas@chromium.org>
     2
     3        Web Inspector: Profiler: split "getProfile" to "getCPUProfile" and "loadHeapSnapshot"
     4        https://bugs.webkit.org/show_bug.cgi?id=104545
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        This change will allow stronger typing of profiler output.
     9
     10        * inspector/Inspector.json:
     11        Split "getProfile" to "getCPUProfile" and "getHeapSnapshot".
     12        * inspector/InspectorProfilerAgent.cpp: Ditto.
     13        * inspector/InspectorProfilerAgent.h: Ditto.
     14        * inspector/front-end/CPUProfileView.js: Adopd changes.
     15        * inspector/front-end/HeapSnapshotView.js: Ditto.
     16
    1172013-01-17  Eugene Klyuchnikov  <eustas@chromium.org>
    218
  • trunk/Source/WebCore/inspector/Inspector.json

    r139917 r139998  
    29852985            },
    29862986            {
    2987                 "id": "Profile",
     2987                "id": "CPUProfile",
    29882988                "type": "object",
    29892989                "description": "Profile.",
     
    30383038            },
    30393039            {
    3040                 "name": "getProfile",
    3041                 "parameters": [
    3042                     { "name": "type", "type": "string" },
     3040                "name": "getCPUProfile",
     3041                "parameters": [
    30433042                    { "name": "uid", "type": "integer" }
    30443043                ],
    30453044                "returns": [
    3046                     { "name": "profile", "$ref": "Profile" }
     3045                    { "name": "profile", "$ref": "CPUProfile" }
     3046                ]
     3047            },
     3048            {
     3049                "name": "getHeapSnapshot",
     3050                "parameters": [
     3051                    { "name": "uid", "type": "integer" }
    30473052                ]
    30483053            },
  • trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp

    r139589 r139998  
    285285} // namespace
    286286
    287 void InspectorProfilerAgent::getProfile(ErrorString* errorString, const String& type, int rawUid, RefPtr<TypeBuilder::Profiler::Profile>& profileObject)
     287void InspectorProfilerAgent::getCPUProfile(ErrorString* errorString, int rawUid, RefPtr<TypeBuilder::Profiler::CPUProfile>& profileObject)
    288288{
    289289    unsigned uid = static_cast<unsigned>(rawUid);
    290     if (type == CPUProfileType) {
    291         ProfilesMap::iterator it = m_profiles.find(uid);
    292         if (it == m_profiles.end()) {
    293             *errorString = "Profile wasn't found";
    294             return;
    295         }
    296         profileObject = TypeBuilder::Profiler::Profile::create();
    297         profileObject->setHead(it->value->buildInspectorObjectForHead());
    298         if (it->value->bottomUpHead())
    299             profileObject->setBottomUpHead(it->value->buildInspectorObjectForBottomUpHead());
    300         profileObject->setIdleTime(it->value->idleTime());
    301     } else if (type == HeapProfileType) {
    302         HeapSnapshotsMap::iterator it = m_snapshots.find(uid);
    303         if (it == m_snapshots.end()) {
    304             *errorString = "Profile wasn't found";
    305             return;
    306         }
    307         RefPtr<ScriptHeapSnapshot> snapshot = it->value;
    308         profileObject = TypeBuilder::Profiler::Profile::create();
    309         if (m_frontend) {
    310             OutputStream stream(m_frontend, uid);
    311             snapshot->writeJSON(&stream);
    312         }
     290    ProfilesMap::iterator it = m_profiles.find(uid);
     291    if (it == m_profiles.end()) {
     292        *errorString = "Profile wasn't found";
     293        return;
     294    }
     295    profileObject = TypeBuilder::Profiler::CPUProfile::create();
     296    profileObject->setHead(it->value->buildInspectorObjectForHead());
     297    if (it->value->bottomUpHead())
     298        profileObject->setBottomUpHead(it->value->buildInspectorObjectForBottomUpHead());
     299    profileObject->setIdleTime(it->value->idleTime());
     300}
     301
     302void InspectorProfilerAgent::getHeapSnapshot(ErrorString* errorString, int rawUid)
     303{
     304    unsigned uid = static_cast<unsigned>(rawUid);
     305    HeapSnapshotsMap::iterator it = m_snapshots.find(uid);
     306    if (it == m_snapshots.end()) {
     307        *errorString = "Profile wasn't found";
     308        return;
     309    }
     310    RefPtr<ScriptHeapSnapshot> snapshot = it->value;
     311    if (m_frontend) {
     312        OutputStream stream(m_frontend, uid);
     313        snapshot->writeJSON(&stream);
    313314    }
    314315}
  • trunk/Source/WebCore/inspector/InspectorProfilerAgent.h

    r138457 r139998  
    8888    String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false);
    8989    virtual void getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::ProfileHeader> >&);
    90     virtual void getProfile(ErrorString*, const String& type, int uid, RefPtr<TypeBuilder::Profiler::Profile>&);
     90    virtual void getCPUProfile(ErrorString*, int uid, RefPtr<TypeBuilder::Profiler::CPUProfile>&);
     91    virtual void getHeapSnapshot(ErrorString*, int uid);
    9192    virtual void removeProfile(ErrorString*, const String& type, int uid);
    9293
  • trunk/Source/WebCore/inspector/front-end/CPUProfileView.js

    r139972 r139998  
    9999    this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.DefaultFormatter(30));
    100100
    101     ProfilerAgent.getProfile(this.profile.profileType().id, this.profile.uid, profileCallback.bind(this));
     101    ProfilerAgent.getCPUProfile(this.profile.uid, profileCallback.bind(this));
    102102}
    103103
  • trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js

    r135708 r139998  
    873873            this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026");
    874874            this.sidebarElement.wait = true;
    875             ProfilerAgent.getProfile(this.profileType().id, this.uid);
     875            ProfilerAgent.getHeapSnapshot(this.uid);
    876876        }
    877877        var loaderProxy = /** @type {WebInspector.HeapSnapshotLoaderProxy} */ (this._receiver);
     
    978978            this._savedChunks = 0;
    979979            this._updateTransferProgress(0, this._totalNumberOfChunks);
    980             ProfilerAgent.getProfile(this.profileType().id, this.uid);
     980            ProfilerAgent.getHeapSnapshot(this.uid);
    981981        }
    982982        this._savingToFile = true;
  • trunk/Source/WebKit/chromium/ChangeLog

    r139976 r139998  
     12013-01-17  Eugene Klyuchnikov  <eustas@chromium.org>
     2
     3        Web Inspector: Profiler: split "getProfile" to "getCPUProfile" and "loadHeapSnapshot"
     4        https://bugs.webkit.org/show_bug.cgi?id=104545
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        Adopt changes: mimic old behavior.
     9
     10        * src/WebDevToolsAgentImpl.cpp: Adopt signature changes.
     11
    1122013-01-17  Yury Semikhatsky  <yurys@chromium.org>
    213
  • trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp

    r139976 r139998  
    750750        || commandName == InspectorBackendDispatcher::commandNames[InspectorBackendDispatcher::kProfiler_startCmd]
    751751        || commandName == InspectorBackendDispatcher::commandNames[InspectorBackendDispatcher::kProfiler_stopCmd]
    752         || commandName == InspectorBackendDispatcher::commandNames[InspectorBackendDispatcher::kProfiler_getProfileCmd];
     752        || commandName == InspectorBackendDispatcher::commandNames[InspectorBackendDispatcher::kProfiler_getCPUProfileCmd]
     753        || commandName == InspectorBackendDispatcher::commandNames[InspectorBackendDispatcher::kProfiler_getHeapSnapshotCmd];
    753754}
    754755
  • trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js

    r100457 r139998  
    6969
    7070var ProfilerAgent = {
    71     getProfile: function(typeId, uid, callback) {
     71    getCPUProfile: function(uid, callback) {
    7272        this._callback = callback;
     73    },
     74
     75    getHeapSnapshot: function(uid, callback) {
    7376    },
    7477
  • trunk/Tools/ChangeLog

    r139973 r139998  
     12013-01-17  Eugene Klyuchnikov  <eustas@chromium.org>
     2
     3        Web Inspector: Profiler: split "getProfile" to "getCPUProfile" and "loadHeapSnapshot"
     4        https://bugs.webkit.org/show_bug.cgi?id=104545
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        Adopt signature changes.
     9
     10        * BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js:
     11        (ProfilerAgent.getCPUProfile): Renamed.
     12        (ProfilerAgent.getHeapSnapshot): Added.
     13
    1142013-01-17  Zan Dobersek  <zdobersek@igalia.com>
    215
Note: See TracChangeset for help on using the changeset viewer.