Title: [139998] trunk
Revision
139998
Author
commit-qu...@webkit.org
Date
2013-01-17 10:50:59 -0800 (Thu, 17 Jan 2013)

Log Message

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

Patch by Eugene Klyuchnikov <eus...@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.

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (139997 => 139998)


--- trunk/LayoutTests/ChangeLog	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/LayoutTests/ChangeLog	2013-01-17 18:50:59 UTC (rev 139998)
@@ -1,3 +1,17 @@
+2013-01-17  Eugene Klyuchnikov  <eus...@chromium.org>
+
+        Web Inspector: Profiler: split "getProfile" to "getCPUProfile" and "loadHeapSnapshot"
+        https://bugs.webkit.org/show_bug.cgi?id=104545
+
+        Reviewed by Yury Semikhatsky.
+
+        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.
+
 2013-01-17  Krzysztof Czech  <k.cz...@samsung.com>
 
         Unreviewed EFL gardening.

Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot-get-profile-crash.html (139997 => 139998)


--- trunk/LayoutTests/inspector/profiler/heap-snapshot-get-profile-crash.html	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-get-profile-crash.html	2013-01-17 18:50:59 UTC (rev 139998)
@@ -14,7 +14,7 @@
                 console.log(errorString);
                 next();
             }
-            ProfilerAgent.getProfile("HEAP", -1, finish);
+            ProfilerAgent.getHeapSnapshot(-1, finish);
         }
     ]);
 }

Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot-loader.html (139997 => 139998)


--- trunk/LayoutTests/inspector/profiler/heap-snapshot-loader.html	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-loader.html	2013-01-17 18:50:59 UTC (rev 139998)
@@ -30,7 +30,7 @@
 
         var profileHeader = panel._profiles[0];
 
-        function getProfileMock(profileTypeName, uid) {
+        function getHeapSnapshotMock(uid) {
             for (var i = 0, l = sourceStringified.length; i < l; i += partSize)
                 dispatcher.addHeapSnapshotChunk(uid, sourceStringified.slice(i, i + partSize));
             dispatcher.finishHeapSnapshot(uid);
@@ -39,12 +39,12 @@
         function snapshotLoaded()
         {
             if (overrideGetProfile)
-                InspectorTest.override(ProfilerAgent, "getProfile", getProfileMock);
+                InspectorTest.override(ProfilerAgent, "getHeapSnapshot", getHeapSnapshotMock);
             callback(profileHeader);
         }
         InspectorTest.addSniffer(profileHeader, "_snapshotReceived", snapshotLoaded);
 
-        InspectorTest.override(ProfilerAgent, "getProfile", getProfileMock);
+        InspectorTest.override(ProfilerAgent, "getHeapSnapshot", getHeapSnapshotMock);
         panel.showProfile(profileHeader);
     }
 

Modified: trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js (139997 => 139998)


--- trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/LayoutTests/inspector/profiler/heap-snapshot-test.js	2013-01-17 18:50:59 UTC (rev 139998)
@@ -727,15 +727,15 @@
         maxJSObjectId: snapshot.maxJSObjectId
     });
     delete snapshot.maxJSObjectId;
-    function pushGeneratedSnapshot(typeId, uid)
+    function pushGeneratedSnapshot(uid)
     {
-        snapshot.snapshot.typeId = profile.typeId;
+        snapshot.snapshot.typeId = "HEAP";
         snapshot.snapshot.title = profile.title;
         snapshot.snapshot.uid = profile.uid;
         WebInspector.panels.profiles._addHeapSnapshotChunk(uid, JSON.stringify(snapshot));
         WebInspector.panels.profiles._finishHeapSnapshot(uid);
     }
-    InspectorTest.override(ProfilerAgent, "getProfile", pushGeneratedSnapshot);
+    InspectorTest.override(ProfilerAgent, "getHeapSnapshot", pushGeneratedSnapshot);
     InspectorTest._takeAndOpenSnapshotCallback = callback;
     WebInspector.panels.profiles.addProfileHeader(profile);
     WebInspector.panels.profiles.showProfile(profile);

