| OLD | NEW |
| 1 // This script is supposed to be evaluated in dummy inspector front-end which is
loaded from | 1 // This script is supposed to be evaluated in dummy inspector front-end which is
loaded from |
| 2 // ../../../http/tests/inspector-protocol/resources/protocol-test.html and the r
elative paths | 2 // ../../../http/tests/inspector-protocol/resources/protocol-test.html and the r
elative paths |
| 3 // below are relative to that location. | 3 // below are relative to that location. |
| 4 | 4 |
| 5 if (!window.WebInspector) | 5 if (!window.WebInspector) |
| 6 window.WebInspector = {}; | 6 window.WebInspector = {}; |
| 7 InspectorTest.importScript("../../../../../Source/devtools/front_end/HeapSnapsho
t.js"); | 7 InspectorTest.importScript("../../../../../Source/devtools/front_end/HeapSnapsho
t.js"); |
| 8 InspectorTest.importScript("../../../../../Source/devtools/front_end/JSHeapSnaps
hot.js"); | 8 InspectorTest.importScript("../../../../../Source/devtools/front_end/JSHeapSnaps
hot.js"); |
| 9 InspectorTest.importScript("../../../../../Source/devtools/front_end/UIString.js
"); | 9 InspectorTest.importScript("../../../../../Source/devtools/front_end/UIString.js
"); |
| 10 InspectorTest.importScript("../../../../../Source/devtools/front_end/utilities.j
s"); | 10 InspectorTest.importScript("../../../../../Source/devtools/front_end/utilities.j
s"); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 InspectorTest.fail(message); | 21 InspectorTest.fail(message); |
| 22 } | 22 } |
| 23 | 23 |
| 24 InspectorTest.takeHeapSnapshot = function(callback) | 24 InspectorTest.takeHeapSnapshot = function(callback) |
| 25 { | 25 { |
| 26 InspectorTest.eventHandler["HeapProfiler.addProfileHeader"] = function(messa
geObject) | 26 InspectorTest.eventHandler["HeapProfiler.addProfileHeader"] = function(messa
geObject) |
| 27 { | 27 { |
| 28 var profileId = messageObject["params"]["header"]["uid"]; | 28 var profileId = messageObject["params"]["header"]["uid"]; |
| 29 InspectorTest.sendCommand("HeapProfiler.getHeapSnapshot", { "uid": profi
leId }, didGetHeapSnapshot); | 29 InspectorTest.sendCommand("HeapProfiler.getHeapSnapshot", { "uid": profi
leId }, didGetHeapSnapshot); |
| 30 | 30 |
| 31 var chunks = []; |
| 32 InspectorTest.eventHandler["HeapProfiler.addHeapSnapshotChunk"] = functi
on(messageObject) |
| 33 { |
| 34 chunks.push(messageObject["params"]["chunk"]); |
| 35 } |
| 36 |
| 31 function didGetHeapSnapshot(messageObject) | 37 function didGetHeapSnapshot(messageObject) |
| 32 { | 38 { |
| 39 var serializedSnapshot = chunks.join(""); |
| 40 var parsed = JSON.parse(serializedSnapshot); |
| 41 var snapshot = new WebInspector.JSHeapSnapshot(parsed, new WebInspec
tor.HeapSnapshotProgress()); |
| 42 callback(snapshot); |
| 33 InspectorTest.log("SUCCESS: didGetHeapSnapshot"); | 43 InspectorTest.log("SUCCESS: didGetHeapSnapshot"); |
| 34 InspectorTest.sendCommand("HeapProfiler.removeProfile", { "uid": pro
fileId }, didRemoveSnapshot); | 44 InspectorTest.sendCommand("HeapProfiler.removeProfile", { "uid": pro
fileId }, didRemoveSnapshot); |
| 35 } | 45 } |
| 36 | 46 |
| 37 function didRemoveSnapshot(messageObject) | 47 function didRemoveSnapshot(messageObject) |
| 38 { | 48 { |
| 39 InspectorTest.completeTest(); | 49 InspectorTest.completeTest(); |
| 40 } | 50 } |
| 41 | |
| 42 } | |
| 43 | |
| 44 var chunks = []; | |
| 45 InspectorTest.eventHandler["HeapProfiler.addHeapSnapshotChunk"] = function(m
essageObject) | |
| 46 { | |
| 47 chunks.push(messageObject["params"]["chunk"]); | |
| 48 } | |
| 49 | |
| 50 InspectorTest.eventHandler["HeapProfiler.finishHeapSnapshot"] = function(mes
sageObject) | |
| 51 { | |
| 52 var serializedSnapshot = chunks.join(""); | |
| 53 var parsed = JSON.parse(serializedSnapshot); | |
| 54 var snapshot = new WebInspector.JSHeapSnapshot(parsed, new WebInspector.
HeapSnapshotProgress()); | |
| 55 callback(snapshot); | |
| 56 } | 51 } |
| 57 | 52 |
| 58 InspectorTest.sendCommand("HeapProfiler.takeHeapSnapshot", {}); | 53 InspectorTest.sendCommand("HeapProfiler.takeHeapSnapshot", {}); |
| 59 } | 54 } |
| OLD | NEW |