<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[198786] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/198786">198786</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-03-29 11:51:35 -0700 (Tue, 29 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: We should have a way to capture heap snapshots programatically.
https://bugs.webkit.org/show_bug.cgi?id=154407
&lt;rdar://problem/24726292&gt;

Patch by Joseph Pecoraro &lt;pecoraro@apple.com&gt; on 2016-03-29
Reviewed by Timothy Hatcher.

Source/JavaScriptCore:

* inspector/protocol/Console.json:
Add a new Console.heapSnapshot event for when a heap snapshot is taken.

* runtime/ConsolePrototype.cpp:
(JSC::ConsolePrototype::finishCreation):
(JSC::consoleProtoFuncProfile):
(JSC::consoleProtoFuncProfileEnd):
(JSC::consoleProtoFuncTakeHeapSnapshot):
* runtime/ConsoleClient.h:
Add the console.takeHeapSnapshot method and dispatch to the ConsoleClient.

* inspector/JSGlobalObjectConsoleClient.cpp:
(Inspector::JSGlobalObjectConsoleClient::takeHeapSnapshot):
* inspector/JSGlobalObjectConsoleClient.h:
Have the InspectorConsoleAgent handle this.

* inspector/JSGlobalObjectInspectorController.cpp:
(Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
* inspector/agents/InspectorConsoleAgent.cpp:
(Inspector::InspectorConsoleAgent::InspectorConsoleAgent):
(Inspector::InspectorConsoleAgent::takeHeapSnapshot):
* inspector/agents/InspectorConsoleAgent.h:
* inspector/agents/JSGlobalObjectConsoleAgent.cpp:
(Inspector::JSGlobalObjectConsoleAgent::JSGlobalObjectConsoleAgent):
* inspector/agents/JSGlobalObjectConsoleAgent.h:
Give the ConsoleAgent a HeapAgent pointer so that it can have the HeapAgent
perform the snapshot building work like it normally does.

Source/WebCore:

Test: inspector/console/heapSnapshot.html

* page/PageConsoleClient.cpp:
(WebCore::PageConsoleClient::takeHeapSnapshot):
* page/PageConsoleClient.h:
Pass through to Inspector Instrumentation.

* inspector/InspectorConsoleInstrumentation.h:
(WebCore::InspectorInstrumentation::takeHeapSnapshot):
* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::takeHeapSnapshotImpl):
* inspector/InspectorInstrumentation.h:
Pass through to InspectorConsoleAgent.

* inspector/InspectorController.cpp:
(WebCore::InspectorController::InspectorController):
* inspector/PageConsoleAgent.cpp:
(WebCore::PageConsoleAgent::PageConsoleAgent):
* inspector/PageConsoleAgent.h:
* inspector/WebConsoleAgent.cpp:
(WebCore::WebConsoleAgent::WebConsoleAgent):
* inspector/WebConsoleAgent.h:
* workers/WorkerConsoleClient.cpp:
(WebCore::WorkerConsoleClient::takeHeapSnapshot):
* workers/WorkerConsoleClient.h:
Provide a HeapAgent to the ConsoleAgent.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Protocol/ConsoleObserver.js:
(WebInspector.ConsoleObserver.prototype.heapSnapshot):
(WebInspector.ConsoleObserver):
Create a HeapSnapshot with an optional title and add to the timeline.

(WebInspector.HeapAllocationsTimelineDataGridNode):
* UserInterface/Views/TimelineTabContentView.js:
(WebInspector.TimelineTabContentView.displayNameForRecord):
Share code for snapshot display names which may now include a title.

* UserInterface/Proxies/HeapSnapshotProxy.js:
(WebInspector.HeapSnapshotProxy):
(WebInspector.HeapSnapshotProxy.deserialize):
(WebInspector.HeapSnapshotProxy.prototype.get title):
* UserInterface/Views/HeapAllocationsTimelineDataGridNode.js:
* UserInterface/Workers/HeapSnapshot/HeapSnapshot.js:
(HeapSnapshot):
(HeapSnapshot.prototype.serialize):
* UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js:
(HeapSnapshotWorker.prototype.createSnapshot):
Include an optional title in a HeapSnapshot.

LayoutTests:

