<!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>[186133] 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/186133">186133</a></dd>
<dt>Author</dt> <dd>mattbaker@apple.com</dd>
<dt>Date</dt> <dd>2015-06-30 14:45:55 -0700 (Tue, 30 Jun 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: Reduce rendering frames &quot;Other&quot; time by instrumenting compositing
https://bugs.webkit.org/show_bug.cgi?id=146168

Reviewed by Brian Burg.

Source/JavaScriptCore:

* inspector/protocol/Timeline.json:
New timeline record type for compositing events.

Source/WebCore:

Added Inspector instrumentation for measuring CoreAnimation compositing time. We mark the start of a composite
event when the LayerFlushScheduler triggers a scheduled layer flush. InspectorController now exports a function
for marking the end of the composite event, which should be called during the CA transaction post-commit phase
(based on platform support). Lacking platform support, the event is considered complete after CoreAnimation
runloop observers have run.

* inspector/InspectorController.cpp:
(WebCore::InspectorController::didComposite):
* inspector/InspectorController.h:
New export for instrumentation in WebKit2.

* inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::willCompositeImpl):
(WebCore::InspectorInstrumentation::didCompositeImpl):
* inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::willComposite):
(WebCore::InspectorInstrumentation::didComposite):
Plumbing for new instrumentation.

* inspector/InspectorTimelineAgent.cpp:
(WebCore::InspectorTimelineAgent::internalStart):
(WebCore::InspectorTimelineAgent::internalStop):
(WebCore::InspectorTimelineAgent::willComposite):
(WebCore::InspectorTimelineAgent::didComposite):
(WebCore::toProtocol):
* inspector/InspectorTimelineAgent.h:
New Composite event type and instrumentation.

* page/FrameView.cpp:
(WebCore::FrameView::flushCompositingStateIncludingSubframes):
Hook for start of compositing.

* platform/spi/cocoa/QuartzCoreSPI.h:
New header include and interface declaration.

Source/WebInspectorUI:

* Localizations/en.lproj/localizedStrings.js:
* UserInterface/Controllers/TimelineManager.js:
(WebInspector.TimelineManager.prototype._processRecord):
Added handling for new Composite record type. Paint records with a parent Composite record
are flagged to simplify processing after the event hierarchy is unpacked.

* UserInterface/Images/TimelineRecordComposite.svg: Added.
New composite record icon.

* UserInterface/Models/LayoutTimelineRecord.js:
(WebInspector.LayoutTimelineRecord):
(WebInspector.LayoutTimelineRecord.displayNameForEventType):
(WebInspector.LayoutTimelineRecord.prototype.get duringComposite): Added
Composite record support.

* UserInterface/Models/RenderingFrameTimelineRecord.js:
(WebInspector.RenderingFrameTimelineRecord.prototype.durationForTask.get validRecordForTaskType):
Add compositing time when bucketing runloop tasks, ignoring Paint events that are
contained within a Composite event.

* UserInterface/Views/LayoutTimelineOverviewGraph.js:
(WebInspector.LayoutTimelineOverviewGraph.prototype._layoutTimelineRecordAdded):
Add Composite records to paint timeline row.

* UserInterface/Views/RenderingFrameTimelineView.js:
(WebInspector.RenderingFrameTimelineView.prototype._processPendingRecords):
Small unrelated fix.

* UserInterface/Views/TimelineIcons.css:
(.composite-record .icon):
* UserInterface/Views/TimelineRecordBar.css:
(.timeline-record-bar.timeline-record-type-layout.layout-timeline-record-composite &gt; .segment):
* UserInterface/Views/TimelineRecordTreeElement.js:
(WebInspector.TimelineRecordTreeElement):
New styles and tree element icon.

Source/WebKit2:

* WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
(WebKit::RemoteLayerTreeDrawingArea::flushLayers):
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::flushLayers):
Added CA transaction post-commit handlers to instrument end of composite.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreinspectorprotocolTimelinejson">trunk/Source/JavaScriptCore/inspector/protocol/Timeline.json</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorControllercpp">trunk/Source/WebCore/inspector/InspectorController.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorControllerh">trunk/Source/WebCore/inspector/InspectorController.h</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="#trunkSourceWebCoreinspectorInspectorTimelineAgentcpp">trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp</a></li>
<li><a href="#trunkSourceWebCoreinspectorInspectorTimelineAgenth">trunk/Source/WebCore/inspector/InspectorTimelineAgent.h</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformspicocoaQuartzCoreSPIh">trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.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="#trunkSourceWebInspectorUIUserInterfaceControllersTimelineManagerjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsLayoutTimelineRecordjs">trunk/Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsRenderingFrameTimelineRecordjs">trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsLayoutTimelineOverviewGraphjs">trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsRenderingFrameTimelineViewjs">trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTimelineIconscss">trunk/Source/WebInspectorUI/UserInterface/Views/TimelineIcons.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTimelineRecordBarcss">trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.css</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceViewsTimelineRecordTreeElementjs">trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreamm">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacTiledCoreAnimationDrawingAreamm">trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceImagesTimelineRecordCompositesvg">trunk/Source/WebInspectorUI/UserInterface/Images/TimelineRecordComposite.svg</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-06-30  Matt Baker  &lt;mattbaker@apple.com&gt;
+
+        Web Inspector: Reduce rendering frames &quot;Other&quot; time by instrumenting compositing
+        https://bugs.webkit.org/show_bug.cgi?id=146168
+
+        Reviewed by Brian Burg.
+
+        * inspector/protocol/Timeline.json:
+        New timeline record type for compositing events.
+
</ins><span class="cx"> 2015-06-29  Dean Jackson  &lt;dino@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Temporarily disable PICTURE_SIZES
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinspectorprotocolTimelinejson"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/inspector/protocol/Timeline.json (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/inspector/protocol/Timeline.json        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/JavaScriptCore/inspector/protocol/Timeline.json        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -13,6 +13,7 @@
</span><span class="cx">                 &quot;InvalidateLayout&quot;,
</span><span class="cx">                 &quot;Layout&quot;,
</span><span class="cx">                 &quot;Paint&quot;,
</span><ins>+                &quot;Composite&quot;,
</ins><span class="cx">                 &quot;RenderingFrame&quot;,
</span><span class="cx">                 &quot;ScrollLayer&quot;,
</span><span class="cx">                 &quot;ParseHTML&quot;,
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebCore/ChangeLog        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -1,3 +1,45 @@
</span><ins>+2015-06-30  Matt Baker  &lt;mattbaker@apple.com&gt;
+
+        Web Inspector: Reduce rendering frames &quot;Other&quot; time by instrumenting compositing
+        https://bugs.webkit.org/show_bug.cgi?id=146168
+
+        Reviewed by Brian Burg.
+
+        Added Inspector instrumentation for measuring CoreAnimation compositing time. We mark the start of a composite
+        event when the LayerFlushScheduler triggers a scheduled layer flush. InspectorController now exports a function
+        for marking the end of the composite event, which should be called during the CA transaction post-commit phase
+        (based on platform support). Lacking platform support, the event is considered complete after CoreAnimation
+        runloop observers have run.
+
+        * inspector/InspectorController.cpp:
+        (WebCore::InspectorController::didComposite):
+        * inspector/InspectorController.h:
+        New export for instrumentation in WebKit2.
+
+        * inspector/InspectorInstrumentation.cpp:
+        (WebCore::InspectorInstrumentation::willCompositeImpl):
+        (WebCore::InspectorInstrumentation::didCompositeImpl):
+        * inspector/InspectorInstrumentation.h:
+        (WebCore::InspectorInstrumentation::willComposite):
+        (WebCore::InspectorInstrumentation::didComposite):
+        Plumbing for new instrumentation.
+
+        * inspector/InspectorTimelineAgent.cpp:
+        (WebCore::InspectorTimelineAgent::internalStart):
+        (WebCore::InspectorTimelineAgent::internalStop):
+        (WebCore::InspectorTimelineAgent::willComposite):
+        (WebCore::InspectorTimelineAgent::didComposite):
+        (WebCore::toProtocol):
+        * inspector/InspectorTimelineAgent.h:
+        New Composite event type and instrumentation.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::flushCompositingStateIncludingSubframes):
+        Hook for start of compositing.
+
+        * platform/spi/cocoa/QuartzCoreSPI.h:
+        New header include and interface declaration.
+
</ins><span class="cx"> 2015-06-30  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         The bounds on InteractionInformationAtPosition should be more precise
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorController.cpp (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorController.cpp        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebCore/inspector/InspectorController.cpp        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -453,4 +453,9 @@
</span><span class="cx">     return m_executionStopwatch.copyRef();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InspectorController::didComposite(Frame&amp; frame)
+{
+    InspectorInstrumentation::didComposite(frame);
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorControllerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorController.h (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorController.h        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebCore/inspector/InspectorController.h        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -137,6 +137,8 @@
</span><span class="cx">     virtual void frontendInitialized() override;
</span><span class="cx">     virtual Ref&lt;WTF::Stopwatch&gt; executionStopwatch() override;
</span><span class="cx"> 
</span><ins>+    WEBCORE_EXPORT void didComposite(Frame&amp;);
+
</ins><span class="cx"> private:
</span><span class="cx">     friend class InspectorInstrumentation;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorInstrumentationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.cpp        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -475,6 +475,18 @@
</span><span class="cx">         timelineAgent-&gt;didDispatchXHRLoadEvent();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InspectorInstrumentation::willCompositeImpl(InstrumentingAgents&amp; instrumentingAgents, Frame&amp; frame)
+{
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
+        timelineAgent-&gt;willComposite(frame);
+}
+
+void InspectorInstrumentation::didCompositeImpl(InstrumentingAgents&amp; instrumentingAgents)
+{
+    if (InspectorTimelineAgent* timelineAgent = instrumentingAgents.inspectorTimelineAgent())
+        timelineAgent-&gt;didComposite();
+}
+
</ins><span class="cx"> void InspectorInstrumentation::willPaintImpl(InstrumentingAgents&amp; instrumentingAgents, RenderObject* renderer)
</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 (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorInstrumentation.h        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebCore/inspector/InspectorInstrumentation.h        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -164,6 +164,8 @@
</span><span class="cx">     static void didDispatchXHRLoadEvent(const InspectorInstrumentationCookie&amp;);
</span><span class="cx">     static void willScrollLayer(Frame&amp;);
</span><span class="cx">     static void didScrollLayer(Frame&amp;);
</span><ins>+    static void willComposite(Frame&amp;);
+    static void didComposite(Frame&amp;);
</ins><span class="cx">     static void willPaint(RenderObject*);
</span><span class="cx">     static void didPaint(RenderObject*, const LayoutRect&amp;);
</span><span class="cx">     static InspectorInstrumentationCookie willRecalculateStyle(Document&amp;);
</span><span class="lines">@@ -342,6 +344,8 @@
</span><span class="cx">     static void didDispatchXHRLoadEventImpl(const InspectorInstrumentationCookie&amp;);
</span><span class="cx">     static void willScrollLayerImpl(InstrumentingAgents&amp;, Frame&amp;);
</span><span class="cx">     static void didScrollLayerImpl(InstrumentingAgents&amp;);
</span><ins>+    static void willCompositeImpl(InstrumentingAgents&amp;, Frame&amp;);
+    static void didCompositeImpl(InstrumentingAgents&amp;);
</ins><span class="cx">     static void willPaintImpl(InstrumentingAgents&amp;, RenderObject*);
</span><span class="cx">     static void didPaintImpl(InstrumentingAgents&amp;, RenderObject*, const LayoutRect&amp;);
</span><span class="cx">     static InspectorInstrumentationCookie willRecalculateStyleImpl(InstrumentingAgents&amp;, Document&amp;);
</span><span class="lines">@@ -814,6 +818,20 @@
</span><span class="cx">         didDispatchXHRLoadEventImpl(cookie);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+inline void InspectorInstrumentation::willComposite(Frame&amp; frame)
+{
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&amp;frame))
+        willCompositeImpl(*instrumentingAgents, frame);
+}
+
+inline void InspectorInstrumentation::didComposite(Frame&amp; frame)
+{
+    FAST_RETURN_IF_NO_FRONTENDS(void());
+    if (InstrumentingAgents* instrumentingAgents = instrumentingAgentsForFrame(&amp;frame))
+        didCompositeImpl(*instrumentingAgents);
+}
+
</ins><span class="cx"> inline void InspectorInstrumentation::willPaint(RenderObject* renderer)
</span><span class="cx"> {
</span><span class="cx">     FAST_RETURN_IF_NO_FRONTENDS(void());
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorTimelineAgentcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.cpp        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -170,8 +170,13 @@
</span><span class="cx"> 
</span><span class="cx">         ASSERT(m_runLoopNestingLevel &gt; 0);
</span><span class="cx">         m_runLoopNestingLevel--;
</span><del>-        if (!m_runLoopNestingLevel)
-            didCompleteCurrentRecord(TimelineRecordType::RenderingFrame);
</del><ins>+        if (m_runLoopNestingLevel)
+            return;
+
+        if (m_startedComposite)
+            didComposite();
+
+        didCompleteCurrentRecord(TimelineRecordType::RenderingFrame);
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     m_frameStartObserver-&gt;schedule(currentRunLoop(), kCFRunLoopEntry | kCFRunLoopAfterWaiting);
</span><span class="lines">@@ -216,6 +221,7 @@
</span><span class="cx">     clearRecordStack();
</span><span class="cx"> 
</span><span class="cx">     m_enabled = false;
</span><ins>+    m_startedComposite = false;
</ins><span class="cx"> 
</span><span class="cx">     if (m_frontendDispatcher)
</span><span class="cx">         m_frontendDispatcher-&gt;recordingStopped();
</span><span class="lines">@@ -399,6 +405,20 @@
</span><span class="cx">     didCompleteCurrentRecord(TimelineRecordType::RecalculateStyles);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void InspectorTimelineAgent::willComposite(Frame&amp; frame)
+{
+    ASSERT(!m_startedComposite);
+    pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Composite, true, &amp;frame);
+    m_startedComposite = true;
+}
+
+void InspectorTimelineAgent::didComposite()
+{
+    ASSERT(m_startedComposite);
+    didCompleteCurrentRecord(TimelineRecordType::Composite);
+    m_startedComposite = false;
+}
+
</ins><span class="cx"> void InspectorTimelineAgent::willPaint(Frame&amp; frame)
</span><span class="cx"> {
</span><span class="cx">     pushCurrentRecord(InspectorObject::create(), TimelineRecordType::Paint, true, &amp;frame);
</span><span class="lines">@@ -607,6 +627,8 @@
</span><span class="cx">         return Inspector::Protocol::Timeline::EventType::Layout;
</span><span class="cx">     case TimelineRecordType::Paint:
</span><span class="cx">         return Inspector::Protocol::Timeline::EventType::Paint;
</span><ins>+    case TimelineRecordType::Composite:
+        return Inspector::Protocol::Timeline::EventType::Composite;
</ins><span class="cx">     case TimelineRecordType::RenderingFrame:
</span><span class="cx">         return Inspector::Protocol::Timeline::EventType::RenderingFrame;
</span><span class="cx">     case TimelineRecordType::ScrollLayer:
</span><span class="lines">@@ -720,15 +742,8 @@
</span><span class="cx"> InspectorTimelineAgent::InspectorTimelineAgent(InstrumentingAgents* instrumentingAgents, InspectorPageAgent* pageAgent, InspectorType type, InspectorClient* client)
</span><span class="cx">     : InspectorAgentBase(ASCIILiteral(&quot;Timeline&quot;), instrumentingAgents)
</span><span class="cx">     , m_pageAgent(pageAgent)
</span><del>-    , m_scriptDebugServer(nullptr)
-    , m_id(1)
-    , m_callStackDepth(0)
-    , m_maxCallStackDepth(5)
</del><span class="cx">     , m_inspectorType(type)
</span><span class="cx">     , m_client(client)
</span><del>-    , m_enabled(false)
-    , m_enabledFromFrontend(false)
-    , m_runLoopNestingLevel(0)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreinspectorInspectorTimelineAgenth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/inspector/InspectorTimelineAgent.h (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/inspector/InspectorTimelineAgent.h        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebCore/inspector/InspectorTimelineAgent.h        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -72,6 +72,7 @@
</span><span class="cx">     InvalidateLayout,
</span><span class="cx">     Layout,
</span><span class="cx">     Paint,
</span><ins>+    Composite,
</ins><span class="cx">     RenderingFrame,
</span><span class="cx">     ScrollLayer,
</span><span class="cx"> 
</span><span class="lines">@@ -155,6 +156,8 @@
</span><span class="cx">     void didScroll();
</span><span class="cx">     void willDispatchXHRLoadEvent(const String&amp;, Frame*);
</span><span class="cx">     void didDispatchXHRLoadEvent();
</span><ins>+    void willComposite(Frame&amp;);
+    void didComposite();
</ins><span class="cx">     void willPaint(Frame&amp;);
</span><span class="cx">     void didPaint(RenderObject*, const LayoutRect&amp;);
</span><span class="cx">     void willRecalculateStyle(Frame*);
</span><span class="lines">@@ -229,29 +232,30 @@
</span><span class="cx">     Page* page();
</span><span class="cx"> 
</span><span class="cx">     InspectorPageAgent* m_pageAgent;
</span><del>-    PageScriptDebugServer* m_scriptDebugServer;
</del><ins>+    PageScriptDebugServer* m_scriptDebugServer { nullptr };
</ins><span class="cx"> 
</span><span class="cx">     std::unique_ptr&lt;Inspector::TimelineFrontendDispatcher&gt; m_frontendDispatcher;
</span><span class="cx">     RefPtr&lt;Inspector::TimelineBackendDispatcher&gt; m_backendDispatcher;
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;TimelineRecordEntry&gt; m_recordStack;
</span><span class="cx"> 
</span><del>-    int m_id;
-    int m_callStackDepth;
-    int m_maxCallStackDepth;
</del><ins>+    int m_id { 1 };
+    int m_callStackDepth { 0 };
+    int m_maxCallStackDepth { 5 };
</ins><span class="cx">     InspectorType m_inspectorType;
</span><span class="cx">     InspectorClient* m_client;
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;TimelineRecordEntry&gt; m_pendingConsoleProfileRecords;
</span><span class="cx"> 
</span><del>-    bool m_enabled;
-    bool m_enabledFromFrontend;
</del><ins>+    bool m_enabled { false };
+    bool m_enabledFromFrontend { false };
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     std::unique_ptr&lt;WebCore::RunLoopObserver&gt; m_frameStartObserver;
</span><span class="cx">     std::unique_ptr&lt;WebCore::RunLoopObserver&gt; m_frameStopObserver;
</span><span class="cx"> #endif
</span><del>-    int m_runLoopNestingLevel;
</del><ins>+    int m_runLoopNestingLevel { 0 };
+    bool m_startedComposite { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebCore/page/FrameView.cpp        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -1082,6 +1082,8 @@
</span><span class="cx"> 
</span><span class="cx"> bool FrameView::flushCompositingStateIncludingSubframes()
</span><span class="cx"> {
</span><ins>+    InspectorInstrumentation::willComposite(frame());
+
</ins><span class="cx">     bool allFramesFlushed = flushCompositingStateForThisFrame(&amp;frame());
</span><span class="cx"> 
</span><span class="cx">     for (Frame* child = frame().tree().firstRenderedChild(); child; child = child-&gt;tree().traverseNextRendered(m_frame.ptr())) {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformspicocoaQuartzCoreSPIh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebCore/platform/spi/cocoa/QuartzCoreSPI.h        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -45,6 +45,7 @@
</span><span class="cx"> #import &lt;QuartzCore/CAContext.h&gt;
</span><span class="cx"> #import &lt;QuartzCore/CAFilter.h&gt;
</span><span class="cx"> #import &lt;QuartzCore/CATiledLayerPrivate.h&gt;
</span><ins>+#import &lt;QuartzCore/CATransactionPrivate.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #ifdef __cplusplus
</span><span class="cx"> }
</span><span class="lines">@@ -112,6 +113,18 @@
</span><span class="cx"> + (CAFilter *)filterWithType:(NSString *)type;
</span><span class="cx"> @property (copy) NSString *name;
</span><span class="cx"> @end
</span><ins>+
+#if (TARGET_OS_IPHONE &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 90000) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100)
+typedef enum {
+    kCATransactionPhasePreLayout,
+    kCATransactionPhasePreCommit,
+    kCATransactionPhasePostCommit,
+} CATransactionPhase;
+
+@interface CATransaction (Details)
++ (void)addCommitHandler:(void(^)(void))block forPhase:(CATransactionPhase)phase;
+@end
+#endif
</ins><span class="cx"> #endif // __OBJC__
</span><span class="cx"> 
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2015-06-30  Matt Baker  &lt;mattbaker@apple.com&gt;
+
+        Web Inspector: Reduce rendering frames &quot;Other&quot; time by instrumenting compositing
+        https://bugs.webkit.org/show_bug.cgi?id=146168
+
+        Reviewed by Brian Burg.
+
+        * Localizations/en.lproj/localizedStrings.js:
+        * UserInterface/Controllers/TimelineManager.js:
+        (WebInspector.TimelineManager.prototype._processRecord):
+        Added handling for new Composite record type. Paint records with a parent Composite record
+        are flagged to simplify processing after the event hierarchy is unpacked.
+
+        * UserInterface/Images/TimelineRecordComposite.svg: Added.
+        New composite record icon.
+
+        * UserInterface/Models/LayoutTimelineRecord.js:
+        (WebInspector.LayoutTimelineRecord):
+        (WebInspector.LayoutTimelineRecord.displayNameForEventType):
+        (WebInspector.LayoutTimelineRecord.prototype.get duringComposite): Added
+        Composite record support.
+
+        * UserInterface/Models/RenderingFrameTimelineRecord.js:
+        (WebInspector.RenderingFrameTimelineRecord.prototype.durationForTask.get validRecordForTaskType):
+        Add compositing time when bucketing runloop tasks, ignoring Paint events that are
+        contained within a Composite event.
+
+        * UserInterface/Views/LayoutTimelineOverviewGraph.js:
+        (WebInspector.LayoutTimelineOverviewGraph.prototype._layoutTimelineRecordAdded):
+        Add Composite records to paint timeline row.
+
+        * UserInterface/Views/RenderingFrameTimelineView.js:
+        (WebInspector.RenderingFrameTimelineView.prototype._processPendingRecords):
+        Small unrelated fix.
+
+        * UserInterface/Views/TimelineIcons.css:
+        (.composite-record .icon):
+        * UserInterface/Views/TimelineRecordBar.css:
+        (.timeline-record-bar.timeline-record-type-layout.layout-timeline-record-composite &gt; .segment):
+        * UserInterface/Views/TimelineRecordTreeElement.js:
+        (WebInspector.TimelineRecordTreeElement):
+        New styles and tree element icon.
+
</ins><span class="cx"> 2015-06-30  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: iOS 8: Uncaught Exception expanding Object Prototype
</span></span></pre></div>
<a id="trunkSourceWebInspectorUILocalizationsenlprojlocalizedStringsjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -108,6 +108,7 @@
</span><span class="cx"> localizedStrings[&quot;Collapse columns&quot;] = &quot;Collapse columns&quot;;
</span><span class="cx"> localizedStrings[&quot;Comment&quot;] = &quot;Comment&quot;;
</span><span class="cx"> localizedStrings[&quot;Comment All Properties&quot;] = &quot;Comment All Properties&quot;;
</span><ins>+localizedStrings[&quot;Composite&quot;] = &quot;Composite&quot;;
</ins><span class="cx"> localizedStrings[&quot;Compressed&quot;] = &quot;Compressed&quot;;
</span><span class="cx"> localizedStrings[&quot;Compression&quot;] = &quot;Compression&quot;;
</span><span class="cx"> localizedStrings[&quot;Computed&quot;] = &quot;Computed&quot;;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersTimelineManagerjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -262,11 +262,19 @@
</span><span class="cx">         case TimelineAgent.EventType.Paint:
</span><span class="cx">             // COMPATIBILITY (iOS 6): Paint records data contained x, y, width, height properties. This became a quad &quot;clip&quot;.
</span><span class="cx">             var quad = recordPayload.data.clip ? new WebInspector.Quad(recordPayload.data.clip) : null;
</span><ins>+            var duringComposite = recordPayload.__duringComposite || false;
</ins><span class="cx">             if (quad)
</span><del>-                return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Paint, startTime, endTime, callFrames, sourceCodeLocation, null, null, quad.width, quad.height, quad);
</del><ins>+                return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Paint, startTime, endTime, callFrames, sourceCodeLocation, null, null, quad.width, quad.height, quad, duringComposite);
</ins><span class="cx">             else
</span><del>-                return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Paint, startTime, endTime, callFrames, sourceCodeLocation, recordPayload.data.x, recordPayload.data.y, recordPayload.data.width, recordPayload.data.height);
</del><ins>+                return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Paint, startTime, endTime, callFrames, sourceCodeLocation, recordPayload.data.x, recordPayload.data.y, recordPayload.data.width, recordPayload.data.height, null, duringComposite);
</ins><span class="cx"> 
</span><ins>+        case TimelineAgent.EventType.Composite:
+            recordPayload.children.forEach(function(childRecordPayload) {
+                console.assert(childRecordPayload.type === TimelineAgent.EventType.Paint, childRecordPayload.type);
+                childRecordPayload.__duringComposite = true;
+            });
+            return new WebInspector.LayoutTimelineRecord(WebInspector.LayoutTimelineRecord.EventType.Composite, startTime, endTime, callFrames, sourceCodeLocation);
+
</ins><span class="cx">         case TimelineAgent.EventType.RenderingFrame:
</span><span class="cx">             if (!recordPayload.children)
</span><span class="cx">                 return null;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceImagesTimelineRecordCompositesvg"></a>
<div class="addfile"><h4>Added: trunk/Source/WebInspectorUI/UserInterface/Images/TimelineRecordComposite.svg (0 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Images/TimelineRecordComposite.svg                                (rev 0)
+++ trunk/Source/WebInspectorUI/UserInterface/Images/TimelineRecordComposite.svg        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -0,0 +1,8 @@
</span><ins>+&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;
+&lt;!-- Copyright © 2015 Apple Inc. All rights reserved. --&gt;
+&lt;svg version=&quot;1.1&quot; xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 16 16&quot;&gt;
+    &lt;path fill=&quot;rgb(176, 204, 105)&quot; d=&quot;M 13 1 L 3 1 C 1.898438 1 1 1.898438 1 3 L 1 13 C 1 14.101562 1.898438 15 3 15 L 13 15 C 14.101562 15 15 14.101562 15 13 L 15 3 C 15 1.898438 14.101562 1 13 1 Z&quot;/&gt;
+    &lt;path fill=&quot;rgb(152, 188, 77)&quot; d=&quot;M 13 1 L 3 1 C 1.898438 1 1 1.898438 1 3 L 1 13 C 1 14.101562 1.898438 15 3 15 L 13 15 C 14.101562 15 15 14.101562 15 13 L 15 3 C 15 1.898438 14.101562 1 13 1 M 13 2 C 13.550781 2 14 2.449219 14 3 L 14 13 C 14 13.550781 13.550781 14 13 14 L 3 14 C 2.449219 14 2 13.550781 2 13 L 2 3 C 2 2.449219 2.449219 2 3 2 L 13 2&quot;/&gt;
+    &lt;path fill=&quot;rgb(152, 188, 77)&quot; d=&quot;M 4.773438 11.542969 C 3.855469 10.621094 3.390625 9.347656 3.390625 7.769531 C 3.390625 6.15625 3.863281 4.878906 4.789062 3.964844 C 5.710938 3.054688 7.003906 2.59375 8.625 2.59375 C 9.570312 2.59375 10.519531 2.707031 11.441406 2.929688 C 11.890625 3.035156 12.210938 3.4375 12.210938 3.902344 L 12.210938 5.195312 C 12.210938 5.519531 12.050781 5.824219 11.789062 6.011719 C 11.613281 6.132812 11.410156 6.195312 11.207031 6.195312 C 11.097656 6.195312 10.984375 6.179688 10.878906 6.140625 C 10.015625 5.835938 9.308594 5.683594 8.769531 5.683594 C 8.058594 5.683594 7.753906 5.941406 7.589844 6.132812 C 7.296875 6.476562 7.148438 7.019531 7.148438 7.746094 C 7.148438 8.445312 7.308594 8.972656 7.621094 9.320312 C 7.808594 9.523438 8.148438 9.796875 8.921875 9.796875 C 9.542969 9.796875 10.1875 9.632812 10.839844 9.308594 C 10.980469 9.242188 11.132812 9.207031 11.285156 9.207031 C 11.46875 9.207031 11.648438 9.257812 11
 .8125 9.359375 C 12.105469 9.539062 12.285156 9.859375 12.285156 10.207031 L 12.285156 11.425781 C 12.285156 11.820312 12.050781 12.179688 11.691406 12.339844 C 10.792969 12.738281 9.730469 12.941406 8.527344 12.941406 C 6.957031 12.941406 5.691406 12.472656 4.773438 11.542969&quot;/&gt;
+    &lt;path fill=&quot;white&quot; d=&quot;M 11.285156 11.425781 C 10.515625 11.769531 9.597656 11.941406 8.527344 11.941406 C 7.226562 11.941406 6.210938 11.574219 5.484375 10.839844 C 4.757812 10.105469 4.394531 9.082031 4.394531 7.769531 C 4.394531 6.429688 4.757812 5.398438 5.492188 4.675781 C 6.222656 3.957031 7.269531 3.59375 8.625 3.59375 C 9.492188 3.59375 10.351562 3.695312 11.210938 3.902344 L 11.210938 5.195312 C 10.238281 4.855469 9.425781 4.683594 8.769531 4.683594 C 7.933594 4.683594 7.285156 4.949219 6.832031 5.484375 C 6.375 6.015625 6.148438 6.769531 6.148438 7.746094 C 6.148438 8.707031 6.394531 9.453125 6.882812 9.992188 C 7.371094 10.527344 8.050781 10.796875 8.921875 10.796875 C 9.703125 10.796875 10.488281 10.601562 11.285156 10.207031 Z&quot;/&gt;
+&lt;/svg&gt;
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsLayoutTimelineRecordjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/LayoutTimelineRecord.js        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -25,7 +25,7 @@
</span><span class="cx"> 
</span><span class="cx"> WebInspector.LayoutTimelineRecord = class LayoutTimelineRecord extends WebInspector.TimelineRecord
</span><span class="cx"> {
</span><del>-    constructor(eventType, startTime, endTime, callFrames, sourceCodeLocation, x, y, width, height, quad)
</del><ins>+    constructor(eventType, startTime, endTime, callFrames, sourceCodeLocation, x, y, width, height, quad, duringComposite)
</ins><span class="cx">     {
</span><span class="cx">         super(WebInspector.TimelineRecord.Type.Layout, startTime, endTime, callFrames, sourceCodeLocation);
</span><span class="cx"> 
</span><span class="lines">@@ -40,6 +40,7 @@
</span><span class="cx">         this._width = typeof width === &quot;number&quot; ? width : NaN;
</span><span class="cx">         this._height = typeof height === &quot;number&quot; ? height : NaN;
</span><span class="cx">         this._quad = quad instanceof WebInspector.Quad ? quad : null;
</span><ins>+        this._duringComposite = duringComposite || false;
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // Static
</span><span class="lines">@@ -59,6 +60,8 @@
</span><span class="cx">             return WebInspector.UIString(&quot;Layout&quot;);
</span><span class="cx">         case WebInspector.LayoutTimelineRecord.EventType.Paint:
</span><span class="cx">             return WebInspector.UIString(&quot;Paint&quot;);
</span><ins>+        case WebInspector.LayoutTimelineRecord.EventType.Composite:
+            return WebInspector.UIString(&quot;Composite&quot;);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -106,6 +109,11 @@
</span><span class="cx">         return this._quad;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    get duringComposite()
+    {
+        return this._duringComposite;
+    }
+
</ins><span class="cx">     saveIdentityToCookie(cookie)
</span><span class="cx">     {
</span><span class="cx">         super.saveIdentityToCookie(cookie);
</span><span class="lines">@@ -120,7 +128,8 @@
</span><span class="cx">     InvalidateLayout: &quot;layout-timeline-record-invalidate-layout&quot;,
</span><span class="cx">     ForcedLayout: &quot;layout-timeline-record-forced-layout&quot;,
</span><span class="cx">     Layout: &quot;layout-timeline-record-layout&quot;,
</span><del>-    Paint: &quot;layout-timeline-record-paint&quot;
</del><ins>+    Paint: &quot;layout-timeline-record-paint&quot;,
+    Composite: &quot;layout-timeline-record-composite&quot;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> WebInspector.LayoutTimelineRecord.TypeIdentifier = &quot;layout-timeline-record&quot;;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsRenderingFrameTimelineRecordjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -83,9 +83,9 @@
</span><span class="cx">             case WebInspector.RenderingFrameTimelineRecord.TaskType.Script:
</span><span class="cx">                 return record.type === WebInspector.TimelineRecord.Type.Script;
</span><span class="cx">             case WebInspector.RenderingFrameTimelineRecord.TaskType.Layout:
</span><del>-                return record.type === WebInspector.TimelineRecord.Type.Layout &amp;&amp; record.eventType !== WebInspector.LayoutTimelineRecord.EventType.Paint;
</del><ins>+                return record.type === WebInspector.TimelineRecord.Type.Layout &amp;&amp; record.eventType !== WebInspector.LayoutTimelineRecord.EventType.Paint &amp;&amp; record.eventType !== WebInspector.LayoutTimelineRecord.EventType.Composite;
</ins><span class="cx">             case WebInspector.RenderingFrameTimelineRecord.TaskType.Paint:
</span><del>-                return record.type === WebInspector.TimelineRecord.Type.Layout &amp;&amp; record.eventType === WebInspector.LayoutTimelineRecord.EventType.Paint;
</del><ins>+                return record.eventType === WebInspector.LayoutTimelineRecord.EventType.Paint || record.eventType === WebInspector.LayoutTimelineRecord.EventType.Composite;
</ins><span class="cx">             default:
</span><span class="cx">                 console.error(&quot;Unsupported task type: &quot; + taskType);
</span><span class="cx">                 return false;
</span><span class="lines">@@ -106,14 +106,21 @@
</span><span class="cx">                 return previousValue + currentDuration;
</span><span class="cx">             }, 0);
</span><span class="cx"> 
</span><del>-            // Time spent in layout events which were synchronously triggered from JavaScript must be deducted from the
-            // rendering frame's script duration, to prevent the time from being counted twice.
</del><span class="cx">             if (taskType === WebInspector.RenderingFrameTimelineRecord.TaskType.Script) {
</span><ins>+                // Layout events synchronously triggered from JavaScript must be subtracted from the total
+                // script time, to prevent the time from being counted twice.
</ins><span class="cx">                 duration -= this._children.reduce(function(previousValue, currentValue) {
</span><span class="cx">                     if (currentValue.type === WebInspector.TimelineRecord.Type.Layout &amp;&amp; (currentValue.sourceCodeLocation || currentValue.callFrames))
</span><span class="cx">                         return previousValue + currentValue.duration;
</span><span class="cx">                     return previousValue;
</span><span class="cx">                 }, 0);
</span><ins>+            } else if (taskType === WebInspector.RenderingFrameTimelineRecord.TaskType.Paint) {
+                // Paint events triggered during a Composite event must be subtracted from the total painting time,
+                // since the compositing time already includes time spent in these Paint events.
+                var paintRecords = this._children.filter(function(record) { return record.eventType === WebInspector.LayoutTimelineRecord.EventType.Paint; });
+                duration -= paintRecords.reduce(function(previousValue, currentValue) {
+                    return currentValue.duringComposite ? previousValue + currentValue.duration : previousValue;
+                }, 0);
</ins><span class="cx">             }
</span><span class="cx">         }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsLayoutTimelineOverviewGraphjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayoutTimelineOverviewGraph.js        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -105,7 +105,7 @@
</span><span class="cx">         var layoutTimelineRecord = event.data.record;
</span><span class="cx">         console.assert(layoutTimelineRecord instanceof WebInspector.LayoutTimelineRecord);
</span><span class="cx"> 
</span><del>-        if (layoutTimelineRecord.eventType === WebInspector.LayoutTimelineRecord.EventType.Paint)
</del><ins>+        if (layoutTimelineRecord.eventType === WebInspector.LayoutTimelineRecord.EventType.Paint || layoutTimelineRecord.eventType === WebInspector.LayoutTimelineRecord.EventType.Composite)
</ins><span class="cx">             this._timelinePaintRecordRow.records.push(layoutTimelineRecord);
</span><span class="cx">         else
</span><span class="cx">             this._timelineLayoutRecordRow.records.push(layoutTimelineRecord);
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsRenderingFrameTimelineViewjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/RenderingFrameTimelineView.js        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -225,6 +225,7 @@
</span><span class="cx"> 
</span><span class="cx">                     this._dataGrid.addRowInSortOrder(layoutTreeElement, layoutDataGridNode, treeElement);
</span><span class="cx">                 } else if (childRecord.type === WebInspector.TimelineRecord.Type.Script) {
</span><ins>+                    var rootNodes = [];
</ins><span class="cx">                     if (childRecord.profile) {
</span><span class="cx">                         // FIXME: Support using the bottom-up tree once it is implemented.
</span><span class="cx">                         rootNodes = childRecord.profile.topDownRootNodes;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTimelineIconscss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineIcons.css (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineIcons.css        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineIcons.css        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -75,6 +75,10 @@
</span><span class="cx">     content: url(../Images/TimelineRecordPaint.svg);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+.composite-record .icon {
+    content: url(../Images/TimelineRecordComposite.svg);
+}
+
</ins><span class="cx"> .rendering-frame-record .icon {
</span><span class="cx">     content: url(../Images/TimelineRecordRenderingFrame.svg);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTimelineRecordBarcss"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.css (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.css        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordBar.css        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -87,7 +87,9 @@
</span><span class="cx">     border-color: rgb(212, 108, 108);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-.timeline-record-bar.timeline-record-type-layout.layout-timeline-record-paint &gt; .segment {
</del><ins>+
+.timeline-record-bar.timeline-record-type-layout.layout-timeline-record-paint &gt; .segment,
+.timeline-record-bar.timeline-record-type-layout.layout-timeline-record-composite &gt; .segment {
</ins><span class="cx">     background-color: rgb(176, 204, 105);
</span><span class="cx">     border-color: rgb(152, 188, 77);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceViewsTimelineRecordTreeElementjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TimelineRecordTreeElement.js        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -62,6 +62,9 @@
</span><span class="cx">             case WebInspector.LayoutTimelineRecord.EventType.Paint:
</span><span class="cx">                 iconStyleClass = WebInspector.TimelineRecordTreeElement.PaintRecordIconStyleClass;
</span><span class="cx">                 break;
</span><ins>+            case WebInspector.LayoutTimelineRecord.EventType.Composite:
+                iconStyleClass = WebInspector.TimelineRecordTreeElement.CompositeRecordIconStyleClass;
+                break;
</ins><span class="cx">             default:
</span><span class="cx">                 console.error(&quot;Unknown LayoutTimelineRecord eventType: &quot; + timelineRecord.eventType, timelineRecord);
</span><span class="cx">             }
</span><span class="lines">@@ -157,6 +160,7 @@
</span><span class="cx"> WebInspector.TimelineRecordTreeElement.StyleRecordIconStyleClass = &quot;style-record&quot;;
</span><span class="cx"> WebInspector.TimelineRecordTreeElement.LayoutRecordIconStyleClass = &quot;layout-record&quot;;
</span><span class="cx"> WebInspector.TimelineRecordTreeElement.PaintRecordIconStyleClass = &quot;paint-record&quot;;
</span><ins>+WebInspector.TimelineRecordTreeElement.CompositeRecordIconStyleClass = &quot;composite-record&quot;;
</ins><span class="cx"> WebInspector.TimelineRecordTreeElement.RenderingFrameRecordIconStyleClass = &quot;rendering-frame-record&quot;;
</span><span class="cx"> WebInspector.TimelineRecordTreeElement.EvaluatedRecordIconStyleClass = &quot;evaluated-record&quot;;
</span><span class="cx"> WebInspector.TimelineRecordTreeElement.EventRecordIconStyleClass = &quot;event-record&quot;;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebKit2/ChangeLog        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-06-30  Matt Baker  &lt;mattbaker@apple.com&gt;
+
+        Web Inspector: Reduce rendering frames &quot;Other&quot; time by instrumenting compositing
+        https://bugs.webkit.org/show_bug.cgi?id=146168
+
+        Reviewed by Brian Burg.
+
+        * WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm:
+        (WebKit::RemoteLayerTreeDrawingArea::flushLayers):
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
+        Added CA transaction post-commit handlers to instrument end of composite.
+
</ins><span class="cx"> 2015-06-30  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         The bounds on InteractionInformationAtPosition should be more precise
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeDrawingAreamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeDrawingArea.mm        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -40,8 +40,10 @@
</span><span class="cx"> #import &lt;WebCore/DebugPageOverlays.h&gt;
</span><span class="cx"> #import &lt;WebCore/Frame.h&gt;
</span><span class="cx"> #import &lt;WebCore/FrameView.h&gt;
</span><ins>+#import &lt;WebCore/InspectorController.h&gt;
</ins><span class="cx"> #import &lt;WebCore/MainFrame.h&gt;
</span><span class="cx"> #import &lt;WebCore/PageOverlayController.h&gt;
</span><ins>+#import &lt;WebCore/QuartzCoreSPI.h&gt;
</ins><span class="cx"> #import &lt;WebCore/RenderLayerCompositor.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderView.h&gt;
</span><span class="cx"> #import &lt;WebCore/Settings.h&gt;
</span><span class="lines">@@ -359,6 +361,12 @@
</span><span class="cx">     FloatRect visibleRect(FloatPoint(), m_viewSize);
</span><span class="cx">     visibleRect.intersect(m_scrolledExposedRect);
</span><span class="cx"> 
</span><ins>+#if (TARGET_OS_IPHONE &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 90000) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100)
+    [CATransaction addCommitHandler:^{
+        m_webPage.corePage()-&gt;inspectorController().didComposite(m_webPage.mainFrameView()-&gt;frame());
+    } forPhase:kCATransactionPhasePostCommit];
+#endif
+
</ins><span class="cx">     m_webPage.mainFrameView()-&gt;flushCompositingStateIncludingSubframes();
</span><span class="cx"> 
</span><span class="cx">     // Because our view-relative overlay root layer is not attached to the FrameView's GraphicsLayer tree, we need to flush it manually.
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacTiledCoreAnimationDrawingAreamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (186132 => 186133)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm        2015-06-30 21:40:01 UTC (rev 186132)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm        2015-06-30 21:45:55 UTC (rev 186133)
</span><span class="lines">@@ -43,10 +43,12 @@
</span><span class="cx"> #import &lt;WebCore/FrameView.h&gt;
</span><span class="cx"> #import &lt;WebCore/GraphicsContext.h&gt;
</span><span class="cx"> #import &lt;WebCore/GraphicsLayerCA.h&gt;
</span><ins>+#import &lt;WebCore/InspectorController.h&gt;
</ins><span class="cx"> #import &lt;WebCore/MachSendRight.h&gt;
</span><span class="cx"> #import &lt;WebCore/MainFrame.h&gt;
</span><span class="cx"> #import &lt;WebCore/Page.h&gt;
</span><span class="cx"> #import &lt;WebCore/PlatformCAAnimationCocoa.h&gt;
</span><ins>+#import &lt;WebCore/QuartzCoreSPI.h&gt;
</ins><span class="cx"> #import &lt;WebCore/RenderLayerBacking.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderLayerCompositor.h&gt;
</span><span class="cx"> #import &lt;WebCore/RenderView.h&gt;
</span><span class="lines">@@ -388,6 +390,12 @@
</span><span class="cx">         if (m_viewOverlayRootLayer)
</span><span class="cx">             m_viewOverlayRootLayer-&gt;flushCompositingState(visibleRect);
</span><span class="cx"> 
</span><ins>+#if (TARGET_OS_IPHONE &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 90000) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100)
+        [CATransaction addCommitHandler:^{
+            m_webPage.corePage()-&gt;inspectorController().didComposite(m_webPage.mainFrameView()-&gt;frame());
+        } forPhase:kCATransactionPhasePostCommit];
+#endif
+
</ins><span class="cx">         bool returnValue = m_webPage.mainFrameView()-&gt;flushCompositingStateIncludingSubframes();
</span><span class="cx"> #if ENABLE(ASYNC_SCROLLING)
</span><span class="cx">         if (ScrollingCoordinator* scrollingCoordinator = m_webPage.corePage()-&gt;scrollingCoordinator())
</span></span></pre>
</div>
</div>

</body>
</html>