Modified: trunk/Source/WebCore/ChangeLog (139997 => 139998)


--- trunk/Source/WebCore/ChangeLog	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/Source/WebCore/ChangeLog	2013-01-17 18:50:59 UTC (rev 139998)
@@ -1,5 +1,21 @@
 2013-01-17  Eugene Klyuchnikov  <eus...@chromium.org>
 
+        Web Inspector: Profiler: split "getProfile" to "getCPUProfile" and "loadHeapSnapshot"
+        https://bugs.webkit.org/show_bug.cgi?id=104545
+
+        Reviewed by Yury Semikhatsky.
+
+        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.
+
+2013-01-17  Eugene Klyuchnikov  <eus...@chromium.org>
+
         Web Inspector: [Network] Memory leaks when user walks between requests.
         https://bugs.webkit.org/show_bug.cgi?id=107114
 

Modified: trunk/Source/WebCore/inspector/Inspector.json (139997 => 139998)


--- trunk/Source/WebCore/inspector/Inspector.json	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/Source/WebCore/inspector/Inspector.json	2013-01-17 18:50:59 UTC (rev 139998)
@@ -2984,7 +2984,7 @@
                 ]
             },
             {
-                "id": "Profile",
+                "id": "CPUProfile",
                 "type": "object",
                 "description": "Profile.",
                 "properties": [
@@ -3037,16 +3037,21 @@
                 ]
             },
             {
-                "name": "getProfile",
+                "name": "getCPUProfile",
                 "parameters": [
-                    { "name": "type", "type": "string" },
                     { "name": "uid", "type": "integer" }
                 ],
                 "returns": [
-                    { "name": "profile", "$ref": "Profile" }
+                    { "name": "profile", "$ref": "CPUProfile" }
                 ]
             },
             {
+                "name": "getHeapSnapshot",
+                "parameters": [
+                    { "name": "uid", "type": "integer" }
+                ]
+            },
+            {
                 "name": "removeProfile",
                 "parameters": [
                     { "name": "type", "type": "string" },

Modified: trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp (139997 => 139998)


--- trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/Source/WebCore/inspector/InspectorProfilerAgent.cpp	2013-01-17 18:50:59 UTC (rev 139998)
@@ -284,35 +284,36 @@
 
 } // namespace
 
-void InspectorProfilerAgent::getProfile(ErrorString* errorString, const String& type, int rawUid, RefPtr<TypeBuilder::Profiler::Profile>& profileObject)
+void InspectorProfilerAgent::getCPUProfile(ErrorString* errorString, int rawUid, RefPtr<TypeBuilder::Profiler::CPUProfile>& profileObject)
 {
     unsigned uid = static_cast<unsigned>(rawUid);
-    if (type == CPUProfileType) {
-        ProfilesMap::iterator it = m_profiles.find(uid);
-        if (it == m_profiles.end()) {
-            *errorString = "Profile wasn't found";
-            return;
-        }
-        profileObject = TypeBuilder::Profiler::Profile::create();
-        profileObject->setHead(it->value->buildInspectorObjectForHead());
-        if (it->value->bottomUpHead())
-            profileObject->setBottomUpHead(it->value->buildInspectorObjectForBottomUpHead());
-        profileObject->setIdleTime(it->value->idleTime());
-    } else if (type == HeapProfileType) {
-        HeapSnapshotsMap::iterator it = m_snapshots.find(uid);
-        if (it == m_snapshots.end()) {
-            *errorString = "Profile wasn't found";
-            return;
-        }
-        RefPtr<ScriptHeapSnapshot> snapshot = it->value;
-        profileObject = TypeBuilder::Profiler::Profile::create();
-        if (m_frontend) {
-            OutputStream stream(m_frontend, uid);
-            snapshot->writeJSON(&stream);
-        }
+    ProfilesMap::iterator it = m_profiles.find(uid);
+    if (it == m_profiles.end()) {
+        *errorString = "Profile wasn't found";
+        return;
     }
+    profileObject = TypeBuilder::Profiler::CPUProfile::create();
+    profileObject->setHead(it->value->buildInspectorObjectForHead());
+    if (it->value->bottomUpHead())
+        profileObject->setBottomUpHead(it->value->buildInspectorObjectForBottomUpHead());
+    profileObject->setIdleTime(it->value->idleTime());
 }
 
+void InspectorProfilerAgent::getHeapSnapshot(ErrorString* errorString, int rawUid)
+{
+    unsigned uid = static_cast<unsigned>(rawUid);
+    HeapSnapshotsMap::iterator it = m_snapshots.find(uid);
+    if (it == m_snapshots.end()) {
+        *errorString = "Profile wasn't found";
+        return;
+    }
+    RefPtr<ScriptHeapSnapshot> snapshot = it->value;
+    if (m_frontend) {
+        OutputStream stream(m_frontend, uid);
+        snapshot->writeJSON(&stream);
+    }
+}
+
 void InspectorProfilerAgent::removeProfile(ErrorString*, const String& type, int rawUid)
 {
     unsigned uid = static_cast<unsigned>(rawUid);

Modified: trunk/Source/WebCore/inspector/InspectorProfilerAgent.h (139997 => 139998)


--- trunk/Source/WebCore/inspector/InspectorProfilerAgent.h	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/Source/WebCore/inspector/InspectorProfilerAgent.h	2013-01-17 18:50:59 UTC (rev 139998)
@@ -87,7 +87,8 @@
     bool enabled() { return m_enabled; }
     String getCurrentUserInitiatedProfileName(bool incrementProfileNumber = false);
     virtual void getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Profiler::ProfileHeader> >&);
-    virtual void getProfile(ErrorString*, const String& type, int uid, RefPtr<TypeBuilder::Profiler::Profile>&);
+    virtual void getCPUProfile(ErrorString*, int uid, RefPtr<TypeBuilder::Profiler::CPUProfile>&);
+    virtual void getHeapSnapshot(ErrorString*, int uid);
     virtual void removeProfile(ErrorString*, const String& type, int uid);
 
     virtual void setFrontend(InspectorFrontend*);

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


--- trunk/Source/WebCore/inspector/front-end/CPUProfileView.js	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/Source/WebCore/inspector/front-end/CPUProfileView.js	2013-01-17 18:50:59 UTC (rev 139998)
@@ -98,7 +98,7 @@
 
     this._linkifier = new WebInspector.Linkifier(new WebInspector.Linkifier.DefaultFormatter(30));
 
-    ProfilerAgent.getProfile(this.profile.profileType().id, this.profile.uid, profileCallback.bind(this));
+    ProfilerAgent.getCPUProfile(this.profile.uid, profileCallback.bind(this));
 }
 
 WebInspector.CPUProfileView._TypeTree = "Tree";

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


--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js	2013-01-17 18:50:59 UTC (rev 139998)
@@ -872,7 +872,7 @@
             this._setupWorker();
             this.sidebarElement.subtitle = WebInspector.UIString("Loading\u2026");
             this.sidebarElement.wait = true;
-            ProfilerAgent.getProfile(this.profileType().id, this.uid);
+            ProfilerAgent.getHeapSnapshot(this.uid);
         }
         var loaderProxy = /** @type {WebInspector.HeapSnapshotLoaderProxy} */ (this._receiver);
         loaderProxy.addConsumer(callback);
