Web Inspector: We should have a way to capture heap snapshots programatically.
[WebKit-https.git] / Source / WebInspectorUI / UserInterface / Protocol / ConsoleObserver.js
index cfc2fc0..c42dc80 100644 (file)
@@ -52,4 +52,13 @@ WebInspector.ConsoleObserver = class ConsoleObserver
     {
         WebInspector.logManager.messagesCleared();
     }
+
+    heapSnapshot(timestamp, snapshotStringData, title)
+    {
+        let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+        workerProxy.createSnapshot(snapshotStringData, title || null, ({objectId, snapshot: serializedSnapshot}) => {
+            let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+            WebInspector.timelineManager.heapSnapshotAdded(timestamp, snapshot);
+        });
+    }
 };