Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: LayoutTests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js

Issue 98273008: [DevTools] Send heap snapshot to the frontend immediatly when it is ready (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed test crash Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: LayoutTests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js
diff --git a/LayoutTests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js b/LayoutTests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js
index c1b2fab9f0fc7f601e33cc8213b11bbe4de98776..7cbf4900569909e4975fc90c1c1e64ebcfc7730c 100644
--- a/LayoutTests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js
+++ b/LayoutTests/inspector-protocol/heap-profiler/resources/heap-snapshot-common.js
@@ -23,32 +23,20 @@ InspectorTest.assert = function(result, message)
InspectorTest.takeHeapSnapshot = function(callback)
{
- InspectorTest.eventHandler["HeapProfiler.addProfileHeader"] = function(messageObject)
+ var chunks = [];
+ InspectorTest.eventHandler["HeapProfiler.addHeapSnapshotChunk"] = function(messageObject)
{
- var profileId = messageObject["params"]["header"]["uid"];
- InspectorTest.sendCommand("HeapProfiler.getHeapSnapshot", { "uid": profileId }, didGetHeapSnapshot);
-
- var chunks = [];
- InspectorTest.eventHandler["HeapProfiler.addHeapSnapshotChunk"] = function(messageObject)
- {
- chunks.push(messageObject["params"]["chunk"]);
- }
-
- function didGetHeapSnapshot(messageObject)
- {
- var serializedSnapshot = chunks.join("");
- var parsed = JSON.parse(serializedSnapshot);
- var snapshot = new WebInspector.JSHeapSnapshot(parsed, new WebInspector.HeapSnapshotProgress());
- callback(snapshot);
- InspectorTest.log("SUCCESS: didGetHeapSnapshot");
- InspectorTest.sendCommand("HeapProfiler.removeProfile", { "uid": profileId }, didRemoveSnapshot);
- }
-
- function didRemoveSnapshot(messageObject)
- {
- InspectorTest.completeTest();
- }
+ chunks.push(messageObject["params"]["chunk"]);
}
- InspectorTest.sendCommand("HeapProfiler.takeHeapSnapshot", {});
+ function didTakeHeapSnapshot(messageObject)
+ {
+ var serializedSnapshot = chunks.join("");
+ var parsed = JSON.parse(serializedSnapshot);
+ var snapshot = new WebInspector.JSHeapSnapshot(parsed, new WebInspector.HeapSnapshotProgress());
+ callback(snapshot);
+ InspectorTest.log("SUCCESS: didGetHeapSnapshot");
+ InspectorTest.completeTest();
+ }
+ InspectorTest.sendCommand("HeapProfiler.takeHeapSnapshot", {}, didTakeHeapSnapshot);
}

Powered by Google App Engine
This is Rietveld 408576698