@@ -977,7 +977,7 @@
             this._receiver = fileOutputStream;
             this._savedChunks = 0;
             this._updateTransferProgress(0, this._totalNumberOfChunks);
-            ProfilerAgent.getProfile(this.profileType().id, this.uid);
+            ProfilerAgent.getHeapSnapshot(this.uid);
         }
         this._savingToFile = true;
         this._fileName = this._fileName || "Heap-" + new Date().toISO8601Compact() + ".heapsnapshot";

Modified: trunk/Source/WebKit/chromium/ChangeLog (139997 => 139998)


--- trunk/Source/WebKit/chromium/ChangeLog	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/Source/WebKit/chromium/ChangeLog	2013-01-17 18:50:59 UTC (rev 139998)
@@ -1,3 +1,14 @@
+2013-01-17  Eugene Klyuchnikov  <eus...@chromium.org>
+
+        Web Inspector: Profiler: split "getProfile" to "getCPUProfile" and "loadHeapSnapshot"
+        https://bugs.webkit.org/show_bug.cgi?id=104545
+
+        Reviewed by Yury Semikhatsky.
+
+        Adopt changes: mimic old behavior.
+
+        * src/WebDevToolsAgentImpl.cpp: Adopt signature changes.
+
 2013-01-17  Yury Semikhatsky  <yu...@chromium.org>
 
         Web Inspector: add WebDeToolsAgentImpl as task observer on reattach