* inspector/console/heapSnapshot-expected.txt: Added.
* inspector/console/heapSnapshot.html: Added.
Test that we get expected data and events after calling
console.takeHeapSnapshot when the inspector is open.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSGlobalObjectConsoleClientcpp">trunk/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSGlobalObjectConsoleClienth">trunk/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorJSGlobalObjectInspectorControllercpp">trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorConsoleAgentcpp">trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsInspectorConsoleAgenth">trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsJSGlobalObjectConsoleAgentcpp">trunk/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectoragentsJSGlobalObjectConsoleAgenth">trunk/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolConsolejson">trunk/Source/JavaScriptCore/inspector/protocol/Console.json</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeConsoleClienth">trunk/Source/JavaScriptCore/runtime/ConsoleClient.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeConsolePrototypecpp">trunk/Source/JavaScriptCore/runtime/ConsolePrototype.cpp</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorConsoleInstrumentationh">trunk/Source/WebCore/inspector/InspectorConsoleInstrumentation.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorControllercpp">trunk/Source/WebCore/inspector/InspectorController.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorInstrumentationcpp">trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorInstrumentationh">trunk/Source/WebCore/inspector/InspectorInstrumentation.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorPageConsoleAgentcpp">trunk/Source/WebCore/inspector/PageConsoleAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorPageConsoleAgenth">trunk/Source/WebCore/inspector/PageConsoleAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorWebConsoleAgentcpp">trunk/Source/WebCore/inspector/WebConsoleAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorWebConsoleAgenth">trunk/Source/WebCore/inspector/WebConsoleAgent.h</a></li>
<li><a href="#trunkSourceWebCorepagePageConsoleClientcpp">trunk/Source/WebCore/page/PageConsoleClient.cpp</a></li>
<li><a href="#trunkSourceWebCorepagePageConsoleClienth">trunk/Source/WebCore/page/PageConsoleClient.h</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkerConsoleClientcpp">trunk/Source/WebCore/workers/WorkerConsoleClient.cpp</a></li>
<li><a href="#trunkSourceWebCoreworkersWorkerConsoleClienth">trunk/Source/WebCore/workers/WorkerConsoleClient.h</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs">trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolConsoleObserverjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProxiesHeapSnapshotProxyjs">trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotProxy.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsHeapAllocationsTimelineDataGridNodejs">trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTimelineTabContentViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceWorkersHeapSnapshotHeapSnapshotjs">trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceWorkersHeapSnapshotHeapSnapshotWorkerjs">trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsinspectorconsoleheapSnapshotexpectedtxt">trunk/LayoutTests/inspector/console/heapSnapshot-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectorconsoleheapSnapshothtml">trunk/LayoutTests/inspector/console/heapSnapshot.html</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/LayoutTests/ChangeLog        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2016-03-29  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: We should have a way to capture heap snapshots programatically.
+        https://bugs.webkit.org/show_bug.cgi?id=154407
+        &lt;rdar://problem/24726292&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/console/heapSnapshot-expected.txt: Added.
+        * inspector/console/heapSnapshot.html: Added.
+        Test that we get expected data and events after calling
+        console.takeHeapSnapshot when the inspector is open.
+
</ins><span class="cx"> 2016-03-29  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         media/track/track-remove-track.html is flaky, crashing and failing
</span></span></pre></div>
<a id="trunkLayoutTestsinspectorconsoleheapSnapshotexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/console/heapSnapshot-expected.txt (0 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/heapSnapshot-expected.txt                                (rev 0)
+++ trunk/LayoutTests/inspector/console/heapSnapshot-expected.txt        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+Test for the Console.heapSnapshot event triggered by console.takeHeapSnapshot.
+
+
+== Running test suite: Console.heapSnapshot
+-- Running test case: TriggerHeapSnapshotNoTitle
+Console.heapSnapshot
+PASS: Should have a timestamp.
+PASS: Should have snapshotData.
+PASS: Should not have a title.
+
+-- Running test case: TriggerHeapSnapshotWithTitle
+Console.heapSnapshot
+PASS: Should have a timestamp.
+PASS: Should have snapshotData.
+PASS: Should have expected title.
+
</ins></span></pre></div>
<a id="trunkLayoutTestsinspectorconsoleheapSnapshothtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/inspector/console/heapSnapshot.html (0 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/console/heapSnapshot.html                                (rev 0)
+++ trunk/LayoutTests/inspector/console/heapSnapshot.html        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -0,0 +1,55 @@
</span><ins>+&lt;!DOCTYPE html&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../../http/tests/inspector/resources/protocol-test.js&quot;&gt;&lt;/script&gt;
+&lt;script&gt;
+function triggerHeapSnapshotNoTitle() {
+    console.takeHeapSnapshot();
+}
+
+function triggerHeapSnapshotWithTitle() {
+    console.takeHeapSnapshot(&quot;Snapshot Title&quot;);
+}
+
+function test()
+{
+    let suite = ProtocolTest.createAsyncSuite(&quot;Console.heapSnapshot&quot;);
+
+    suite.addTestCase({
+        name: &quot;TriggerHeapSnapshotNoTitle&quot;,
+        test: function(resolve, reject) {
+            InspectorProtocol.awaitEvent({event: &quot;Console.heapSnapshot&quot;}).then((messageObject) =&gt; {
+                ProtocolTest.log(&quot;Console.heapSnapshot&quot;);
+                ProtocolTest.expectThat(typeof messageObject.params.timestamp === &quot;number&quot;, &quot;Should have a timestamp.&quot;);
+                ProtocolTest.expectThat(typeof messageObject.params.snapshotData === &quot;string&quot;, &quot;Should have snapshotData.&quot;);
+                ProtocolTest.expectThat(!messageObject.params.title, &quot;Should not have a title.&quot;);
+                resolve();
+            });
+
+            ProtocolTest.evaluateInPage(&quot;triggerHeapSnapshotNoTitle()&quot;);
+        }
+    });
+
+    suite.addTestCase({
+        name: &quot;TriggerHeapSnapshotWithTitle&quot;,
+        test: function(resolve, reject) {
+            InspectorProtocol.awaitEvent({event: &quot;Console.heapSnapshot&quot;}).then((messageObject) =&gt; {
+                ProtocolTest.log(&quot;Console.heapSnapshot&quot;);
+                ProtocolTest.expectThat(typeof messageObject.params.timestamp === &quot;number&quot;, &quot;Should have a timestamp.&quot;);
+                ProtocolTest.expectThat(typeof messageObject.params.snapshotData === &quot;string&quot;, &quot;Should have snapshotData.&quot;);
+                ProtocolTest.expectThat(messageObject.params.title === &quot;Snapshot Title&quot;, &quot;Should have expected title.&quot;);
+                resolve();
+            });
+
+            ProtocolTest.evaluateInPage(&quot;triggerHeapSnapshotWithTitle()&quot;);
+        }
+    });
+
+    suite.runTestCasesAndFinish();
+}
+&lt;/script&gt;
+&lt;/head&gt;
+&lt;body onload=&quot;runTest()&quot;&gt;
+&lt;p&gt;Test for the Console.heapSnapshot event triggered by console.takeHeapSnapshot.&lt;/p&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -1,3 +1,39 @@
</span><ins>+2016-03-29  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: We should have a way to capture heap snapshots programatically.
+        https://bugs.webkit.org/show_bug.cgi?id=154407
+        &lt;rdar://problem/24726292&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        * inspector/protocol/Console.json:
+        Add a new Console.heapSnapshot event for when a heap snapshot is taken.
+
+        * runtime/ConsolePrototype.cpp:
+        (JSC::ConsolePrototype::finishCreation):
+        (JSC::consoleProtoFuncProfile):
+        (JSC::consoleProtoFuncProfileEnd):
+        (JSC::consoleProtoFuncTakeHeapSnapshot):
+        * runtime/ConsoleClient.h:
+        Add the console.takeHeapSnapshot method and dispatch to the ConsoleClient.
+
+        * inspector/JSGlobalObjectConsoleClient.cpp:
+        (Inspector::JSGlobalObjectConsoleClient::takeHeapSnapshot):
+        * inspector/JSGlobalObjectConsoleClient.h:
+        Have the InspectorConsoleAgent handle this.
+
+        * inspector/JSGlobalObjectInspectorController.cpp:
+        (Inspector::JSGlobalObjectInspectorController::JSGlobalObjectInspectorController):
+        * inspector/agents/InspectorConsoleAgent.cpp:
+        (Inspector::InspectorConsoleAgent::InspectorConsoleAgent):
+        (Inspector::InspectorConsoleAgent::takeHeapSnapshot):
+        * inspector/agents/InspectorConsoleAgent.h:
+        * inspector/agents/JSGlobalObjectConsoleAgent.cpp:
+        (Inspector::JSGlobalObjectConsoleAgent::JSGlobalObjectConsoleAgent):
+        * inspector/agents/JSGlobalObjectConsoleAgent.h:
+        Give the ConsoleAgent a HeapAgent pointer so that it can have the HeapAgent
+        perform the snapshot building work like it normally does.
+
</ins><span class="cx"> 2016-03-29  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r192914): 10% regression on Sunspider's date-format-tofte
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSGlobalObjectConsoleClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.cpp        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -83,6 +83,11 @@
</span><span class="cx">     // FIXME: support |console.profile| for JSContexts. &lt;https://webkit.org/b/136466&gt;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void JSGlobalObjectConsoleClient::takeHeapSnapshot(JSC::ExecState*, const String&amp; title)
+{
+    m_consoleAgent-&gt;takeHeapSnapshot(title);
+}
+
</ins><span class="cx"> void JSGlobalObjectConsoleClient::time(ExecState*, const String&amp; title)
</span><span class="cx"> {
</span><span class="cx">     m_consoleAgent-&gt;startTiming(title);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSGlobalObjectConsoleClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/JavaScriptCore/inspector/JSGlobalObjectConsoleClient.h        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx">     void count(JSC::ExecState*, RefPtr&lt;ScriptArguments&gt;&amp;&amp;) override;
</span><span class="cx">     void profile(JSC::ExecState*, const String&amp; title) override;
</span><span class="cx">     void profileEnd(JSC::ExecState*, const String&amp; title) override;
</span><ins>+    void takeHeapSnapshot(JSC::ExecState*, const String&amp; title) override;
</ins><span class="cx">     void time(JSC::ExecState*, const String&amp; title) override;
</span><span class="cx">     void timeEnd(JSC::ExecState*, const String&amp; title) override;
</span><span class="cx">     void timeStamp(JSC::ExecState*, RefPtr&lt;ScriptArguments&gt;&amp;&amp;) override;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorJSGlobalObjectInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/JavaScriptCore/inspector/JSGlobalObjectInspectorController.cpp        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -85,7 +85,8 @@
</span><span class="cx"> 
</span><span class="cx">     auto inspectorAgent = std::make_unique&lt;InspectorAgent&gt;(context);
</span><span class="cx">     auto runtimeAgent = std::make_unique&lt;JSGlobalObjectRuntimeAgent&gt;(context);
</span><del>-    auto consoleAgent = std::make_unique&lt;JSGlobalObjectConsoleAgent&gt;(context);
</del><ins>+    auto heapAgent = std::make_unique&lt;InspectorHeapAgent&gt;(context);
+    auto consoleAgent = std::make_unique&lt;JSGlobalObjectConsoleAgent&gt;(context, heapAgent.get());
</ins><span class="cx">     auto debuggerAgent = std::make_unique&lt;JSGlobalObjectDebuggerAgent&gt;(context, consoleAgent.get());
</span><span class="cx"> 
</span><span class="cx">     m_inspectorAgent = inspectorAgent.get();
</span><span class="lines">@@ -97,7 +98,7 @@
</span><span class="cx">     m_agents.append(WTFMove(runtimeAgent));
</span><span class="cx">     m_agents.append(WTFMove(consoleAgent));
</span><span class="cx">     m_agents.append(WTFMove(debuggerAgent));
</span><del>-    m_agents.append(std::make_unique&lt;InspectorHeapAgent&gt;(context));
</del><ins>+    m_agents.append(WTFMove(heapAgent));
</ins><span class="cx">     m_agents.append(std::make_unique&lt;InspectorScriptProfilerAgent&gt;(context));
</span><span class="cx"> 
</span><span class="cx">     m_executionStopwatch-&gt;start();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorConsoleAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.cpp        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #include &quot;ConsoleMessage.h&quot;
</span><span class="cx"> #include &quot;InjectedScriptManager.h&quot;
</span><span class="cx"> #include &quot;InspectorFrontendRouter.h&quot;
</span><ins>+#include &quot;InspectorHeapAgent.h&quot;
</ins><span class="cx"> #include &quot;ScriptArguments.h&quot;
</span><span class="cx"> #include &quot;ScriptCallFrame.h&quot;
</span><span class="cx"> #include &quot;ScriptCallStack.h&quot;
</span><span class="lines">@@ -43,11 +44,12 @@
</span><span class="cx"> static const unsigned maximumConsoleMessages = 100;
</span><span class="cx"> static const int expireConsoleMessagesStep = 10;
</span><span class="cx"> 
</span><del>-InspectorConsoleAgent::InspectorConsoleAgent(AgentContext&amp; context)
</del><ins>+InspectorConsoleAgent::InspectorConsoleAgent(AgentContext&amp; context, InspectorHeapAgent* heapAgent)
</ins><span class="cx">     : InspectorAgentBase(ASCIILiteral(&quot;Console&quot;))
</span><span class="cx">     , m_injectedScriptManager(context.injectedScriptManager)
</span><span class="cx">     , m_frontendDispatcher(std::make_unique&lt;ConsoleFrontendDispatcher&gt;(context.frontendRouter))
</span><span class="cx">     , m_backendDispatcher(ConsoleBackendDispatcher::create(context.backendDispatcher, this))
</span><ins>+    , m_heapAgent(heapAgent)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -153,6 +155,19 @@
</span><span class="cx">     addMessageToConsole(std::make_unique&lt;ConsoleMessage&gt;(MessageSource::ConsoleAPI, MessageType::Timing, MessageLevel::Debug, message, callStack));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InspectorConsoleAgent::takeHeapSnapshot(const String&amp; title)
+{
+    if (!m_injectedScriptManager.inspectorEnvironment().developerExtrasEnabled())
+        return;
+
+    ErrorString ignored;
+    double timestamp;
+    String snapshotData;
+    m_heapAgent-&gt;snapshot(ignored, &amp;timestamp, &amp;snapshotData);
+
+    m_frontendDispatcher-&gt;heapSnapshot(timestamp, snapshotData, title.isEmpty() ? nullptr : &amp;title);
+}
+
</ins><span class="cx"> void InspectorConsoleAgent::count(JSC::ExecState* state, PassRefPtr&lt;ScriptArguments&gt; arguments)
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;ScriptCallStack&gt; callStack(createScriptCallStackForConsole(state, ScriptCallStack::maxCallStackSizeToCapture));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsInspectorConsoleAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/JavaScriptCore/inspector/agents/InspectorConsoleAgent.h        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> 
</span><span class="cx"> class ConsoleMessage;
</span><span class="cx"> class InjectedScriptManager;
</span><ins>+class InspectorHeapAgent;
</ins><span class="cx"> class ScriptArguments;
</span><span class="cx"> class ScriptCallStack;
</span><span class="cx"> typedef String ErrorString;
</span><span class="lines">@@ -52,7 +53,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(InspectorConsoleAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    InspectorConsoleAgent(AgentContext&amp;);
</del><ins>+    InspectorConsoleAgent(AgentContext&amp;, InspectorHeapAgent*);
</ins><span class="cx">     virtual ~InspectorConsoleAgent();
</span><span class="cx"> 
</span><span class="cx">     void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
</span><span class="lines">@@ -71,6 +72,7 @@
</span><span class="cx"> 
</span><span class="cx">     void startTiming(const String&amp; title);
</span><span class="cx">     void stopTiming(const String&amp; title, PassRefPtr&lt;ScriptCallStack&gt;);
</span><ins>+    void takeHeapSnapshot(const String&amp; title);
</ins><span class="cx">     void count(JSC::ExecState*, PassRefPtr&lt;ScriptArguments&gt;);
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="lines">@@ -79,6 +81,7 @@
</span><span class="cx">     InjectedScriptManager&amp; m_injectedScriptManager;
</span><span class="cx">     std::unique_ptr&lt;ConsoleFrontendDispatcher&gt; m_frontendDispatcher;
</span><span class="cx">     RefPtr&lt;ConsoleBackendDispatcher&gt; m_backendDispatcher;
</span><ins>+    InspectorHeapAgent* m_heapAgent;
</ins><span class="cx"> 
</span><span class="cx">     ConsoleMessage* m_previousMessage { nullptr };
</span><span class="cx">     Vector&lt;std::unique_ptr&lt;ConsoleMessage&gt;&gt; m_consoleMessages;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsJSGlobalObjectConsoleAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.cpp        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -28,8 +28,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace Inspector {
</span><span class="cx"> 
</span><del>-JSGlobalObjectConsoleAgent::JSGlobalObjectConsoleAgent(AgentContext&amp; context)
-    : InspectorConsoleAgent(context)
</del><ins>+JSGlobalObjectConsoleAgent::JSGlobalObjectConsoleAgent(AgentContext&amp; context, InspectorHeapAgent* heapAgent)
+    : InspectorConsoleAgent(context, heapAgent)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectoragentsJSGlobalObjectConsoleAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.h (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.h        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/JavaScriptCore/inspector/agents/JSGlobalObjectConsoleAgent.h        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -35,7 +35,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(JSGlobalObjectConsoleAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    JSGlobalObjectConsoleAgent(AgentContext&amp;);
</del><ins>+    JSGlobalObjectConsoleAgent(AgentContext&amp;, InspectorHeapAgent*);
</ins><span class="cx">     virtual ~JSGlobalObjectConsoleAgent() { }
</span><span class="cx"> 
</span><span class="cx">     // FIXME: XHRs and Nodes only makes sense debugging a Web context. Can this be moved to a different agent?
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolConsolejson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/Console.json (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/Console.json        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/JavaScriptCore/inspector/protocol/Console.json        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -84,6 +84,15 @@
</span><span class="cx">         {
</span><span class="cx">             &quot;name&quot;: &quot;messagesCleared&quot;,
</span><span class="cx">             &quot;description&quot;: &quot;Issued when console is cleared. This happens either upon &lt;code&gt;clearMessages&lt;/code&gt; command or after page navigation.&quot;
</span><ins>+        },
+        {
+            &quot;name&quot;: &quot;heapSnapshot&quot;,
+            &quot;description&quot;: &quot;Issued from console.takeHeapSnapshot.&quot;,
+            &quot;parameters&quot;: [
+                { &quot;name&quot;: &quot;timestamp&quot;, &quot;type&quot;: &quot;number&quot; },
+                { &quot;name&quot;: &quot;snapshotData&quot;, &quot;$ref&quot;: &quot;Heap.HeapSnapshotData&quot;, &quot;description&quot;: &quot;Snapshot at the end of tracking.&quot; },
+                { &quot;name&quot;: &quot;title&quot;, &quot;type&quot;: &quot;string&quot;, &quot;optional&quot;: true, &quot;description&quot;: &quot;Optional title provided to console.takeHeapSnapshot.&quot; }
+            ]
</ins><span class="cx">         }
</span><span class="cx">     ]
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeConsoleClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ConsoleClient.h (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ConsoleClient.h        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/JavaScriptCore/runtime/ConsoleClient.h        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -59,6 +59,7 @@
</span><span class="cx">     virtual void count(ExecState*, RefPtr&lt;Inspector::ScriptArguments&gt;&amp;&amp;) = 0;
</span><span class="cx">     virtual void profile(ExecState*, const String&amp; title) = 0;
</span><span class="cx">     virtual void profileEnd(ExecState*, const String&amp; title) = 0;
</span><ins>+    virtual void takeHeapSnapshot(ExecState*, const String&amp; title) = 0;
</ins><span class="cx">     virtual void time(ExecState*, const String&amp; title) = 0;
</span><span class="cx">     virtual void timeEnd(ExecState*, const String&amp; title) = 0;
</span><span class="cx">     virtual void timeStamp(ExecState*, RefPtr&lt;Inspector::ScriptArguments&gt;&amp;&amp;) = 0;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeConsolePrototypecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/ConsolePrototype.cpp (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/ConsolePrototype.cpp        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/JavaScriptCore/runtime/ConsolePrototype.cpp        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -52,6 +52,7 @@
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL consoleProtoFuncCount(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfile(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL consoleProtoFuncProfileEnd(ExecState*);
</span><ins>+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTakeHeapSnapshot(ExecState*);
</ins><span class="cx"> static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState*);
</span><span class="cx"> static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeStamp(ExecState*);
</span><span class="lines">@@ -86,6 +87,7 @@
</span><span class="cx">     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(&quot;time&quot;, consoleProtoFuncTime, None, 0);
</span><span class="cx">     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(&quot;timeEnd&quot;, consoleProtoFuncTimeEnd, None, 0);
</span><span class="cx">     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(&quot;timeStamp&quot;, consoleProtoFuncTimeStamp, None, 0);
</span><ins>+    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(&quot;takeHeapSnapshot&quot;, consoleProtoFuncTakeHeapSnapshot, None, 0);
</ins><span class="cx">     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(&quot;group&quot;, consoleProtoFuncGroup, None, 0);
</span><span class="cx">     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(&quot;groupCollapsed&quot;, consoleProtoFuncGroupCollapsed, None, 0);
</span><span class="cx">     JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION(&quot;groupEnd&quot;, consoleProtoFuncGroupEnd, None, 0);
</span><span class="lines">@@ -258,7 +260,7 @@
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx"> 
</span><span class="cx">     size_t argsCount = exec-&gt;argumentCount();
</span><del>-    if (argsCount &lt;= 0) {
</del><ins>+    if (!argsCount) {
</ins><span class="cx">         client-&gt;profile(exec, String());
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     }
</span><span class="lines">@@ -282,7 +284,7 @@
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx"> 
</span><span class="cx">     size_t argsCount = exec-&gt;argumentCount();
</span><del>-    if (argsCount &lt;= 0) {
</del><ins>+    if (!argsCount) {
</ins><span class="cx">         client-&gt;profileEnd(exec, String());
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx">     }
</span><span class="lines">@@ -295,6 +297,30 @@
</span><span class="cx">     return JSValue::encode(jsUndefined());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTakeHeapSnapshot(ExecState* exec)
+{
+    JSConsole* castedThis = jsDynamicCast&lt;JSConsole*&gt;(exec-&gt;thisValue());
+    if (!castedThis)
+        return throwVMTypeError(exec);
+    ASSERT_GC_OBJECT_INHERITS(castedThis, JSConsole::info());
+    ConsoleClient* client = castedThis-&gt;globalObject()-&gt;consoleClient();
+    if (!client)
+        return JSValue::encode(jsUndefined());
+
+    size_t argsCount = exec-&gt;argumentCount();
+    if (!argsCount) {
+        client-&gt;takeHeapSnapshot(exec, String());
+        return JSValue::encode(jsUndefined());
+    }
+
+    const String&amp; title(valueToStringWithUndefinedOrNullCheck(exec, exec-&gt;argument(0)));
+    if (exec-&gt;hadException())
+        return JSValue::encode(jsUndefined());
+
+    client-&gt;takeHeapSnapshot(exec, title);
+    return JSValue::encode(jsUndefined());
+}
+
</ins><span class="cx"> static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState* exec)
</span><span class="cx"> {
</span><span class="cx">     JSConsole* castedThis = jsDynamicCast&lt;JSConsole*&gt;(exec-&gt;thisValue());
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/ChangeLog        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2016-03-29  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: We should have a way to capture heap snapshots programatically.
+        https://bugs.webkit.org/show_bug.cgi?id=154407
+        &lt;rdar://problem/24726292&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        Test: inspector/console/heapSnapshot.html
+
+        * page/PageConsoleClient.cpp:
+        (WebCore::PageConsoleClient::takeHeapSnapshot):
+        * page/PageConsoleClient.h:
+        Pass through to Inspector Instrumentation.
+
+        * inspector/InspectorConsoleInstrumentation.h:
+        (WebCore::InspectorInstrumentation::takeHeapSnapshot):
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::takeHeapSnapshotImpl):
+        * inspector/InspectorInstrumentation.h:
+        Pass through to InspectorConsoleAgent.
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::InspectorController):
+        * inspector/PageConsoleAgent.cpp:
+        (WebCore::PageConsoleAgent::PageConsoleAgent):
+        * inspector/PageConsoleAgent.h:
+        * inspector/WebConsoleAgent.cpp:
+        (WebCore::WebConsoleAgent::WebConsoleAgent):
+        * inspector/WebConsoleAgent.h:
+        * workers/WorkerConsoleClient.cpp:
+        (WebCore::WorkerConsoleClient::takeHeapSnapshot):
+        * workers/WorkerConsoleClient.h:
+        Provide a HeapAgent to the ConsoleAgent.
+
</ins><span class="cx"> 2016-03-29  Zalan Bujtas  &lt;zalan@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION (r196813): Missing plug-in placeholder is missing
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorConsoleInstrumentationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorConsoleInstrumentation.h (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorConsoleInstrumentation.h        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/inspector/InspectorConsoleInstrumentation.h        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -54,6 +54,13 @@
</span><span class="cx">     consoleCountImpl(instrumentingAgentsForPage(page), state, WTFMove(arguments));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline void InspectorInstrumentation::takeHeapSnapshot(Frame&amp; frame, const String&amp; title)
+{
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
+        takeHeapSnapshotImpl(*instrumentingAgents, title);
+}
+
</ins><span class="cx"> inline void InspectorInstrumentation::startConsoleTiming(Frame&amp; frame, const String&amp; title)
</span><span class="cx"> {
</span><span class="cx">     if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(frame))
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorController.cpp        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -162,7 +162,11 @@
</span><span class="cx">     m_timelineAgent = timelineAgentPtr.get();
</span><span class="cx">     m_agents.append(WTFMove(timelineAgentPtr));
</span><span class="cx"> 
</span><del>-    auto consoleAgentPtr = std::make_unique&lt;PageConsoleAgent&gt;(pageContext, m_domAgent);
</del><ins>+    auto heapAgentPtr = std::make_unique&lt;InspectorHeapAgent&gt;(pageContext);
+    InspectorHeapAgent* heapAgent = heapAgentPtr.get();
+    m_agents.append(WTFMove(heapAgentPtr));
+
+    auto consoleAgentPtr = std::make_unique&lt;PageConsoleAgent&gt;(pageContext, heapAgent, m_domAgent);
</ins><span class="cx">     WebConsoleAgent* consoleAgent = consoleAgentPtr.get();
</span><span class="cx">     m_instrumentingAgents-&gt;setWebConsoleAgent(consoleAgentPtr.get());
</span><span class="cx">     m_agents.append(WTFMove(consoleAgentPtr));
</span><span class="lines">@@ -172,7 +176,6 @@
</span><span class="cx">     m_agents.append(WTFMove(debuggerAgentPtr));
</span><span class="cx"> 
</span><span class="cx">     m_agents.append(std::make_unique&lt;InspectorDOMDebuggerAgent&gt;(pageContext, m_domAgent, debuggerAgent));
</span><del>-    m_agents.append(std::make_unique&lt;InspectorHeapAgent&gt;(pageContext));
</del><span class="cx">     m_agents.append(std::make_unique&lt;InspectorScriptProfilerAgent&gt;(pageContext));
</span><span class="cx">     m_agents.append(std::make_unique&lt;InspectorApplicationCacheAgent&gt;(pageContext, pageAgent));
</span><span class="cx">     m_agents.append(std::make_unique&lt;InspectorLayerTreeAgent&gt;(pageContext));
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorInstrumentationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -855,6 +855,12 @@
</span><span class="cx">         consoleAgent-&gt;count(state, arguments);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InspectorInstrumentation::takeHeapSnapshotImpl(InstrumentingAgents&amp; instrumentingAgents, const String&amp; title)
+{
+    if (WebConsoleAgent* consoleAgent = instrumentingAgents.webConsoleAgent())
+        consoleAgent-&gt;takeHeapSnapshot(title);
+}
+
</ins><span class="cx"> void InspectorInstrumentation::startConsoleTimingImpl(InstrumentingAgents&amp; instrumentingAgents, Frame&amp; frame, const String&amp; title)
</span><span class="cx"> {
</span><span class="cx">     if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorInstrumentationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -209,6 +209,7 @@
</span><span class="cx">     static void addMessageToConsole(WorkerGlobalScope*, std::unique_ptr&lt;Inspector::ConsoleMessage&gt;);
</span><span class="cx"> 
</span><span class="cx">     static void consoleCount(Page&amp;, JSC::ExecState*, RefPtr&lt;Inspector::ScriptArguments&gt;&amp;&amp;);
</span><ins>+    static void takeHeapSnapshot(Frame&amp;, const String&amp; title);
</ins><span class="cx">     static void startConsoleTiming(Frame&amp;, const String&amp; title);
</span><span class="cx">     static void stopConsoleTiming(Frame&amp;, const String&amp; title, RefPtr&lt;Inspector::ScriptCallStack&gt;&amp;&amp;);
</span><span class="cx">     static void consoleTimeStamp(Frame&amp;, RefPtr&lt;Inspector::ScriptArguments&gt;&amp;&amp;);
</span><span class="lines">@@ -382,6 +383,7 @@
</span><span class="cx">     static void addMessageToConsoleImpl(InstrumentingAgents&amp;, std::unique_ptr&lt;Inspector::ConsoleMessage&gt;);
</span><span class="cx"> 
</span><span class="cx">     static void consoleCountImpl(InstrumentingAgents&amp;, JSC::ExecState*, RefPtr&lt;Inspector::ScriptArguments&gt;&amp;&amp;);
</span><ins>+    static void takeHeapSnapshotImpl(InstrumentingAgents&amp;, const String&amp; title);
</ins><span class="cx">     static void startConsoleTimingImpl(InstrumentingAgents&amp;, Frame&amp;, const String&amp; title);
</span><span class="cx">     static void stopConsoleTimingImpl(InstrumentingAgents&amp;, Frame&amp;, const String&amp; title, RefPtr&lt;Inspector::ScriptCallStack&gt;&amp;&amp;);
</span><span class="cx">     static void consoleTimeStampImpl(InstrumentingAgents&amp;, Frame&amp;, RefPtr&lt;Inspector::ScriptArguments&gt;&amp;&amp;);
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorPageConsoleAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/PageConsoleAgent.cpp (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/PageConsoleAgent.cpp        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/inspector/PageConsoleAgent.cpp        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -41,8 +41,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-PageConsoleAgent::PageConsoleAgent(WebAgentContext&amp; context, InspectorDOMAgent* domAgent)
-    : WebConsoleAgent(context)
</del><ins>+PageConsoleAgent::PageConsoleAgent(WebAgentContext&amp; context, InspectorHeapAgent* heapAgent, InspectorDOMAgent* domAgent)
+    : WebConsoleAgent(context, heapAgent)
</ins><span class="cx">     , m_inspectorDOMAgent(domAgent)
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorPageConsoleAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/PageConsoleAgent.h (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/PageConsoleAgent.h        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/inspector/PageConsoleAgent.h        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -43,7 +43,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(PageConsoleAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    PageConsoleAgent(WebAgentContext&amp;, InspectorDOMAgent*);
</del><ins>+    PageConsoleAgent(WebAgentContext&amp;, Inspector::InspectorHeapAgent*, InspectorDOMAgent*);
</ins><span class="cx">     virtual ~PageConsoleAgent() { }
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorWebConsoleAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/WebConsoleAgent.cpp (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/WebConsoleAgent.cpp        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/inspector/WebConsoleAgent.cpp        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -41,8 +41,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-WebConsoleAgent::WebConsoleAgent(AgentContext&amp; context)
-    : InspectorConsoleAgent(context)
</del><ins>+WebConsoleAgent::WebConsoleAgent(AgentContext&amp; context, InspectorHeapAgent* heapAgent)
+    : InspectorConsoleAgent(context, heapAgent)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorWebConsoleAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/WebConsoleAgent.h (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/WebConsoleAgent.h        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/inspector/WebConsoleAgent.h        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(WebConsoleAgent);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    WebConsoleAgent(Inspector::AgentContext&amp;);
</del><ins>+    WebConsoleAgent(Inspector::AgentContext&amp;, Inspector::InspectorHeapAgent*);
</ins><span class="cx">     virtual ~WebConsoleAgent() { }
</span><span class="cx"> 
</span><span class="cx">     void setMonitoringXHREnabled(ErrorString&amp;, bool enabled) final;
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageConsoleClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageConsoleClient.cpp (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageConsoleClient.cpp        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/page/PageConsoleClient.cpp        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -195,6 +195,11 @@
</span><span class="cx">         m_profiles.append(WTFMove(profile));
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PageConsoleClient::takeHeapSnapshot(JSC::ExecState*, const String&amp; title)
+{
+    InspectorInstrumentation::takeHeapSnapshot(m_page.mainFrame(), title);
+}
+
</ins><span class="cx"> void PageConsoleClient::time(JSC::ExecState*, const String&amp; title)
</span><span class="cx"> {
</span><span class="cx">     InspectorInstrumentation::startConsoleTiming(m_page.mainFrame(), title);
</span></span></pre></div>
<a id="trunkSourceWebCorepagePageConsoleClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/PageConsoleClient.h (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/PageConsoleClient.h        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/page/PageConsoleClient.h        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -69,6 +69,7 @@
</span><span class="cx">     void count(JSC::ExecState*, RefPtr&lt;Inspector::ScriptArguments&gt;&amp;&amp;) override;
</span><span class="cx">     void profile(JSC::ExecState*, const String&amp; title) override;
</span><span class="cx">     void profileEnd(JSC::ExecState*, const String&amp; title) override;
</span><ins>+    void takeHeapSnapshot(JSC::ExecState*, const String&amp; title) override;
</ins><span class="cx">     void time(JSC::ExecState*, const String&amp; title) override;
</span><span class="cx">     void timeEnd(JSC::ExecState*, const String&amp; title) override;
</span><span class="cx">     void timeStamp(JSC::ExecState*, RefPtr&lt;Inspector::ScriptArguments&gt;&amp;&amp;) override;
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkerConsoleClientcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/WorkerConsoleClient.cpp (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/WorkerConsoleClient.cpp        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/workers/WorkerConsoleClient.cpp        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx"> 
</span><span class="cx"> // FIXME: &lt;https://webkit.org/b/127634&gt; Web Inspector: support debugging web workers
</span><span class="cx"> void WorkerConsoleClient::count(JSC::ExecState*, RefPtr&lt;ScriptArguments&gt;&amp;&amp;) { }
</span><ins>+void WorkerConsoleClient::takeHeapSnapshot(JSC::ExecState*, const String&amp;) { }
</ins><span class="cx"> void WorkerConsoleClient::time(JSC::ExecState*, const String&amp;) { }
</span><span class="cx"> void WorkerConsoleClient::timeEnd(JSC::ExecState*, const String&amp;) { }
</span><span class="cx"> void WorkerConsoleClient::timeStamp(JSC::ExecState*, RefPtr&lt;ScriptArguments&gt;&amp;&amp;) { }
</span></span></pre></div>
<a id="trunkSourceWebCoreworkersWorkerConsoleClienth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/workers/WorkerConsoleClient.h (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/workers/WorkerConsoleClient.h        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebCore/workers/WorkerConsoleClient.h        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -47,6 +47,7 @@
</span><span class="cx">     void count(JSC::ExecState*, RefPtr&lt;Inspector::ScriptArguments&gt;&amp;&amp;) override;
</span><span class="cx">     void profile(JSC::ExecState*, const String&amp; title) override;
</span><span class="cx">     void profileEnd(JSC::ExecState*, const String&amp; title) override;
</span><ins>+    void takeHeapSnapshot(JSC::ExecState*, const String&amp; title) override;
</ins><span class="cx">     void time(JSC::ExecState*, const String&amp; title) override;
</span><span class="cx">     void timeEnd(JSC::ExecState*, const String&amp; title) override;
</span><span class="cx">     void timeStamp(JSC::ExecState*, RefPtr&lt;Inspector::ScriptArguments&gt;&amp;&amp;) override;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2016-03-29  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: We should have a way to capture heap snapshots programatically.
+        https://bugs.webkit.org/show_bug.cgi?id=154407
+        &lt;rdar://problem/24726292&gt;
+
+        Reviewed by Timothy Hatcher.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Protocol/ConsoleObserver.js:
+        (WebInspector.ConsoleObserver.prototype.heapSnapshot):
+        (WebInspector.ConsoleObserver):
+        Create a HeapSnapshot with an optional title and add to the timeline.
+
+        (WebInspector.HeapAllocationsTimelineDataGridNode):
+        * UserInterface/Views/TimelineTabContentView.js:
+        (WebInspector.TimelineTabContentView.displayNameForRecord):
+        Share code for snapshot display names which may now include a title.
+
+        * UserInterface/Proxies/HeapSnapshotProxy.js:
+        (WebInspector.HeapSnapshotProxy):
+        (WebInspector.HeapSnapshotProxy.deserialize):
+        (WebInspector.HeapSnapshotProxy.prototype.get title):
+        * UserInterface/Views/HeapAllocationsTimelineDataGridNode.js:
+        * UserInterface/Workers/HeapSnapshot/HeapSnapshot.js:
+        (HeapSnapshot):
+        (HeapSnapshot.prototype.serialize):
+        * UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js:
+        (HeapSnapshotWorker.prototype.createSnapshot):
+        Include an optional title in a HeapSnapshot.
+
</ins><span class="cx"> 2016-03-28  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Ensure maximum accuracy while profiling
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -661,6 +661,7 @@
</span><span class="cx"> localizedStrings[&quot;Small %s&quot;] = &quot;Small %s&quot;;
</span><span class="cx"> localizedStrings[&quot;Small Icons&quot;] = &quot;Small Icons&quot;;
</span><span class="cx"> localizedStrings[&quot;Snapshot %d&quot;] = &quot;Snapshot %d&quot;;
</span><ins>+localizedStrings[&quot;Snapshot %d \u2014 %s&quot;] = &quot;Snapshot %d \u2014 %s&quot;;
</ins><span class="cx"> localizedStrings[&quot;Snapshot Comparison (%d and %d)&quot;] = &quot;Snapshot Comparison (%d and %d)&quot;;
</span><span class="cx"> localizedStrings[&quot;Snapshot List&quot;] = &quot;Snapshot List&quot;;
</span><span class="cx"> localizedStrings[&quot;Socket&quot;] = &quot;Socket&quot;;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolConsoleObserverjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/ConsoleObserver.js        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -52,4 +52,13 @@
</span><span class="cx">     {
</span><span class="cx">         WebInspector.logManager.messagesCleared();
</span><span class="cx">     }
</span><ins>+
+    heapSnapshot(timestamp, snapshotStringData, title)
+    {
+        let workerProxy = WebInspector.HeapSnapshotWorkerProxy.singleton();
+        workerProxy.createSnapshot(snapshotStringData, title || null, ({objectId, snapshot: serializedSnapshot}) =&gt; {
+            let snapshot = WebInspector.HeapSnapshotProxy.deserialize(objectId, serializedSnapshot);
+            WebInspector.timelineManager.heapSnapshotAdded(timestamp, snapshot);
+        });
+    }
</ins><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProxiesHeapSnapshotProxyjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotProxy.js (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotProxy.js        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebInspectorUI/UserInterface/Proxies/HeapSnapshotProxy.js        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -25,13 +25,14 @@
</span><span class="cx"> 
</span><span class="cx"> WebInspector.HeapSnapshotProxy = class HeapSnapshotProxy extends WebInspector.Object
</span><span class="cx"> {
</span><del>-    constructor(snapshotObjectId, identifier, totalSize, totalObjectCount, categories)
</del><ins>+    constructor(snapshotObjectId, identifier, title, totalSize, totalObjectCount, categories)
</ins><span class="cx">     {
</span><span class="cx">         super();
</span><span class="cx"> 
</span><span class="cx">         this._proxyObjectId = snapshotObjectId;
</span><span class="cx"> 
</span><span class="cx">         this._identifier = identifier;
</span><ins>+        this._title = title;
</ins><span class="cx">         this._totalSize = totalSize;
</span><span class="cx">         this._totalObjectCount = totalObjectCount;
</span><span class="cx">         this._categories = Map.fromObject(categories);
</span><span class="lines">@@ -41,14 +42,15 @@
</span><span class="cx"> 
</span><span class="cx">     static deserialize(objectId, serializedSnapshot)
</span><span class="cx">     {
</span><del>-        let {identifier, totalSize, totalObjectCount, categories} = serializedSnapshot;
-        return new WebInspector.HeapSnapshotProxy(objectId, identifier, totalSize, totalObjectCount, categories);
</del><ins>+        let {identifier, title, totalSize, totalObjectCount, categories} = serializedSnapshot;
+        return new WebInspector.HeapSnapshotProxy(objectId, identifier, title, totalSize, totalObjectCount, categories);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Public
</span><span class="cx"> 
</span><span class="cx">     get proxyObjectId() { return this._proxyObjectId; }
</span><span class="cx">     get identifier() { return this._identifier; }
</span><ins>+    get title() { return this._title; }
</ins><span class="cx">     get totalSize() { return this._totalSize; }
</span><span class="cx">     get totalObjectCount() { return this._totalObjectCount; }
</span><span class="cx">     get categories() { return this._categories; }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsHeapAllocationsTimelineDataGridNodejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineDataGridNode.js        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx">         this._heapAllocationsView = heapAllocationsView;
</span><span class="cx"> 
</span><span class="cx">         this._data = {
</span><del>-            name: WebInspector.UIString(&quot;Snapshot %d&quot;).format(this._record.heapSnapshot.identifier),
</del><ins>+            name: WebInspector.TimelineTabContentView.displayNameForRecord(heapAllocationsTimelineRecord),
</ins><span class="cx">             timestamp: this._record.timestamp - zeroTime,
</span><span class="cx">             size: this._record.heapSnapshot.totalSize,
</span><span class="cx">         };
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTimelineTabContentViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineTabContentView.js        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -251,6 +251,8 @@
</span><span class="cx">         case WebInspector.TimelineRecord.Type.RenderingFrame:
</span><span class="cx">             return WebInspector.UIString(&quot;Frame %d&quot;).format(timelineRecord.frameNumber);
</span><span class="cx">         case WebInspector.TimelineRecord.Type.HeapAllocations:
</span><ins>+            if (timelineRecord.heapSnapshot.title)
+                return WebInspector.UIString(&quot;Snapshot %d \u2014 %s&quot;).format(timelineRecord.heapSnapshot.identifier, timelineRecord.heapSnapshot.title);
</ins><span class="cx">             return WebInspector.UIString(&quot;Snapshot %d&quot;).format(timelineRecord.heapSnapshot.identifier);
</span><span class="cx">         case WebInspector.TimelineRecord.Type.Memory:
</span><span class="cx">             // Not used. Fall through to error just in case.
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceWorkersHeapSnapshotHeapSnapshotjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshot.js        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -72,10 +72,11 @@
</span><span class="cx"> 
</span><span class="cx"> HeapSnapshot = class HeapSnapshot
</span><span class="cx"> {
</span><del>-    constructor(objectId, snapshotDataString)
</del><ins>+    constructor(objectId, snapshotDataString, title = null)
</ins><span class="cx">     {
</span><span class="cx">         this._identifier = nextSnapshotIdentifier++;
</span><span class="cx">         this._objectId = objectId;
</span><ins>+        this._title = title;
</ins><span class="cx"> 
</span><span class="cx">         let json = JSON.parse(snapshotDataString);
</span><span class="cx">         snapshotDataString = null;
</span><span class="lines">@@ -309,6 +310,7 @@
</span><span class="cx">     {
</span><span class="cx">         return {
</span><span class="cx">             identifier: this._identifier,
</span><ins>+            title: this._title,
</ins><span class="cx">             totalSize: this._totalSize,
</span><span class="cx">             totalObjectCount: this._nodeCount - 1, // &lt;root&gt;.
</span><span class="cx">             categories: this._categories,
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceWorkersHeapSnapshotHeapSnapshotWorkerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js (198785 => 198786)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js        2016-03-29 18:33:35 UTC (rev 198785)
+++ trunk/Source/WebInspectorUI/UserInterface/Workers/HeapSnapshot/HeapSnapshotWorker.js        2016-03-29 18:51:35 UTC (rev 198786)
</span><span class="lines">@@ -39,10 +39,10 @@
</span><span class="cx"> 
</span><span class="cx">     // Actions
</span><span class="cx"> 
</span><del>-    createSnapshot(snapshotString)
</del><ins>+    createSnapshot(snapshotString, title)
</ins><span class="cx">     {
</span><span class="cx">         let objectId = this._nextObjectId++;
</span><del>-        let snapshot = new HeapSnapshot(objectId, snapshotString);
</del><ins>+        let snapshot = new HeapSnapshot(objectId, snapshotString, title);
</ins><span class="cx">         this._objects.set(objectId, snapshot);
</span><span class="cx">         return {objectId, snapshot: snapshot.serialize()};
</span><span class="cx">     }
</span></span></pre>
</div>
</div>

</body>
</html>