Title: [229795] trunk/Source/WebKit
Revision
229795
Author
[email protected]
Date
2018-03-21 00:16:46 -0700 (Wed, 21 Mar 2018)

Log Message

[CoordGraphics] Simplify CoordinatedGraphicsScene activation
https://bugs.webkit.org/show_bug.cgi?id=183772

Reviewed by Carlos Garcia Campos.

Simplify CoordinatedGraphicsScene::setActive() into a simple setter of
the m_isActive member variable. We don't have to call renderNextFrame()
anymore as that was only necessary to unblock CoordinatedLayerTreeHost,
but that can be avoided if m_isWaitingForRenderer in that class is
initialized to false.

CoordinatedGraphicsSceneClient::renderNextFrame() virtual method and its
ThreadedCompositor implementation are removed. renderNextFrame() in the
CoordinatedGraphicsScene class can also be removed, along with the
unused dispatchOnMainThread() and dispatchOnClientRunLoop() methods and
the associated m_clientRunLoop member variable.

* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
(WebKit::CoordinatedGraphicsScene::CoordinatedGraphicsScene):
(WebKit::CoordinatedGraphicsScene::dispatchOnMainThread): Deleted.
(WebKit::CoordinatedGraphicsScene::dispatchOnClientRunLoop): Deleted.
(WebKit::CoordinatedGraphicsScene::renderNextFrame): Deleted.
(WebKit::CoordinatedGraphicsScene::setActive): Deleted.
* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
(WebKit::CoordinatedGraphicsSceneClient::~CoordinatedGraphicsSceneClient):
(WebKit::CoordinatedGraphicsScene::setActive):
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
(WebKit::m_displayRefreshMonitor):
(WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
(WebKit::ThreadedCompositor::renderNextFrame): Deleted.
* Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (229794 => 229795)


--- trunk/Source/WebKit/ChangeLog	2018-03-21 07:16:07 UTC (rev 229794)
+++ trunk/Source/WebKit/ChangeLog	2018-03-21 07:16:46 UTC (rev 229795)
@@ -1,5 +1,40 @@
 2018-03-21  Zan Dobersek  <[email protected]>
 
+        [CoordGraphics] Simplify CoordinatedGraphicsScene activation
+        https://bugs.webkit.org/show_bug.cgi?id=183772
+
+        Reviewed by Carlos Garcia Campos.
+
+        Simplify CoordinatedGraphicsScene::setActive() into a simple setter of
+        the m_isActive member variable. We don't have to call renderNextFrame()
+        anymore as that was only necessary to unblock CoordinatedLayerTreeHost,
+        but that can be avoided if m_isWaitingForRenderer in that class is
+        initialized to false.
+
+        CoordinatedGraphicsSceneClient::renderNextFrame() virtual method and its
+        ThreadedCompositor implementation are removed. renderNextFrame() in the
+        CoordinatedGraphicsScene class can also be removed, along with the
+        unused dispatchOnMainThread() and dispatchOnClientRunLoop() methods and
+        the associated m_clientRunLoop member variable.
+
+        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
+        (WebKit::CoordinatedGraphicsScene::CoordinatedGraphicsScene):
+        (WebKit::CoordinatedGraphicsScene::dispatchOnMainThread): Deleted.
+        (WebKit::CoordinatedGraphicsScene::dispatchOnClientRunLoop): Deleted.
+        (WebKit::CoordinatedGraphicsScene::renderNextFrame): Deleted.
+        (WebKit::CoordinatedGraphicsScene::setActive): Deleted.
+        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h:
+        (WebKit::CoordinatedGraphicsSceneClient::~CoordinatedGraphicsSceneClient):
+        (WebKit::CoordinatedGraphicsScene::setActive):
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp:
+        (WebKit::m_displayRefreshMonitor):
+        (WebKit::ThreadedCompositor::setNativeSurfaceHandleForCompositing):
+        (WebKit::ThreadedCompositor::renderNextFrame): Deleted.
+        * Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h:
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
+
+2018-03-21  Zan Dobersek  <[email protected]>
+
         [TexMap] Have TextureMapperLayer::applyAnimationsRecursively() return running animation status
         https://bugs.webkit.org/show_bug.cgi?id=183771
 

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp (229794 => 229795)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp	2018-03-21 07:16:07 UTC (rev 229794)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp	2018-03-21 07:16:46 UTC (rev 229795)
@@ -35,30 +35,6 @@
 namespace WebKit {
 using namespace WebCore;
 
-void CoordinatedGraphicsScene::dispatchOnMainThread(Function<void()>&& function)
-{
-    if (RunLoop::isMain()) {
-        function();
-        return;
-    }
-
-    RunLoop::main().dispatch([protectedThis = makeRef(*this), function = WTFMove(function)] {
-        function();
-    });
-}
-
-void CoordinatedGraphicsScene::dispatchOnClientRunLoop(Function<void()>&& function)
-{
-    if (&m_clientRunLoop == &RunLoop::current()) {
-        function();
-        return;
-    }
-
-    m_clientRunLoop.dispatch([protectedThis = makeRef(*this), function = WTFMove(function)] {
-        function();
-    });
-}
-
 static bool layerShouldHaveBackingStore(TextureMapperLayer* layer)
 {
     return layer->drawsContent() && layer->contentsAreVisible() && !layer->size().isEmpty();
@@ -69,7 +45,6 @@
     , m_isActive(false)
     , m_rootLayerID(InvalidCoordinatedLayerID)
     , m_viewBackgroundColor(Color::white)
-    , m_clientRunLoop(RunLoop::current())
 {
 }
 
@@ -542,16 +517,6 @@
         backingStore->commitTileOperations(*m_textureMapper);
 }
 
-void CoordinatedGraphicsScene::renderNextFrame()
-{
-    if (!m_client)
-        return;
-    dispatchOnMainThread([this] {
-        if (m_client)
-            m_client->renderNextFrame();
-    });
-}
-
 void CoordinatedGraphicsScene::ensureRootLayer()
 {
     if (m_rootLayer)
@@ -604,16 +569,6 @@
     m_client = nullptr;
 }
 
-void CoordinatedGraphicsScene::setActive(bool active)
-{
-    if (!m_client || m_isActive == active)
-        return;
-
-    m_isActive = active;
-    if (m_isActive)
-        renderNextFrame();
-}
-
 } // namespace WebKit
 
 #endif // USE(COORDINATED_GRAPHICS)

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h (229794 => 229795)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h	2018-03-21 07:16:07 UTC (rev 229794)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h	2018-03-21 07:16:46 UTC (rev 229795)
@@ -59,7 +59,6 @@
 class CoordinatedGraphicsSceneClient {
 public:
     virtual ~CoordinatedGraphicsSceneClient() { }
-    virtual void renderNextFrame() = 0;
     virtual void updateViewport() = 0;
 };
 
@@ -81,10 +80,9 @@
     void purgeGLResources();
 
     bool isActive() const { return m_isActive; }
-    void setActive(bool);
+    void setActive(bool active) { m_isActive = active; }
 
     void commitSceneState(const WebCore::CoordinatedGraphicsState&);
-    void renderNextFrame();
 
     void setViewBackgroundColor(const WebCore::Color& color) { m_viewBackgroundColor = color; }
     WebCore::Color viewBackgroundColor() const { return m_viewBackgroundColor; }
@@ -135,8 +133,6 @@
 
     void adjustPositionForFixedLayers(const WebCore::FloatPoint& contentPosition);
 
-    void dispatchOnMainThread(Function<void()>&&);
-    void dispatchOnClientRunLoop(Function<void()>&&);
     void updateViewport();
 
     void createLayer(WebCore::CoordinatedLayerID);
@@ -180,8 +176,6 @@
     WebCore::Color m_viewBackgroundColor;
 
     WebCore::TextureMapperFPSCounter m_fpsCounter;
-
-    RunLoop& m_clientRunLoop;
 };
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp (229794 => 229795)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2018-03-21 07:16:07 UTC (rev 229794)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp	2018-03-21 07:16:46 UTC (rev 229795)
@@ -70,11 +70,10 @@
     m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
         m_scene = adoptRef(new CoordinatedGraphicsScene(this));
         m_nativeSurfaceHandle = m_client.nativeSurfaceHandleForCompositing();
