<!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>[197827] trunk/Source</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/197827">197827</a></dd>
<dt>Author</dt> <dd>joepeck@webkit.org</dd>
<dt>Date</dt> <dd>2016-03-08 18:06:55 -0800 (Tue, 08 Mar 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Memory Timeline should show MemoryPressure events
https://bugs.webkit.org/show_bug.cgi?id=155158
&lt;rdar://problem/25026610&gt;

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/Memory.json:

Source/WebCore:

* platform/MemoryPressureHandler.cpp:
(WebCore::MemoryPressureHandler::releaseMemory):
When responding to memory pressure, notify page inspectors.

* platform/cocoa/MemoryPressureHandlerCocoa.mm:
Remove unused includes.

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didHandleMemoryPressureImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::playbackStarted):
(WebCore::InspectorInstrumentation::playbackPaused):
(WebCore::InspectorInstrumentation::playbackFinished):
(WebCore::InspectorInstrumentation::playbackHitPosition):
(WebCore::InspectorInstrumentation::didHandleMemoryPressure):
* inspector/InspectorMemoryAgent.cpp:
(WebCore::InspectorMemoryAgent::didCreateFrontendAndBackend):
(WebCore::InspectorMemoryAgent::willDestroyFrontendAndBackend):
(WebCore::InspectorMemoryAgent::enable):
(WebCore::InspectorMemoryAgent::disable):
(WebCore::InspectorMemoryAgent::didHandleMemoryPressure):
* inspector/InspectorMemoryAgent.h:
* inspector/InstrumentingAgents.cpp:
(WebCore::InstrumentingAgents::reset):
* inspector/InstrumentingAgents.h:
(WebCore::InstrumentingAgents::inspectorMemoryAgent):
(WebCore::InstrumentingAgents::setInspectorMemoryAgent):
Plumbing to notify the right active inspector.

Source/WebInspectorUI:

* UserInterface/Main.html:
New resources.

* UserInterface/Base/Main.js:
(WebInspector.loaded):
* UserInterface/Controllers/MemoryManager.js:
(WebInspector.MemoryManager):
(WebInspector.MemoryManager.prototype.memoryPressure):
* UserInterface/Protocol/MemoryObserver.js:
(WebInspector.MemoryObserver.prototype.memoryPressure):
New manager for Memory domain events.

* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager):
(WebInspector.TimelineManager.defaultInstruments):
(WebInspector.TimelineManager.prototype._memoryPressure):
* UserInterface/Models/TimelineRecording.js:
(WebInspector.TimelineRecording.prototype.addMemoryPressureEvent):
Add events to the Memory Timeline of the active recording.

* UserInterface/Models/MemoryTimeline.js:
(WebInspector.MemoryTimeline.prototype.get memoryPressureEvents):
(WebInspector.MemoryTimeline.prototype.addMemoryPressureEvent):
(WebInspector.MemoryTimeline.prototype.reset):
(WebInspector.MemoryTimeline):
* UserInterface/Models/Timeline.js:
(WebInspector.Timeline.create):
Create a specific MemoryTimeline to hold records and memory pressure events.

* UserInterface/Models/MemoryPressureEvent.js:
(WebInspector.MemoryPressureEvent):
(WebInspector.MemoryPressureEvent.fromPayload):
(WebInspector.MemoryPressureEvent.prototype.get timestamp):
(WebInspector.MemoryPressureEvent.prototype.get severity):
Model object for a memory pressure event.

