[CoordinatedGraphics] The compositing loop is still running even after exiting AC...
[WebKit-https.git] / Source / WebKit / Shared / CoordinatedGraphics / threadedcompositor / ThreadedCompositor.cpp
index c1e6b7b..fd4aaf5 100644 (file)
@@ -116,6 +116,28 @@ void ThreadedCompositor::invalidate()
     m_compositingRunLoop = nullptr;
 }
 
+void ThreadedCompositor::suspend()
+{
+    if (++m_suspendedCount > 1)
+        return;
+
+    m_compositingRunLoop->stopUpdates();
+    m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
+        m_scene->setActive(false);
+    });
+}
+
+void ThreadedCompositor::resume()
+{
+    ASSERT(m_suspendedCount > 0);
+    if (--m_suspendedCount > 0)
+        return;
+
+    m_compositingRunLoop->performTaskSync([this, protectedThis = makeRef(*this)] {
+        m_scene->setActive(true);
+    });
+}
+
 void ThreadedCompositor::setNativeSurfaceHandleForCompositing(uint64_t handle)
 {
     m_compositingRunLoop->stopUpdates();