-        if (m_nativeSurfaceHandle) {
+
+        m_scene->setActive(!!m_nativeSurfaceHandle);
+        if (m_nativeSurfaceHandle)
             createGLContext();
-            m_scene->setActive(true);
-        } else
-            m_scene->setActive(false);
     });
 }
 
@@ -122,13 +121,12 @@
         // A new native handle can't be set without destroying the previous one first if any.
         ASSERT(!!handle ^ !!m_nativeSurfaceHandle);
         m_nativeSurfaceHandle = handle;
-        if (m_nativeSurfaceHandle) {
+
+        m_scene->setActive(!!m_nativeSurfaceHandle);
+        if (m_nativeSurfaceHandle)
             createGLContext();
-            m_scene->setActive(true);
-        } else {
-            m_scene->setActive(false);
+        else
             m_context = nullptr;
-        }
     });
 }
 
@@ -163,12 +161,6 @@
     m_compositingRunLoop->scheduleUpdate();
 }
 
-void ThreadedCompositor::renderNextFrame()
-{
-    ASSERT(RunLoop::isMain());
-    m_client.renderNextFrame();
-}
-
 void ThreadedCompositor::updateViewport()
 {
     m_compositingRunLoop->scheduleUpdate();

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h (229794 => 229795)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h	2018-03-21 07:16:07 UTC (rev 229794)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.h	2018-03-21 07:16:46 UTC (rev 229795)
@@ -94,7 +94,6 @@
     ThreadedCompositor(Client&, WebPage&, const WebCore::IntSize&, float scaleFactor, ShouldDoFrameSync, WebCore::TextureMapper::PaintFlags);
 
     // CoordinatedGraphicsSceneClient
-    void renderNextFrame() override;
     void updateViewport() override;
 
     void renderLayerTree();

Modified: trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (229794 => 229795)


--- trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h	2018-03-21 07:16:07 UTC (rev 229794)
+++ trunk/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h	2018-03-21 07:16:46 UTC (rev 229795)
@@ -78,7 +78,7 @@
     void layerFlushTimerFired();
 
     CompositingCoordinator m_coordinator;
-    bool m_isWaitingForRenderer { true };
+    bool m_isWaitingForRenderer { false };
     bool m_scheduledWhileWaitingForRenderer { false };
     struct {
         OptionalCallbackID callbackID;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to