Modified: trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp (139997 => 139998)


--- trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/Source/WebKit/chromium/src/WebDevToolsAgentImpl.cpp	2013-01-17 18:50:59 UTC (rev 139998)
@@ -749,7 +749,8 @@
         || commandName == InspectorBackendDispatcher::commandNames[InspectorBackendDispatcher::kDebugger_setBreakpointsActiveCmd]
         || commandName == InspectorBackendDispatcher::commandNames[InspectorBackendDispatcher::kProfiler_startCmd]
         || commandName == InspectorBackendDispatcher::commandNames[InspectorBackendDispatcher::kProfiler_stopCmd]
-        || commandName == InspectorBackendDispatcher::commandNames[InspectorBackendDispatcher::kProfiler_getProfileCmd];
+        || commandName == InspectorBackendDispatcher::commandNames[InspectorBackendDispatcher::kProfiler_getCPUProfileCmd]
+        || commandName == InspectorBackendDispatcher::commandNames[InspectorBackendDispatcher::kProfiler_getHeapSnapshotCmd];
 }
 
 void WebDevToolsAgent::processPendingMessages()

Modified: trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js (139997 => 139998)


--- trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/Tools/BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js	2013-01-17 18:50:59 UTC (rev 139998)
@@ -68,10 +68,13 @@
 };
 
 var ProfilerAgent = {
-    getProfile: function(typeId, uid, callback) {
+    getCPUProfile: function(uid, callback) {
         this._callback = callback;
     },
 
+    getHeapSnapshot: function(uid, callback) {
+    },
+
     profileReady: function(head) {
         this._callback({ head: head });
     },

Modified: trunk/Tools/ChangeLog (139997 => 139998)


--- trunk/Tools/ChangeLog	2013-01-17 18:47:21 UTC (rev 139997)
+++ trunk/Tools/ChangeLog	2013-01-17 18:50:59 UTC (rev 139998)
@@ -1,3 +1,16 @@
+2013-01-17  Eugene Klyuchnikov  <eus...@chromium.org>
+
+        Web Inspector: Profiler: split "getProfile" to "getCPUProfile" and "loadHeapSnapshot"
+        https://bugs.webkit.org/show_bug.cgi?id=104545
+
+        Reviewed by Yury Semikhatsky.
+
+        Adopt signature changes.
+
+        * BuildSlaveSupport/build.webkit.org-config/public_html/LeaksViewer/WebInspectorShims.js:
+        (ProfilerAgent.getCPUProfile): Renamed.
+        (ProfilerAgent.getHeapSnapshot): Added.
+
 2013-01-17  Zan Dobersek  <zdober...@igalia.com>
 
         [GTK][EFL] NWRT should check that Xvfb is installed
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to