<!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>[234981] trunk/Source/WebKit</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/234981">234981</a></dd>
<dt>Author</dt> <dd>mcatanzaro@igalia.com</dd>
<dt>Date</dt> <dd>2018-08-17 06:15:42 -0700 (Fri, 17 Aug 2018)</dd>
</dl>

<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/234259">r234259</a>.

Caused excessive CPU usage

Reverted changeset:

"[GTK][WPE] Improve the way request displayRefresh
notifications"
https://bugs.webkit.org/show_bug.cgi?id=188005
https://trac.webkit.org/changeset/234259</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitChangeLog">trunk/Source/WebKit/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitSharedCoordinatedGraphicsthreadedcompositorThreadedCompositorcpp">trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedCoordinatedGraphicsthreadedcompositorThreadedCompositorh">trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h</a></li>
<li><a href="#trunkSourceWebKitSharedCoordinatedGraphicsthreadedcompositorThreadedDisplayRefreshMonitorcpp">trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp</a></li>
<li><a href="#trunkSourceWebKitSharedCoordinatedGraphicsthreadedcompositorThreadedDisplayRefreshMonitorh">trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageCoordinatedGraphicsCoordinatedLayerTreeHostcpp">trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageCoordinatedGraphicsCoordinatedLayerTreeHosth">trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageCoordinatedGraphicsThreadedCoordinatedLayerTreeHostcpp">trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp</a></li>
<li><a href="#trunkSourceWebKitWebProcessWebPageCoordinatedGraphicsThreadedCoordinatedLayerTreeHosth">trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ChangeLog (234980 => 234981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ChangeLog    2018-08-17 13:04:17 UTC (rev 234980)
+++ trunk/Source/WebKit/ChangeLog       2018-08-17 13:15:42 UTC (rev 234981)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2018-08-17  Michael Catanzaro  <mcatanzaro@igalia.com>
+
+        Unreviewed, rolling out r234259.
+
+        Caused excessive CPU usage
+
+        Reverted changeset:
+
+        "[GTK][WPE] Improve the way request displayRefresh
+        notifications"
+        https://bugs.webkit.org/show_bug.cgi?id=188005
+        https://trac.webkit.org/changeset/234259
+
</ins><span class="cx"> 2018-08-16  Commit Queue  <commit-queue@webkit.org>
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r234958.
</span></span></pre></div>
<a id="trunkSourceWebKitSharedCoordinatedGraphicsthreadedcompositorThreadedCompositorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (234980 => 234981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp 2018-08-17 13:04:17 UTC (rev 234980)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp    2018-08-17 13:15:42 UTC (rev 234981)
</span><span class="lines">@@ -45,18 +45,18 @@
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><del>-Ref<ThreadedCompositor> ThreadedCompositor::create(Client& client, ThreadedDisplayRefreshMonitor::Client& displayRefreshMonitorClient, PlatformDisplayID displayID, const IntSize& viewportSize, float scaleFactor, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
</del><ins>+Ref<ThreadedCompositor> ThreadedCompositor::create(Client& client, PlatformDisplayID displayID, const IntSize& viewportSize, float scaleFactor, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
</ins><span class="cx"> {
</span><del>-    return adoptRef(*new ThreadedCompositor(client, displayRefreshMonitorClient, displayID, viewportSize, scaleFactor, doFrameSync, paintFlags));
</del><ins>+    return adoptRef(*new ThreadedCompositor(client, displayID, viewportSize, scaleFactor, doFrameSync, paintFlags));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-ThreadedCompositor::ThreadedCompositor(Client& client, ThreadedDisplayRefreshMonitor::Client& displayRefreshMonitorClient, PlatformDisplayID displayID, const IntSize& viewportSize, float scaleFactor, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
</del><ins>+ThreadedCompositor::ThreadedCompositor(Client& client, PlatformDisplayID displayID, const IntSize& viewportSize, float scaleFactor, ShouldDoFrameSync doFrameSync, TextureMapper::PaintFlags paintFlags)
</ins><span class="cx">     : m_client(client)
</span><span class="cx">     , m_doFrameSync(doFrameSync)
</span><span class="cx">     , m_paintFlags(paintFlags)
</span><span class="cx">     , m_compositingRunLoop(std::make_unique<CompositingRunLoop>([this] { renderLayerTree(); }))
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><del>-    , m_displayRefreshMonitor(ThreadedDisplayRefreshMonitor::create(displayID, displayRefreshMonitorClient))
</del><ins>+    , m_displayRefreshMonitor(ThreadedDisplayRefreshMonitor::create(displayID, *this))
</ins><span class="cx"> #endif
</span><span class="cx"> {
</span><span class="cx">     {
</span><span class="lines">@@ -304,8 +304,23 @@
</span><span class="cx">     return m_displayRefreshMonitor.copyRef();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadedCompositor::handleDisplayRefreshMonitorUpdate()
</del><ins>+void ThreadedCompositor::requestDisplayRefreshMonitorUpdate()
</ins><span class="cx"> {
</span><ins>+    // This is invoked by ThreadedDisplayRefreshMonitor when a fresh update is required.
+
+    LockHolder stateLocker(m_compositingRunLoop->stateLock());
+    {
+        // coordinateUpdateCompletionWithClient is set to true in order to delay the scene update
+        // completion until the DisplayRefreshMonitor is fired on the main thread after the composition
+        // is completed.
+        LockHolder locker(m_attributes.lock);
+        m_attributes.coordinateUpdateCompletionWithClient = true;
+    }
+    m_compositingRunLoop->scheduleUpdate(stateLocker);
+}
+
+void ThreadedCompositor::handleDisplayRefreshMonitorUpdate(bool hasBeenRescheduled)
+{
</ins><span class="cx">     // Retrieve coordinateUpdateCompletionWithClient.
</span><span class="cx">     bool coordinateUpdateCompletionWithClient { false };
</span><span class="cx">     {
</span><span class="lines">@@ -313,6 +328,12 @@
</span><span class="cx">         coordinateUpdateCompletionWithClient = std::exchange(m_attributes.coordinateUpdateCompletionWithClient, false);
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    // The client is finally notified about the scene update nearing completion. The client will use this
+    // opportunity to clean up resources as appropriate. It can also perform any layer flush that was
+    // requested during the composition, or by any DisplayRefreshMonitor notifications that have been
+    // handled at this point.
+    m_client.renderNextFrame();
+
</ins><span class="cx">     LockHolder stateLocker(m_compositingRunLoop->stateLock());
</span><span class="cx"> 
</span><span class="cx">     // If required, mark the current scene update as completed. CompositingRunLoop will take care of
</span><span class="lines">@@ -320,6 +341,16 @@
</span><span class="cx">     // or DisplayRefreshMonitor notifications.
</span><span class="cx">     if (coordinateUpdateCompletionWithClient)
</span><span class="cx">         m_compositingRunLoop->updateCompleted(stateLocker);
</span><ins>+
+    // If the DisplayRefreshMonitor was scheduled again, we immediately demand the update completion
+    // coordination (like we do in requestDisplayRefreshMonitorUpdate()) and request an update.
+    if (hasBeenRescheduled) {
+        {
+            LockHolder locker(m_attributes.lock);
+            m_attributes.coordinateUpdateCompletionWithClient = true;
+        }
+        m_compositingRunLoop->scheduleUpdate(stateLocker);
+    }
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitSharedCoordinatedGraphicsthreadedcompositorThreadedCompositorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h (234980 => 234981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h   2018-08-17 13:04:17 UTC (rev 234980)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h      2018-08-17 13:15:42 UTC (rev 234981)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> #include <wtf/ThreadSafeRefCounted.h>
</span><span class="cx"> 
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><del>-#include "ThreadedDisplayRefreshMonitor.h"
</del><ins>+#include <WebCore/DisplayRefreshMonitor.h>
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -46,6 +46,7 @@
</span><span class="cx"> 
</span><span class="cx"> class CoordinatedGraphicsScene;
</span><span class="cx"> class CoordinatedGraphicsSceneClient;
</span><ins>+class ThreadedDisplayRefreshMonitor;
</ins><span class="cx"> 
</span><span class="cx"> class ThreadedCompositor : public CoordinatedGraphicsSceneClient, public ThreadSafeRefCounted<ThreadedCompositor> {
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(ThreadedCompositor);
</span><span class="lines">@@ -53,6 +54,8 @@
</span><span class="cx"> public:
</span><span class="cx">     class Client {
</span><span class="cx">     public:
</span><ins>+        virtual void renderNextFrame() = 0;
+
</ins><span class="cx">         virtual uint64_t nativeSurfaceHandleForCompositing() = 0;
</span><span class="cx">         virtual void didDestroyGLContext() = 0;
</span><span class="cx"> 
</span><span class="lines">@@ -62,7 +65,7 @@
</span><span class="cx"> 
</span><span class="cx">     enum class ShouldDoFrameSync { No, Yes };
</span><span class="cx"> 
</span><del>-    static Ref<ThreadedCompositor> create(Client&, ThreadedDisplayRefreshMonitor::Client&, WebCore::PlatformDisplayID, const WebCore::IntSize&, float scaleFactor, ShouldDoFrameSync = ShouldDoFrameSync::Yes, WebCore::TextureMapper::PaintFlags = 0);
</del><ins>+    static Ref<ThreadedCompositor> create(Client&, WebCore::PlatformDisplayID, const WebCore::IntSize&, float scaleFactor, ShouldDoFrameSync = ShouldDoFrameSync::Yes, WebCore::TextureMapper::PaintFlags = 0);
</ins><span class="cx">     virtual ~ThreadedCompositor();
</span><span class="cx"> 
</span><span class="cx">     void setNativeSurfaceHandleForCompositing(uint64_t);
</span><span class="lines">@@ -79,13 +82,14 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
</span><span class="cx">     RefPtr<WebCore::DisplayRefreshMonitor> displayRefreshMonitor(WebCore::PlatformDisplayID);
</span><del>-    void handleDisplayRefreshMonitorUpdate();
</del><ins>+    void requestDisplayRefreshMonitorUpdate();
+    void handleDisplayRefreshMonitorUpdate(bool hasBeenRescheduled);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void frameComplete();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    ThreadedCompositor(Client&, ThreadedDisplayRefreshMonitor::Client&, WebCore::PlatformDisplayID, const WebCore::IntSize&, float scaleFactor, ShouldDoFrameSync, WebCore::TextureMapper::PaintFlags);
</del><ins>+    ThreadedCompositor(Client&, WebCore::PlatformDisplayID, const WebCore::IntSize&, float scaleFactor, ShouldDoFrameSync, WebCore::TextureMapper::PaintFlags);
</ins><span class="cx"> 
</span><span class="cx">     // CoordinatedGraphicsSceneClient
</span><span class="cx">     void updateViewport() override;
</span></span></pre></div>
<a id="trunkSourceWebKitSharedCoordinatedGraphicsthreadedcompositorThreadedDisplayRefreshMonitorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp (234980 => 234981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp      2018-08-17 13:04:17 UTC (rev 234980)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.cpp 2018-08-17 13:15:42 UTC (rev 234981)
</span><span class="lines">@@ -37,10 +37,10 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor(WebCore::PlatformDisplayID displayID, Client& client)
</del><ins>+ThreadedDisplayRefreshMonitor::ThreadedDisplayRefreshMonitor(WebCore::PlatformDisplayID displayID, ThreadedCompositor& compositor)
</ins><span class="cx">     : WebCore::DisplayRefreshMonitor(displayID)
</span><span class="cx">     , m_displayRefreshTimer(RunLoop::main(), this, &ThreadedDisplayRefreshMonitor::displayRefreshCallback)
</span><del>-    , m_client(&client)
</del><ins>+    , m_compositor(&compositor)
</ins><span class="cx"> {
</span><span class="cx"> #if USE(GLIB_EVENT_LOOP)
</span><span class="cx">     m_displayRefreshTimer.setPriority(RunLoopSourcePriority::DisplayRefreshMonitorTimer);
</span><span class="lines">@@ -50,7 +50,7 @@
</span><span class="cx"> 
</span><span class="cx"> bool ThreadedDisplayRefreshMonitor::requestRefreshCallback()
</span><span class="cx"> {
</span><del>-    if (!m_client)
</del><ins>+    if (!m_compositor)
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     bool previousFrameDone { false };
</span><span class="lines">@@ -64,7 +64,7 @@
</span><span class="cx">     // refresh notifications under ThreadedDisplayRefreshMonitor::displayRefreshCallback().
</span><span class="cx">     // Any such schedule request is handled in that method after the notifications.
</span><span class="cx">     if (previousFrameDone)
</span><del>-        m_client->requestDisplayRefreshMonitorUpdate();
</del><ins>+        m_compositor->requestDisplayRefreshMonitorUpdate();
</ins><span class="cx"> 
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="lines">@@ -77,7 +77,7 @@
</span><span class="cx"> 
</span><span class="cx"> void ThreadedDisplayRefreshMonitor::dispatchDisplayRefreshCallback()
</span><span class="cx"> {
</span><del>-    if (!m_client)
</del><ins>+    if (!m_compositor)
</ins><span class="cx">         return;
</span><span class="cx">     m_displayRefreshTimer.startOneShot(0_s);
</span><span class="cx"> }
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx"> void ThreadedDisplayRefreshMonitor::invalidate()
</span><span class="cx"> {
</span><span class="cx">     m_displayRefreshTimer.stop();
</span><del>-    m_client = nullptr;
</del><ins>+    m_compositor = nullptr;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ThreadedDisplayRefreshMonitor::displayRefreshCallback()
</span><span class="lines">@@ -111,8 +111,8 @@
</span><span class="cx">     // Notify the compositor about the completed DisplayRefreshMonitor update, passing
</span><span class="cx">     // along information about any schedule request that might have occurred during
</span><span class="cx">     // the notification handling.
</span><del>-    if (m_client)
-        m_client->handleDisplayRefreshMonitorUpdate(hasBeenRescheduled);
</del><ins>+    if (m_compositor)
+        m_compositor->handleDisplayRefreshMonitorUpdate(hasBeenRescheduled);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitSharedCoordinatedGraphicsthreadedcompositorThreadedDisplayRefreshMonitorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h (234980 => 234981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h        2018-08-17 13:04:17 UTC (rev 234980)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h   2018-08-17 13:15:42 UTC (rev 234981)
</span><span class="lines">@@ -36,15 +36,9 @@
</span><span class="cx"> 
</span><span class="cx"> class ThreadedDisplayRefreshMonitor : public WebCore::DisplayRefreshMonitor {
</span><span class="cx"> public:
</span><del>-    class Client {
-    public:
-        virtual void requestDisplayRefreshMonitorUpdate() = 0;
-        virtual void handleDisplayRefreshMonitorUpdate(bool) = 0;
-    };
-
-    static Ref<ThreadedDisplayRefreshMonitor> create(WebCore::PlatformDisplayID displayID, Client& client)
</del><ins>+    static Ref<ThreadedDisplayRefreshMonitor> create(WebCore::PlatformDisplayID displayID, ThreadedCompositor& compositor)
</ins><span class="cx">     {
</span><del>-        return adoptRef(*new ThreadedDisplayRefreshMonitor(displayID, client));
</del><ins>+        return adoptRef(*new ThreadedDisplayRefreshMonitor(displayID, compositor));
</ins><span class="cx">     }
</span><span class="cx">     virtual ~ThreadedDisplayRefreshMonitor() = default;
</span><span class="cx"> 
</span><span class="lines">@@ -55,11 +49,11 @@
</span><span class="cx">     void invalidate();
</span><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    ThreadedDisplayRefreshMonitor(WebCore::PlatformDisplayID, Client&);
</del><ins>+    ThreadedDisplayRefreshMonitor(WebCore::PlatformDisplayID, ThreadedCompositor&);
</ins><span class="cx"> 
</span><span class="cx">     void displayRefreshCallback();
</span><span class="cx">     RunLoop::Timer<ThreadedDisplayRefreshMonitor> m_displayRefreshTimer;
</span><del>-    Client* m_client;
</del><ins>+    ThreadedCompositor* m_compositor;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageCoordinatedGraphicsCoordinatedLayerTreeHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (234980 => 234981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp  2018-08-17 13:04:17 UTC (rev 234980)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp     2018-08-17 13:15:42 UTC (rev 234981)
</span><span class="lines">@@ -145,7 +145,7 @@
</span><span class="cx">     scheduleLayerFlush();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CoordinatedLayerTreeHost::renderNextFrame(bool forceRepaint)
</del><ins>+void CoordinatedLayerTreeHost::renderNextFrame()
</ins><span class="cx"> {
</span><span class="cx">     m_isWaitingForRenderer = false;
</span><span class="cx">     bool scheduledWhileWaitingForRenderer = std::exchange(m_scheduledWhileWaitingForRenderer, false);
</span><span class="lines">@@ -167,10 +167,8 @@
</span><span class="cx">         m_forceRepaintAsync.needsFreshFlush = false;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (scheduledWhileWaitingForRenderer || m_layerFlushTimer.isActive() || forceRepaint) {
</del><ins>+    if (scheduledWhileWaitingForRenderer || m_layerFlushTimer.isActive()) {
</ins><span class="cx">         m_layerFlushTimer.stop();
</span><del>-        if (forceRepaint)
-            m_coordinator.forceFrameSync();
</del><span class="cx">         layerFlushTimerFired();
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -211,15 +209,6 @@
</span><span class="cx">     m_isWaitingForRenderer = true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void CoordinatedLayerTreeHost::flushLayersAndForceRepaint()
-{
-    if (m_layerFlushTimer.isActive())
-        m_layerFlushTimer.stop();
-
-    m_coordinator.forceFrameSync();
-    layerFlushTimerFired();
-}
-
</del><span class="cx"> void CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged()
</span><span class="cx"> {
</span><span class="cx">     m_coordinator.deviceOrPageScaleFactorChanged();
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageCoordinatedGraphicsCoordinatedLayerTreeHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (234980 => 234981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h    2018-08-17 13:04:17 UTC (rev 234980)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h       2018-08-17 13:15:42 UTC (rev 234981)
</span><span class="lines">@@ -58,7 +58,7 @@
</span><span class="cx">     void pageBackgroundTransparencyChanged() override;
</span><span class="cx"> 
</span><span class="cx">     void setVisibleContentsRect(const WebCore::FloatRect&);
</span><del>-    void renderNextFrame(bool);
</del><ins>+    void renderNextFrame();
</ins><span class="cx"> 
</span><span class="cx">     WebCore::GraphicsLayerFactory* graphicsLayerFactory() override;
</span><span class="cx"> 
</span><span class="lines">@@ -71,8 +71,6 @@
</span><span class="cx">     void notifyFlushRequired() override { scheduleLayerFlush(); };
</span><span class="cx">     void commitSceneState(const WebCore::CoordinatedGraphicsState&) override;
</span><span class="cx"> 
</span><del>-    void flushLayersAndForceRepaint();
-
</del><span class="cx"> private:
</span><span class="cx">     void layerFlushTimerFired();
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageCoordinatedGraphicsThreadedCoordinatedLayerTreeHostcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp (234980 => 234981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp  2018-08-17 13:04:17 UTC (rev 234980)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp     2018-08-17 13:15:42 UTC (rev 234981)
</span><span class="lines">@@ -77,10 +77,10 @@
</span><span class="cx">         if (m_surface->shouldPaintMirrored())
</span><span class="cx">             paintFlags |= TextureMapper::PaintingMirrored;
</span><span class="cx"> 
</span><del>-        m_compositor = ThreadedCompositor::create(m_compositorClient, m_compositorClient, compositingDisplayID, scaledSize, scaleFactor, ThreadedCompositor::ShouldDoFrameSync::Yes, paintFlags);
</del><ins>+        m_compositor = ThreadedCompositor::create(m_compositorClient, compositingDisplayID, scaledSize, scaleFactor, ThreadedCompositor::ShouldDoFrameSync::Yes, paintFlags);
</ins><span class="cx">         m_layerTreeContext.contextID = m_surface->surfaceID();
</span><span class="cx">     } else
</span><del>-        m_compositor = ThreadedCompositor::create(m_compositorClient, m_compositorClient, compositingDisplayID, scaledSize, scaleFactor);
</del><ins>+        m_compositor = ThreadedCompositor::create(m_compositorClient, compositingDisplayID, scaledSize, scaleFactor);
</ins><span class="cx"> 
</span><span class="cx">     m_webPage.windowScreenDidChange(compositingDisplayID);
</span><span class="cx"> 
</span><span class="lines">@@ -105,22 +105,6 @@
</span><span class="cx">     m_compositor->frameComplete();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadedCoordinatedLayerTreeHost::requestDisplayRefreshMonitorUpdate()
-{
-    // Flush layers to cause a repaint. If m_isWaitingForRenderer was true at this point, the layer
-    // flush won't do anything, but that means there's a painting ongoing that will send the
-    // display refresh notification when it's done.
-    flushLayersAndForceRepaint();
-}
-
-void ThreadedCoordinatedLayerTreeHost::handleDisplayRefreshMonitorUpdate(bool hasBeenRescheduled)
-{
-    // Call renderNextFrame. If hasBeenRescheduled is true, the layer flush will force a repaint
-    // that will cause the display refresh notification to come.
-    renderNextFrame(hasBeenRescheduled);
-    m_compositor->handleDisplayRefreshMonitorUpdate();
-}
-
</del><span class="cx"> uint64_t ThreadedCoordinatedLayerTreeHost::nativeSurfaceHandleForCompositing()
</span><span class="cx"> {
</span><span class="cx">     if (!m_surface)
</span></span></pre></div>
<a id="trunkSourceWebKitWebProcessWebPageCoordinatedGraphicsThreadedCoordinatedLayerTreeHosth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h (234980 => 234981)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h    2018-08-17 13:04:17 UTC (rev 234980)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h       2018-08-17 13:15:42 UTC (rev 234981)
</span><span class="lines">@@ -33,7 +33,6 @@
</span><span class="cx"> #include "CoordinatedLayerTreeHost.h"
</span><span class="cx"> #include "SimpleViewportController.h"
</span><span class="cx"> #include "ThreadedCompositor.h"
</span><del>-#include "ThreadedDisplayRefreshMonitor.h"
</del><span class="cx"> #include <wtf/OptionSet.h>
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -72,7 +71,7 @@
</span><span class="cx">     void setNativeSurfaceHandleForCompositing(uint64_t) override;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    class CompositorClient final : public ThreadedCompositor::Client, public ThreadedDisplayRefreshMonitor::Client  {
</del><ins>+    class CompositorClient final : public ThreadedCompositor::Client {
</ins><span class="cx">         WTF_MAKE_NONCOPYABLE(CompositorClient);
</span><span class="cx">     public:
</span><span class="cx">         CompositorClient(ThreadedCoordinatedLayerTreeHost& layerTreeHost)
</span><span class="lines">@@ -81,6 +80,11 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">     private:
</span><ins>+        void renderNextFrame() override
+        {
+            m_layerTreeHost.renderNextFrame();
+        }
+
</ins><span class="cx">         uint64_t nativeSurfaceHandleForCompositing() override
</span><span class="cx">         {
</span><span class="cx">             return m_layerTreeHost.nativeSurfaceHandleForCompositing();
</span><span class="lines">@@ -101,16 +105,6 @@
</span><span class="cx">             m_layerTreeHost.didRenderFrame();
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        void requestDisplayRefreshMonitorUpdate() override
-        {
-            m_layerTreeHost.requestDisplayRefreshMonitorUpdate();
-        }
-
-        void handleDisplayRefreshMonitorUpdate(bool hasBeenRescheduled)
-        {
-            m_layerTreeHost.handleDisplayRefreshMonitorUpdate(hasBeenRescheduled);
-        }
-
</del><span class="cx">         ThreadedCoordinatedLayerTreeHost& m_layerTreeHost;
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="lines">@@ -131,8 +125,6 @@
</span><span class="cx">     void didDestroyGLContext();
</span><span class="cx">     void willRenderFrame();
</span><span class="cx">     void didRenderFrame();
</span><del>-    void requestDisplayRefreshMonitorUpdate();
-    void handleDisplayRefreshMonitorUpdate(bool);
</del><span class="cx"> 
</span><span class="cx">     enum class DiscardableSyncActions {
</span><span class="cx">         UpdateSize = 1 << 1,
</span></span></pre>
</div>
</div>

</body>
</html>