* UserInterface/Views/MemoryTimelineOverviewGraph.css:
(.timeline-overview-graph.memory .memory-pressure-event):
* UserInterface/Views/MemoryTimelineOverviewGraph.js:
(WebInspector.MemoryTimelineOverviewGraph):
(WebInspector.MemoryTimelineOverviewGraph.prototype.reset):
(WebInspector.MemoryTimelineOverviewGraph.prototype._visibleMemoryPressureEvents):
(WebInspector.MemoryTimelineOverviewGraph.prototype._memoryTimelineMemoryPressureEventAdded):
Include markers for memory pressure events.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolMemoryjson">trunk/Source/JavaScriptCore/inspector/protocol/Memory.json</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</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="#trunkSourceWebCoreinspectorInspectorMemoryAgentcpp">trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorMemoryAgenth">trunk/Source/WebCore/inspector/InspectorMemoryAgent.h</a></li>
<li><a href="#trunkSourceWebCoreinspectorInstrumentingAgentscpp">trunk/Source/WebCore/inspector/InstrumentingAgents.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInstrumentingAgentsh">trunk/Source/WebCore/inspector/InstrumentingAgents.h</a></li>
<li><a href="#trunkSourceWebCoreplatformMemoryPressureHandlercpp">trunk/Source/WebCore/platform/MemoryPressureHandler.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaMemoryPressureHandlerCocoamm">trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseMainjs">trunk/Source/WebInspectorUI/UserInterface/Base/Main.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersTimelineManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceMainhtml">trunk/Source/WebInspectorUI/UserInterface/Main.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsTimelinejs">trunk/Source/WebInspectorUI/UserInterface/Models/Timeline.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsTimelineRecordingjs">trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceProtocolMemoryObserverjs">trunk/Source/WebInspectorUI/UserInterface/Protocol/MemoryObserver.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTestTestjs">trunk/Source/WebInspectorUI/UserInterface/Test/Test.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceTesthtml">trunk/Source/WebInspectorUI/UserInterface/Test.html</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsMemoryTimelineOverviewGraphcss">trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsMemoryTimelineOverviewGraphjs">trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersMemoryManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/MemoryManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsMemoryPressureEventjs">trunk/Source/WebInspectorUI/UserInterface/Models/MemoryPressureEvent.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsMemoryTimelinejs">trunk/Source/WebInspectorUI/UserInterface/Models/MemoryTimeline.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -1,5 +1,15 @@
</span><span class="cx"> 2016-03-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: Memory Timeline should show MemoryPressure events
+        https://bugs.webkit.org/show_bug.cgi?id=155158
+        &lt;rdar://problem/25026610&gt;
+
+        Reviewed by Brian Burg.
+
+        * inspector/protocol/Memory.json:
+
+2016-03-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: Add Heap domain start/stop tracking commands
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=155190
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolMemoryjson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/Memory.json (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/Memory.json        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/JavaScriptCore/inspector/protocol/Memory.json        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -23,6 +23,14 @@
</span><span class="cx">     ],
</span><span class="cx">     &quot;commands&quot;: [
</span><span class="cx">         {
</span><ins>+            &quot;name&quot;: &quot;enable&quot;,
+            &quot;description&quot;: &quot;Enables Memory domain events.&quot;
+        },
+        {
+            &quot;name&quot;: &quot;disable&quot;,
+            &quot;description&quot;: &quot;Disables Memory domain events.&quot;
+        },
+        {
</ins><span class="cx">             &quot;name&quot;: &quot;startTracking&quot;,
</span><span class="cx">             &quot;description&quot;: &quot;Start tracking memory. This will produce a `trackingStart` event.&quot;
</span><span class="cx">         },
</span><span class="lines">@@ -33,6 +41,14 @@
</span><span class="cx">     ],
</span><span class="cx">     &quot;events&quot;: [
</span><span class="cx">         {
</span><ins>+            &quot;name&quot;: &quot;memoryPressure&quot;,
+            &quot;description&quot;: &quot;Memory pressure was encountered.&quot;,
+            &quot;parameters&quot;: [
+                { &quot;name&quot;: &quot;timestamp&quot;, &quot;type&quot;: &quot;number&quot; },
+                { &quot;name&quot;: &quot;severity&quot;, &quot;type&quot;: &quot;string&quot;, &quot;enum&quot;: [&quot;critical&quot;, &quot;non-critical&quot;], &quot;description&quot;: &quot;The severity of the memory pressure event.&quot; }
+            ]
+        },
+        {
</ins><span class="cx">             &quot;name&quot;: &quot;trackingStart&quot;,
</span><span class="cx">             &quot;description&quot;: &quot;Tracking started.&quot;,
</span><span class="cx">             &quot;parameters&quot;: [
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebCore/ChangeLog        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -1,3 +1,40 @@
</span><ins>+2016-03-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
+        Web Inspector: Memory Timeline should show MemoryPressure events
+        https://bugs.webkit.org/show_bug.cgi?id=155158
+        &lt;rdar://problem/25026610&gt;
+
+        Reviewed by Brian Burg.
+
+        * platform/MemoryPressureHandler.cpp:
+        (WebCore::MemoryPressureHandler::releaseMemory):
+        When responding to memory pressure, notify page inspectors.
+
+        * platform/cocoa/MemoryPressureHandlerCocoa.mm:
+        Remove unused includes.
+
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::didHandleMemoryPressureImpl):
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::playbackStarted):
+        (WebCore::InspectorInstrumentation::playbackPaused):
+        (WebCore::InspectorInstrumentation::playbackFinished):
+        (WebCore::InspectorInstrumentation::playbackHitPosition):
+        (WebCore::InspectorInstrumentation::didHandleMemoryPressure):
+        * inspector/InspectorMemoryAgent.cpp:
+        (WebCore::InspectorMemoryAgent::didCreateFrontendAndBackend):
+        (WebCore::InspectorMemoryAgent::willDestroyFrontendAndBackend):
+        (WebCore::InspectorMemoryAgent::enable):
+        (WebCore::InspectorMemoryAgent::disable):
+        (WebCore::InspectorMemoryAgent::didHandleMemoryPressure):
+        * inspector/InspectorMemoryAgent.h:
+        * inspector/InstrumentingAgents.cpp:
+        (WebCore::InstrumentingAgents::reset):
+        * inspector/InstrumentingAgents.h:
+        (WebCore::InstrumentingAgents::inspectorMemoryAgent):
+        (WebCore::InstrumentingAgents::setInspectorMemoryAgent):
+        Plumbing to notify the right active inspector.
+
</ins><span class="cx"> 2016-03-08  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Delete dead scrolling code
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorInstrumentationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -48,6 +48,7 @@
</span><span class="cx"> #include &quot;InspectorDOMStorageAgent.h&quot;
</span><span class="cx"> #include &quot;InspectorDatabaseAgent.h&quot;
</span><span class="cx"> #include &quot;InspectorLayerTreeAgent.h&quot;
</span><ins>+#include &quot;InspectorMemoryAgent.h&quot;
</ins><span class="cx"> #include &quot;InspectorNetworkAgent.h&quot;
</span><span class="cx"> #include &quot;InspectorPageAgent.h&quot;
</span><span class="cx"> #include &quot;InspectorTimelineAgent.h&quot;
</span><span class="lines">@@ -1033,6 +1034,14 @@
</span><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(RESOURCE_USAGE)
+void InspectorInstrumentation::didHandleMemoryPressureImpl(InstrumentingAgents&amp; instrumentingAgents, Critical critical)
+{
+    if (InspectorMemoryAgent* memoryAgent = instrumentingAgents.inspectorMemoryAgent())
+        memoryAgent-&gt;didHandleMemoryPressure(critical);
+}
+#endif
+
</ins><span class="cx"> void InspectorInstrumentation::networkStateChangedImpl(InstrumentingAgents&amp; instrumentingAgents)
</span><span class="cx"> {
</span><span class="cx">     if (InspectorApplicationCacheAgent* applicationCacheAgent = instrumentingAgents.inspectorApplicationCacheAgent())
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorInstrumentationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.h (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -38,6 +38,7 @@
</span><span class="cx"> #include &quot;Frame.h&quot;
</span><span class="cx"> #include &quot;HitTestResult.h&quot;
</span><span class="cx"> #include &quot;InspectorInstrumentationCookie.h&quot;
</span><ins>+#include &quot;MemoryPressureHandler.h&quot;
</ins><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;ScriptExecutionContext.h&quot;
</span><span class="cx"> #include &quot;ScriptState.h&quot;
</span><span class="lines">@@ -258,6 +259,10 @@
</span><span class="cx">     static Deprecated::ScriptObject wrapWebGLRenderingContextForInstrumentation(Document*, const Deprecated::ScriptObject&amp;);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(RESOURCE_USAGE)
+    static void didHandleMemoryPressure(Page&amp;, Critical);
+#endif
+
</ins><span class="cx">     static void networkStateChanged(Page*);
</span><span class="cx">     static void updateApplicationCacheStatus(Frame*);
</span><span class="cx"> 
</span><span class="lines">@@ -422,6 +427,10 @@
</span><span class="cx">     static void didReceiveWebSocketFrameErrorImpl(InstrumentingAgents&amp;, unsigned long identifier, const String&amp;);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(RESOURCE_USAGE)
+    static void didHandleMemoryPressureImpl(InstrumentingAgents&amp;, Critical);
+#endif
+
</ins><span class="cx">     static void networkStateChangedImpl(InstrumentingAgents&amp;);
</span><span class="cx">     static void updateApplicationCacheStatusImpl(InstrumentingAgents&amp;, Frame*);
</span><span class="cx"> 
</span><span class="lines">@@ -1161,28 +1170,37 @@
</span><span class="cx"> inline void InspectorInstrumentation::playbackStarted(Page&amp; page)
</span><span class="cx"> {
</span><span class="cx">     FAST_RETURN_IF_NO_FRONTENDS(void());
</span><del>-        playbackStartedImpl(instrumentingAgentsForPage(page));
</del><ins>+    playbackStartedImpl(instrumentingAgentsForPage(page));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline void InspectorInstrumentation::playbackPaused(Page&amp; page, const ReplayPosition&amp; position)
</span><span class="cx"> {
</span><span class="cx">     FAST_RETURN_IF_NO_FRONTENDS(void());
</span><del>-        playbackPausedImpl(instrumentingAgentsForPage(page), position);
</del><ins>+    playbackPausedImpl(instrumentingAgentsForPage(page), position);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline void InspectorInstrumentation::playbackFinished(Page&amp; page)
</span><span class="cx"> {
</span><span class="cx">     FAST_RETURN_IF_NO_FRONTENDS(void());
</span><del>-        playbackFinishedImpl(instrumentingAgentsForPage(page));
</del><ins>+    playbackFinishedImpl(instrumentingAgentsForPage(page));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline void InspectorInstrumentation::playbackHitPosition(Page&amp; page, const ReplayPosition&amp; position)
</span><span class="cx"> {
</span><span class="cx">     FAST_RETURN_IF_NO_FRONTENDS(void());
</span><del>-        playbackHitPositionImpl(instrumentingAgentsForPage(page), position);
</del><ins>+    playbackHitPositionImpl(instrumentingAgentsForPage(page), position);
</ins><span class="cx"> }
</span><span class="cx"> #endif // ENABLE(WEB_REPLAY)
</span><span class="cx"> 
</span><ins>+#if ENABLE(RESOURCE_USAGE)
+inline void InspectorInstrumentation::didHandleMemoryPressure(Page&amp; page, Critical critical)
+{
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForPage(&amp;page))
+        didHandleMemoryPressureImpl(*instrumentingAgents, critical);
+}
+#endif
+
</ins><span class="cx"> inline void InspectorInstrumentation::networkStateChanged(Page* page)
</span><span class="cx"> {
</span><span class="cx">     FAST_RETURN_IF_NO_FRONTENDS(void());
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorMemoryAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(RESOURCE_USAGE)
</span><span class="cx"> 
</span><ins>+#include &quot;InstrumentingAgents.h&quot;
</ins><span class="cx"> #include &quot;ResourceUsageThread.h&quot;
</span><span class="cx"> #include &lt;inspector/InspectorEnvironment.h&gt;
</span><span class="cx"> #include &lt;wtf/Stopwatch.h&gt;
</span><span class="lines">@@ -45,14 +46,28 @@
</span><span class="cx"> 
</span><span class="cx"> void InspectorMemoryAgent::didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*)
</span><span class="cx"> {
</span><ins>+    m_instrumentingAgents.setInspectorMemoryAgent(this);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void InspectorMemoryAgent::willDestroyFrontendAndBackend(DisconnectReason)
</span><span class="cx"> {
</span><ins>+    m_instrumentingAgents.setInspectorMemoryAgent(nullptr);
+
</ins><span class="cx">     ErrorString ignored;
</span><span class="cx">     stopTracking(ignored);
</span><ins>+    disable(ignored);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InspectorMemoryAgent::enable(ErrorString&amp;)
+{
+    m_enabled = true;
+}
+
+void InspectorMemoryAgent::disable(ErrorString&amp;)
+{
+    m_enabled = false;
+}
+
</ins><span class="cx"> void InspectorMemoryAgent::startTracking(ErrorString&amp;)
</span><span class="cx"> {
</span><span class="cx">     if (m_tracking)
</span><span class="lines">@@ -79,6 +94,15 @@
</span><span class="cx">     m_frontendDispatcher-&gt;trackingComplete();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InspectorMemoryAgent::didHandleMemoryPressure(Critical critical)
+{
+    if (!m_enabled)
+        return;
+
+    MemoryFrontendDispatcher::Severity severity = critical == Critical::Yes ? MemoryFrontendDispatcher::Severity::Critical : MemoryFrontendDispatcher::Severity::NonCritical;
+    m_frontendDispatcher-&gt;memoryPressure(m_environment.executionStopwatch()-&gt;elapsedTime(), severity);
+}
+
</ins><span class="cx"> void InspectorMemoryAgent::collectSample(const ResourceUsageData&amp; data)
</span><span class="cx"> {
</span><span class="cx">     auto javascriptCategory = Protocol::Memory::CategoryData::create()
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorMemoryAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorMemoryAgent.h (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorMemoryAgent.h        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebCore/inspector/InspectorMemoryAgent.h        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if ENABLE(RESOURCE_USAGE)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;InspectorWebAgentBase.h&quot;
</span><ins>+#include &quot;MemoryPressureHandler.h&quot;
</ins><span class="cx"> #include &quot;ResourceUsageData.h&quot;
</span><span class="cx"> #include &lt;inspector/InspectorBackendDispatchers.h&gt;
</span><span class="cx"> #include &lt;inspector/InspectorFrontendDispatchers.h&gt;
</span><span class="lines">@@ -48,14 +49,20 @@
</span><span class="cx">     void willDestroyFrontendAndBackend(Inspector::DisconnectReason) override;
</span><span class="cx"> 
</span><span class="cx">     // MemoryBackendDispatcherHandler
</span><ins>+    void enable(ErrorString&amp;) override;
+    void disable(ErrorString&amp;) override;
</ins><span class="cx">     void startTracking(ErrorString&amp;) override;
</span><span class="cx">     void stopTracking(ErrorString&amp;) override;
</span><span class="cx"> 
</span><ins>+    // InspectorInstrumentation
+    void didHandleMemoryPressure(Critical);
+
</ins><span class="cx"> private:
</span><span class="cx">     void collectSample(const ResourceUsageData&amp;);
</span><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;Inspector::MemoryFrontendDispatcher&gt; m_frontendDispatcher;
</span><span class="cx">     RefPtr&lt;Inspector::MemoryBackendDispatcher&gt; m_backendDispatcher;
</span><ins>+    bool m_enabled { false };
</ins><span class="cx">     bool m_tracking { false };
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInstrumentingAgentscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InstrumentingAgents.cpp (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InstrumentingAgents.cpp        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebCore/inspector/InstrumentingAgents.cpp        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -57,6 +57,9 @@
</span><span class="cx"> #if ENABLE(WEB_REPLAY)
</span><span class="cx">     m_inspectorReplayAgent = nullptr;
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(RESOURCE_USAGE)
+    m_inspectorMemoryAgent = nullptr;
+#endif
</ins><span class="cx">     m_inspectorDatabaseAgent = nullptr;
</span><span class="cx">     m_inspectorApplicationCacheAgent = nullptr;
</span><span class="cx">     m_inspectorDebuggerAgent = nullptr;
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInstrumentingAgentsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InstrumentingAgents.h (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InstrumentingAgents.h        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebCore/inspector/InstrumentingAgents.h        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -51,6 +51,7 @@
</span><span class="cx"> class InspectorDOMStorageAgent;
</span><span class="cx"> class InspectorDatabaseAgent;
</span><span class="cx"> class InspectorLayerTreeAgent;
</span><ins>+class InspectorMemoryAgent;
</ins><span class="cx"> class InspectorNetworkAgent;
</span><span class="cx"> class InspectorPageAgent;
</span><span class="cx"> class InspectorReplayAgent;
</span><span class="lines">@@ -110,6 +111,11 @@
</span><span class="cx">     void setInspectorReplayAgent(InspectorReplayAgent* agent) { m_inspectorReplayAgent = agent; }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if ENABLE(RESOURCE_USAGE)
+    InspectorMemoryAgent* inspectorMemoryAgent() const { return m_inspectorMemoryAgent; }
+    void setInspectorMemoryAgent(InspectorMemoryAgent* agent) { m_inspectorMemoryAgent = agent; }
+#endif
+
</ins><span class="cx">     InspectorDatabaseAgent* inspectorDatabaseAgent() const { return m_inspectorDatabaseAgent; }
</span><span class="cx">     void setInspectorDatabaseAgent(InspectorDatabaseAgent* agent) { m_inspectorDatabaseAgent = agent; }
</span><span class="cx"> 
</span><span class="lines">@@ -147,6 +153,9 @@
</span><span class="cx"> #if ENABLE(WEB_REPLAY)
</span><span class="cx">     InspectorReplayAgent* m_inspectorReplayAgent { nullptr };
</span><span class="cx"> #endif
</span><ins>+#if ENABLE(RESOURCE_USAGE)
+    InspectorMemoryAgent* m_inspectorMemoryAgent { nullptr };
+#endif
</ins><span class="cx">     InspectorDatabaseAgent* m_inspectorDatabaseAgent { nullptr };
</span><span class="cx">     InspectorApplicationCacheAgent* m_inspectorApplicationCacheAgent { nullptr };
</span><span class="cx">     Inspector::InspectorDebuggerAgent* m_inspectorDebuggerAgent { nullptr };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMemoryPressureHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MemoryPressureHandler.cpp (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MemoryPressureHandler.cpp        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebCore/platform/MemoryPressureHandler.cpp        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -29,13 +29,11 @@
</span><span class="cx"> #include &quot;CSSValuePool.h&quot;
</span><span class="cx"> #include &quot;Chrome.h&quot;
</span><span class="cx"> #include &quot;ChromeClient.h&quot;
</span><del>-#include &quot;DOMWindow.h&quot;
</del><span class="cx"> #include &quot;Document.h&quot;
</span><span class="cx"> #include &quot;FontCache.h&quot;
</span><del>-#include &quot;FontCascade.h&quot;
</del><span class="cx"> #include &quot;GCController.h&quot;
</span><span class="cx"> #include &quot;HTMLMediaElement.h&quot;
</span><del>-#include &quot;JSDOMWindow.h&quot;
</del><ins>+#include &quot;InspectorInstrumentation.h&quot;
</ins><span class="cx"> #include &quot;MemoryCache.h&quot;
</span><span class="cx"> #include &quot;Page.h&quot;
</span><span class="cx"> #include &quot;PageCache.h&quot;
</span><span class="lines">@@ -178,6 +176,12 @@
</span><span class="cx"> #endif
</span><span class="cx">         WTF::releaseFastMallocFreeMemory();
</span><span class="cx">     }
</span><ins>+
+#if ENABLE(RESOURCE_USAGE)
+    Page::forEachPage([&amp;](Page&amp; page) {
+        InspectorInstrumentation::didHandleMemoryPressure(page, critical);
+    });
+#endif
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void MemoryPressureHandler::ReliefLogger::logMemoryUsageChange()
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaMemoryPressureHandlerCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -27,19 +27,13 @@
</span><span class="cx"> #import &quot;MemoryPressureHandler.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #import &quot;IOSurfacePool.h&quot;
</span><del>-#import &quot;GCController.h&quot;
-#import &quot;JSDOMWindow.h&quot;
-#import &quot;JSDOMWindowBase.h&quot;
</del><span class="cx"> #import &quot;LayerPool.h&quot;
</span><span class="cx"> #import &quot;Logging.h&quot;
</span><span class="cx"> #import &quot;ResourceUsageThread.h&quot;
</span><del>-#import &quot;WebCoreSystemInterface.h&quot;
</del><span class="cx"> #import &lt;mach/mach.h&gt;
</span><span class="cx"> #import &lt;mach/task_info.h&gt;
</span><span class="cx"> #import &lt;malloc/malloc.h&gt;
</span><span class="cx"> #import &lt;notify.h&gt;
</span><del>-#import &lt;wtf/CurrentTime.h&gt;
-#import &lt;sys/sysctl.h&gt;
</del><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #import &quot;SystemMemory.h&quot;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -1,5 +1,58 @@
</span><span class="cx"> 2016-03-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: Memory Timeline should show MemoryPressure events
+        https://bugs.webkit.org/show_bug.cgi?id=155158
+        &lt;rdar://problem/25026610&gt;
+
+        Reviewed by Brian Burg.
+
+        * UserInterface/Main.html:
+        New resources.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector.loaded):
+        * UserInterface/Controllers/MemoryManager.js:
+        (WebInspector.MemoryManager):
+        (WebInspector.MemoryManager.prototype.memoryPressure):
+        * UserInterface/Protocol/MemoryObserver.js:
+        (WebInspector.MemoryObserver.prototype.memoryPressure):
+        New manager for Memory domain events.
+
+        * UserInterface/Controllers/TimelineManager.js:
+        (WebInspector.TimelineManager):
+        (WebInspector.TimelineManager.defaultInstruments):
+        (WebInspector.TimelineManager.prototype._memoryPressure):
+        * UserInterface/Models/TimelineRecording.js:
+        (WebInspector.TimelineRecording.prototype.addMemoryPressureEvent):
+        Add events to the Memory Timeline of the active recording.
+
+        * UserInterface/Models/MemoryTimeline.js:
+        (WebInspector.MemoryTimeline.prototype.get memoryPressureEvents):
+        (WebInspector.MemoryTimeline.prototype.addMemoryPressureEvent):
+        (WebInspector.MemoryTimeline.prototype.reset):
+        (WebInspector.MemoryTimeline):
+        * UserInterface/Models/Timeline.js:
+        (WebInspector.Timeline.create):
+        Create a specific MemoryTimeline to hold records and memory pressure events.
+
+        * UserInterface/Models/MemoryPressureEvent.js:
+        (WebInspector.MemoryPressureEvent):
+        (WebInspector.MemoryPressureEvent.fromPayload):
+        (WebInspector.MemoryPressureEvent.prototype.get timestamp):
+        (WebInspector.MemoryPressureEvent.prototype.get severity):
+        Model object for a memory pressure event.
+
+        * UserInterface/Views/MemoryTimelineOverviewGraph.css:
+        (.timeline-overview-graph.memory .memory-pressure-event):
+        * UserInterface/Views/MemoryTimelineOverviewGraph.js:
+        (WebInspector.MemoryTimelineOverviewGraph):
+        (WebInspector.MemoryTimelineOverviewGraph.prototype.reset):
+        (WebInspector.MemoryTimelineOverviewGraph.prototype._visibleMemoryPressureEvents):
+        (WebInspector.MemoryTimelineOverviewGraph.prototype._memoryTimelineMemoryPressureEventAdded):
+        Include markers for memory pressure events.
+
+2016-03-08  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: Add Heap domain start/stop tracking commands
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=155190
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseMainjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -114,6 +114,7 @@
</span><span class="cx">     this.analyzerManager = new WebInspector.AnalyzerManager;
</span><span class="cx">     this.runtimeManager = new WebInspector.RuntimeManager;
</span><span class="cx">     this.heapManager = new WebInspector.HeapManager;
</span><ins>+    this.memoryManager = new WebInspector.MemoryManager;
</ins><span class="cx">     this.applicationCacheManager = new WebInspector.ApplicationCacheManager;
</span><span class="cx">     this.timelineManager = new WebInspector.TimelineManager;
</span><span class="cx">     this.debuggerManager = new WebInspector.DebuggerManager;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersMemoryManagerjsfromrev197826trunkSourceWebInspectorUIUserInterfaceProtocolMemoryObserverjs"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/Controllers/MemoryManager.js (from rev 197826, trunk/Source/WebInspectorUI/UserInterface/Protocol/MemoryObserver.js) (0 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/MemoryManager.js                                (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/MemoryManager.js        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -0,0 +1,49 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.MemoryManager = class MemoryManager extends WebInspector.Object
+{
+    constructor()
+    {
+        super();
+
+        if (window.MemoryAgent)
+            MemoryAgent.enable();
+    }
+
+    // Public
+
+    memoryPressure(timestamp, protocolSeverity)
+    {
+        // Called from WebInspector.MemoryObserver.
+
+        let memoryPressureEvent = WebInspector.MemoryPressureEvent.fromPayload(timestamp, protocolSeverity);
+        this.dispatchEventToListeners(WebInspector.MemoryManager.Event.MemoryPressure, {memoryPressureEvent});
+    }
+};
+
+WebInspector.MemoryManager.Event = {
+    MemoryPressure: &quot;memory-manager-memory-pressure&quot;,
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersTimelineManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -34,6 +34,7 @@
</span><span class="cx">         WebInspector.Frame.addEventListener(WebInspector.Frame.Event.ResourceWasAdded, this._resourceWasAdded, this);
</span><span class="cx"> 
</span><span class="cx">         WebInspector.heapManager.addEventListener(WebInspector.HeapManager.Event.GarbageCollected, this._garbageCollected, this);
</span><ins>+        WebInspector.memoryManager.addEventListener(WebInspector.MemoryManager.Event.MemoryPressure, this._memoryPressure, this);
</ins><span class="cx"> 
</span><span class="cx">         this._persistentNetworkTimeline = new WebInspector.NetworkTimeline;
</span><span class="cx"> 
</span><span class="lines">@@ -670,6 +671,14 @@
</span><span class="cx">         this._addRecord(new WebInspector.ScriptTimelineRecord(WebInspector.ScriptTimelineRecord.EventType.GarbageCollected, collection.startTime, collection.endTime, null, null, collection));
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    _memoryPressure(event)
+    {
+        if (!this._isCapturing)
+            return;
+
+        this.activeRecording.addMemoryPressureEvent(event.data.memoryPressureEvent);
+    }
+
</ins><span class="cx">     _scriptProfilerTypeToScriptTimelineRecordType(type)
</span><span class="cx">     {
</span><span class="cx">         switch (type) {
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceMainhtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Main.html (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Main.html        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebInspectorUI/UserInterface/Main.html        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -323,6 +323,8 @@
</span><span class="cx">     &lt;script src=&quot;Models/LogObject.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/MemoryCategory.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/MemoryInstrument.js&quot;&gt;&lt;/script&gt;
</span><ins>+    &lt;script src=&quot;Models/MemoryPressureEvent.js&quot;&gt;&lt;/script&gt;
+    &lt;script src=&quot;Models/MemoryTimeline.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx">     &lt;script src=&quot;Models/MemoryTimelineRecord.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/NativeFunctionParameters.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/NetworkInstrument.js&quot;&gt;&lt;/script&gt;
</span><span class="lines">@@ -661,6 +663,7 @@
</span><span class="cx">     &lt;script src=&quot;Controllers/JavaScriptRuntimeCompletionProvider.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Controllers/LayerTreeManager.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Controllers/LogManager.js&quot;&gt;&lt;/script&gt;
</span><ins>+    &lt;script src=&quot;Controllers/MemoryManager.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx">     &lt;script src=&quot;Controllers/ProbeManager.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Controllers/ReplayManager.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Controllers/RuntimeManager.js&quot;&gt;&lt;/script&gt;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsMemoryPressureEventjsfromrev197826trunkSourceWebInspectorUIUserInterfaceProtocolMemoryObserverjs"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/Models/MemoryPressureEvent.js (from rev 197826, trunk/Source/WebInspectorUI/UserInterface/Protocol/MemoryObserver.js) (0 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/MemoryPressureEvent.js                                (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/MemoryPressureEvent.js        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -0,0 +1,66 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.MemoryPressureEvent = class MemoryPressureEvent extends WebInspector.Object
+{
+    constructor(timestamp, severity)
+    {
+        super();
+
+        this._timestamp = timestamp;
+        this._severity = severity;
+    }
+
+    // Static
+
+    static fromPayload(timestamp, protocolSeverity)
+    {
+        let severity;
+        switch (protocolSeverity) {
+        case MemoryAgent.MemoryPressureSeverity.Critical:
+            severity = WebInspector.MemoryPressureEvent.Severity.Critical;
+            break;
+        case MemoryAgent.MemoryPressureSeverity.NonCritical:
+            severity = WebInspector.MemoryPressureEvent.Severity.NonCritical;
+            break;
+        default:
+            console.error(&quot;Unexpected memory pressure severity&quot;, protocolSeverity);
+            severity = WebInspector.MemoryPressureEvent.Severity.NonCritical;
+            break;
+        }
+
+        return new WebInspector.MemoryPressureEvent(timestamp, severity);
+    }
+
+    // Public
+
+    get timestamp() { return this._timestamp; }
+    get severity() { return this._severity; }
+};
+
+WebInspector.MemoryPressureEvent.Severity = {
+    Critical: Symbol(&quot;Critical&quot;),
+    NonCritical: Symbol(&quot;NonCritical&quot;),
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsMemoryTimelinejsfromrev197826trunkSourceWebInspectorUIUserInterfaceProtocolMemoryObserverjs"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebInspectorUI/UserInterface/Models/MemoryTimeline.js (from rev 197826, trunk/Source/WebInspectorUI/UserInterface/Protocol/MemoryObserver.js) (0 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/MemoryTimeline.js                                (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/MemoryTimeline.js        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -0,0 +1,53 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+WebInspector.MemoryTimeline = class MemoryTimeline extends WebInspector.Timeline
+{
+    // Public
+
+    get memoryPressureEvents() { return this._pressureEvents; }
+
+    addMemoryPressureEvent(memoryPressureEvent)
+    {
+        console.assert(memoryPressureEvent instanceof WebInspector.MemoryPressureEvent);
+
+        this._pressureEvents.push(memoryPressureEvent);
+
+        this.dispatchEventToListeners(WebInspector.MemoryTimeline.Event.MemoryPressureEventAdded, {memoryPressureEvent})
+    }
+
+    // Protected
+
+    reset(suppressEvents)
+    {
+        super.reset(suppressEvents);
+
+        this._pressureEvents = [];
+    }
+};
+
+WebInspector.MemoryTimeline.Event = {
+    MemoryPressureEventAdded: &quot;memory-timeline-memory-pressure-event-added&quot;,
+};
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsTimelinejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Timeline.js (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/Timeline.js        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Timeline.js        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -41,6 +41,9 @@
</span><span class="cx">         if (type === WebInspector.TimelineRecord.Type.Network)
</span><span class="cx">             return new WebInspector.NetworkTimeline(type);
</span><span class="cx"> 
</span><ins>+        if (type === WebInspector.TimelineRecord.Type.Memory)
+            return new WebInspector.MemoryTimeline(type);
+
</ins><span class="cx">         return new WebInspector.Timeline(type);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsTimelineRecordingjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -274,6 +274,16 @@
</span><span class="cx">             this.dispatchEventToListeners(WebInspector.TimelineRecording.Event.SourceCodeTimelineAdded, {sourceCodeTimeline});
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    addMemoryPressureEvent(memoryPressureEvent)
+    {
+        let memoryTimeline = this._timelines.get(WebInspector.TimelineRecord.Type.Memory);
+        console.assert(memoryTimeline, this._timelines);
+        if (!memoryTimeline)
+            return;
+
+        memoryTimeline.addMemoryPressureEvent(memoryPressureEvent);
+    }
+
</ins><span class="cx">     computeElapsedTime(timestamp)
</span><span class="cx">     {
</span><span class="cx">         if (!timestamp || isNaN(timestamp))
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceProtocolMemoryObserverjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Protocol/MemoryObserver.js (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Protocol/MemoryObserver.js        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebInspectorUI/UserInterface/Protocol/MemoryObserver.js        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -27,6 +27,11 @@
</span><span class="cx"> {
</span><span class="cx">     // Events defined by the &quot;Memory&quot; domain.
</span><span class="cx"> 
</span><ins>+    memoryPressure(timestamp, severity)
+    {
+        WebInspector.memoryManager.memoryPressure(timestamp, severity);
+    }
+
</ins><span class="cx">     trackingStart(timestamp)
</span><span class="cx">     {
</span><span class="cx">         WebInspector.timelineManager.memoryTrackingStart(timestamp);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTestTestjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Test/Test.js (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Test/Test.js        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebInspectorUI/UserInterface/Test/Test.js        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -56,6 +56,7 @@
</span><span class="cx">     this.issueManager = new WebInspector.IssueManager;
</span><span class="cx">     this.runtimeManager = new WebInspector.RuntimeManager;
</span><span class="cx">     this.heapManager = new WebInspector.HeapManager;
</span><ins>+    this.memoryManager = new WebInspector.MemoryManager;
</ins><span class="cx">     this.timelineManager = new WebInspector.TimelineManager;
</span><span class="cx">     this.debuggerManager = new WebInspector.DebuggerManager;
</span><span class="cx">     this.probeManager = new WebInspector.ProbeManager;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceTesthtml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Test.html (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Test.html        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebInspectorUI/UserInterface/Test.html        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -124,6 +124,7 @@
</span><span class="cx">     &lt;script src=&quot;Models/LazySourceCodeLocation.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/MemoryCategory.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/MemoryInstrument.js&quot;&gt;&lt;/script&gt;
</span><ins>+    &lt;script src=&quot;Models/MemoryTimeline.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx">     &lt;script src=&quot;Models/MemoryTimelineRecord.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/NetworkInstrument.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Models/NetworkTimeline.js&quot;&gt;&lt;/script&gt;
</span><span class="lines">@@ -165,6 +166,7 @@
</span><span class="cx">     &lt;script src=&quot;Controllers/HeapManager.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Controllers/IssueManager.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Controllers/LogManager.js&quot;&gt;&lt;/script&gt;
</span><ins>+    &lt;script src=&quot;Controllers/MemoryManager.js&quot;&gt;&lt;/script&gt;
</ins><span class="cx">     &lt;script src=&quot;Controllers/ProbeManager.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Controllers/ReplayManager.js&quot;&gt;&lt;/script&gt;
</span><span class="cx">     &lt;script src=&quot;Controllers/RuntimeManager.js&quot;&gt;&lt;/script&gt;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsMemoryTimelineOverviewGraphcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.css (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.css        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.css        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -44,6 +44,13 @@
</span><span class="cx">     color: hsl(0, 0%, 50%);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.timeline-overview-graph.memory .memory-pressure-event {
+    border-left: 1px solid black;
+    position: absolute;
+    top: 0;
+    bottom: 0;
+}
+
</ins><span class="cx"> .timeline-overview-graph:nth-child(even) &gt; .legend {
</span><span class="cx">     background-color: hsl(0, 0%, 96%);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsMemoryTimelineOverviewGraphjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.js (197826 => 197827)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.js        2016-03-09 02:06:45 UTC (rev 197826)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/MemoryTimelineOverviewGraph.js        2016-03-09 02:06:55 UTC (rev 197827)
</span><span class="lines">@@ -31,19 +31,25 @@
</span><span class="cx"> 
</span><span class="cx">         this.element.classList.add(&quot;memory&quot;);
</span><span class="cx"> 
</span><ins>+        console.assert(timeline instanceof WebInspector.MemoryTimeline);
+
</ins><span class="cx">         this._memoryTimeline = timeline;
</span><span class="cx">         this._memoryTimeline.addEventListener(WebInspector.Timeline.Event.RecordAdded, this._memoryTimelineRecordAdded, this);
</span><ins>+        this._memoryTimeline.addEventListener(WebInspector.MemoryTimeline.Event.MemoryPressureEventAdded, this._memoryTimelineMemoryPressureEventAdded, this)
</ins><span class="cx"> 
</span><span class="cx">         this._didInitializeCategories = false;
</span><span class="cx"> 
</span><span class="cx">         let size = new WebInspector.Size(0, this.height);
</span><span class="cx">         this._chart = new WebInspector.StackedLineChart(size);
</span><del>-
</del><span class="cx">         this.element.appendChild(this._chart.element);
</span><span class="cx"> 
</span><span class="cx">         this._legendElement = this.element.appendChild(document.createElement(&quot;div&quot;));
</span><span class="cx">         this._legendElement.classList.add(&quot;legend&quot;);
</span><span class="cx"> 
</span><ins>+        this._memoryPressureMarkersContainerElement = this.element.appendChild(document.createElement(&quot;div&quot;));
+        this._memoryPressureMarkersContainerElement.classList.add(&quot;memory-pressure-markers-container&quot;);
+        this._memoryPressureMarkerElements = [];
+
</ins><span class="cx">         this.reset();
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -63,6 +69,9 @@
</span><span class="cx">         this._updateLegend();
</span><span class="cx">         this._chart.clear();
</span><span class="cx">         this._chart.needsLayout();
</span><ins>+
+        this._memoryPressureMarkersContainerElement.removeChildren();
+        this._memoryPressureMarkerElements = [];
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     layout()
</span><span class="lines">@@ -85,10 +94,6 @@
</span><span class="cx">         let graphCurrentTime = this.currentTime;
</span><span class="cx">         let visibleEndTime = Math.min(this.endTime, this.currentTime);
</span><span class="cx"> 
</span><del>-        let visibleRecords = this._visibleRecords(graphStartTime, visibleEndTime);
-        if (!visibleRecords.length)
-            return;
-
</del><span class="cx">         let secondsPerPixel = this.timelineOverview.secondsPerPixel;
</span><span class="cx">         let maxCapacity = this._maxSize * 1.05; // Add 5% for padding.
</span><span class="cx"> 
</span><span class="lines">@@ -101,6 +106,33 @@
</span><span class="cx">             return height - ((size / maxCapacity) * height);
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        let visibleMemoryPressureEventMarkers = this._visibleMemoryPressureEvents(graphStartTime, visibleEndTime);
+
+        // Reuse existing marker elements.
+        for (let i = 0; i &lt; visibleMemoryPressureEventMarkers.length; ++i) {
+            let markerElement = this._memoryPressureMarkerElements[i];
+            if (!markerElement) {
+                markerElement = this._memoryPressureMarkersContainerElement.appendChild(document.createElement(&quot;div&quot;));
+                markerElement.classList.add(&quot;memory-pressure-event&quot;);
+                this._memoryPressureMarkerElements[i] = markerElement;
+            }
+
+            let memoryPressureEvent = visibleMemoryPressureEventMarkers[i];
+            markerElement.style.left = xScale(memoryPressureEvent.timestamp) + &quot;px&quot;;
+        }
+
+        // Remove excess marker elements.
+        let excess = this._memoryPressureMarkerElements.length - visibleMemoryPressureEventMarkers.length;
+        if (excess) {
+            let elementsToRemove = this._memoryPressureMarkerElements.splice(visibleMemoryPressureEventMarkers.length);
+            for (let element of elementsToRemove)
+                element.remove();
+        }
+
+        let visibleRecords = this._visibleRecords(graphStartTime, visibleEndTime);
+        if (!visibleRecords.length)
+            return;
+
</ins><span class="cx">         function pointSetForRecord(record) {
</span><span class="cx">             let size = 0;
</span><span class="cx">             let ys = [];
</span><span class="lines">@@ -142,6 +174,17 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    _visibleMemoryPressureEvents(startTime, endTime)
+    {
+        let events = this._memoryTimeline.memoryPressureEvents;
+        if (!events.length)
+            return [];
+
+        let lowerIndex = events.lowerBound(startTime, (time, event) =&gt; time - event.timestamp);
+        let upperIndex = events.upperBound(endTime, (time, event) =&gt; time - event.timestamp);
+        return events.slice(lowerIndex, upperIndex);
+    }
+
</ins><span class="cx">     _visibleRecords(startTime, endTime)
</span><span class="cx">     {
</span><span class="cx">         let records = this._memoryTimeline.records;
</span><span class="lines">@@ -174,4 +217,9 @@
</span><span class="cx"> 
</span><span class="cx">         this.needsLayout();
</span><span class="cx">     }
</span><ins>+
+    _memoryTimelineMemoryPressureEventAdded(event)
+    {
+        this.needsLayout();
+    }
</ins><span class="cx"> };
</span></span></pre>
</div>
</div>

</body>
</html>