[GTK] Update the priorities used in glib main loop sources
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Apr 2017 10:43:43 +0000 (10:43 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 7 Apr 2017 10:43:43 +0000 (10:43 +0000)
https://bugs.webkit.org/show_bug.cgi?id=170457

Reviewed by Žan Doberšek.

Source/JavaScriptCore:

* runtime/JSRunLoopTimer.cpp:
(JSC::JSRunLoopTimer::JSRunLoopTimer):

Source/WebCore:

* platform/glib/MainThreadSharedTimerGLib.cpp:
(WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
* platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
(WebCore::TextureMapperPlatformLayerProxy::TextureMapperPlatformLayerProxy):
(WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):

Source/WebKit2:

* Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
(WebKit::CompositingRunLoop::CompositingRunLoop):
* UIProcess/DrawingAreaProxyImpl.cpp:
(WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
(WebKit::DrawingAreaProxyImpl::DrawingMonitor::DrawingMonitor):
* UIProcess/gtk/WaylandCompositor.cpp:
(WebKit::createWaylandLoopSource):
* WebProcess/WebPage/AcceleratedDrawingArea.cpp:
(WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
(WebKit::CompositingCoordinator::CompositingCoordinator):
* WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
(WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::DrawingAreaImpl):

Source/WTF:

Add an enum to define prirorities used in different GLib main sources. It allows to give them a better name
than high, low, medium, etc., but also to document them and other GLib based ports can define their own
values without changing all the places where they are used. The default values are based on the priorities
pre-defined by GLib.

* wtf/glib/MainThreadGLib.cpp:
(WTF::MainThreadDispatcher::MainThreadDispatcher):
* wtf/glib/RunLoopGLib.cpp:
(WTF::RunLoop::RunLoop):
(WTF::RunLoop::dispatchAfter):
(WTF::RunLoop::TimerBase::TimerBase):
* wtf/glib/RunLoopSourcePriority.h: Added.
* wtf/linux/MemoryPressureHandlerLinux.cpp:
(WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@215088 268f45cc-cd09-0410-ab3c-d52691b4dbfc

19 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/JSRunLoopTimer.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/glib/MainThreadGLib.cpp
Source/WTF/wtf/glib/RunLoopGLib.cpp
Source/WTF/wtf/glib/RunLoopSourcePriority.h [new file with mode: 0644]
Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp
Source/WebCore/ChangeLog
Source/WebCore/platform/glib/MainThreadSharedTimerGLib.cpp
Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp
Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp
Source/WebKit2/UIProcess/gtk/WaylandCompositor.cpp
Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h
Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp

index 1e71956..646d551 100644 (file)
@@ -1,3 +1,13 @@
+2017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Update the priorities used in glib main loop sources
+        https://bugs.webkit.org/show_bug.cgi?id=170457
+
+        Reviewed by Žan Doberšek.
+
+        * runtime/JSRunLoopTimer.cpp:
+        (JSC::JSRunLoopTimer::JSRunLoopTimer):
+
 2017-04-06  Filip Pizlo  <fpizlo@apple.com>
 
         Rename allocateStack to allocateStackByGraphColoring.
index ad3f9f8..d86b3ce 100644 (file)
@@ -37,6 +37,7 @@
 
 #if USE(GLIB)
 #include <glib.h>
+#include <wtf/glib/RunLoopSourcePriority.h>
 #endif
 
 namespace JSC {
@@ -133,6 +134,7 @@ JSRunLoopTimer::JSRunLoopTimer(VM* vm)
     , m_apiLock(&vm->apiLock())
     , m_timer(adoptGRef(g_source_new(&JSRunLoopTimerSourceFunctions, sizeof(GSource))))
 {
+    g_source_set_priority(m_timer.get(), RunLoopSourcePriority::JavascriptTimer);
     g_source_set_name(m_timer.get(), "[JavaScriptCore] JSRunLoopTimer");
     g_source_set_callback(m_timer.get(), [](gpointer userData) -> gboolean {
         auto& runLoopTimer = *static_cast<JSRunLoopTimer*>(userData);
index e2bb2db..5c0bb50 100644 (file)
@@ -1,3 +1,25 @@
+2017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Update the priorities used in glib main loop sources
+        https://bugs.webkit.org/show_bug.cgi?id=170457
+
+        Reviewed by Žan Doberšek.
+
+        Add an enum to define prirorities used in different GLib main sources. It allows to give them a better name
+        than high, low, medium, etc., but also to document them and other GLib based ports can define their own
+        values without changing all the places where they are used. The default values are based on the priorities
+        pre-defined by GLib.
+
+        * wtf/glib/MainThreadGLib.cpp:
+        (WTF::MainThreadDispatcher::MainThreadDispatcher):
+        * wtf/glib/RunLoopGLib.cpp:
+        (WTF::RunLoop::RunLoop):
+        (WTF::RunLoop::dispatchAfter):
+        (WTF::RunLoop::TimerBase::TimerBase):
+        * wtf/glib/RunLoopSourcePriority.h: Added.
+        * wtf/linux/MemoryPressureHandlerLinux.cpp:
+        (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
+
 2017-04-06  Filip Pizlo  <fpizlo@apple.com>
 
         Linear scan should run liveness only once
index c2fa56f..2a239f7 100644 (file)
@@ -30,8 +30,8 @@
 #include "config.h"
 #include "MainThread.h"
 
-#include <glib.h>
 #include <wtf/RunLoop.h>
+#include <wtf/glib/RunLoopSourcePriority.h>
 
 static pthread_t mainThreadPthread;
 
@@ -42,7 +42,7 @@ public:
     MainThreadDispatcher()
         : m_timer(RunLoop::main(), this, &MainThreadDispatcher::fired)
     {
-        m_timer.setPriority(G_PRIORITY_HIGH_IDLE + 20);
+        m_timer.setPriority(RunLoopSourcePriority::MainThreadDispatcherTimer);
     }
 
     void schedule()
index 258741f..6597ff0 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <glib.h>
 #include <wtf/MainThread.h>
+#include <wtf/glib/RunLoopSourcePriority.h>
 
 namespace WTF {
 
@@ -60,6 +61,7 @@ RunLoop::RunLoop()
     m_mainLoops.append(innermostLoop);
 
     m_source = adoptGRef(g_source_new(&runLoopSourceFunctions, sizeof(GSource)));
+    g_source_set_priority(m_source.get(), RunLoopSourcePriority::RunLoopDispatcher);
     g_source_set_name(m_source.get(), "[WebKit] RunLoop work");
     g_source_set_can_recurse(m_source.get(), TRUE);
     g_source_set_callback(m_source.get(), [](gpointer userData) -> gboolean {
@@ -141,6 +143,7 @@ private:
 void RunLoop::dispatchAfter(Seconds duration, Function<void()>&& function)
 {
     GRefPtr<GSource> source = adoptGRef(g_timeout_source_new(duration.millisecondsAs<guint>()));
+    g_source_set_priority(source.get(), RunLoopSourcePriority::RunLoopTimer);
     g_source_set_name(source.get(), "[WebKit] RunLoop dispatchAfter");
 
     std::unique_ptr<DispatchAfterContext> context = std::make_unique<DispatchAfterContext>(WTFMove(function));
@@ -156,6 +159,7 @@ RunLoop::TimerBase::TimerBase(RunLoop& runLoop)
     : m_runLoop(runLoop)
     , m_source(adoptGRef(g_source_new(&runLoopSourceFunctions, sizeof(GSource))))
 {
+    g_source_set_priority(m_source.get(), RunLoopSourcePriority::RunLoopTimer);
     g_source_set_name(m_source.get(), "[WebKit] RunLoop::Timer work");
     g_source_set_callback(m_source.get(), [](gpointer userData) -> gboolean {
         RunLoop::TimerBase* timer = static_cast<RunLoop::TimerBase*>(userData);
diff --git a/Source/WTF/wtf/glib/RunLoopSourcePriority.h b/Source/WTF/wtf/glib/RunLoopSourcePriority.h
new file mode 100644 (file)
index 0000000..498dd6b
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2017 Igalia, S.L.
+ *
+ *  This library is free software; you can redistribute it and/or
+ *  modify it under the terms of the GNU Library General Public
+ *  License as published by the Free Software Foundation; either
+ *  version 2 of the License, or (at your option) any later version.
+ *
+ *  This library is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *  Library General Public License for more details.
+ *
+ *  You should have received a copy of the GNU Library General Public License
+ *  along with this library; see the file COPYING.LIB.  If not, write to
+ *  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ *  Boston, MA 02110-1301, USA.
+ */
+
+#pragma once
+
+#if USE(GLIB)
+
+namespace WTF {
+
+// This is a global enum to define priorities used by GLib run loop sources.
+// In GLib, priorities are represented by an integer where lower values mean
+// higher priority. The following macros are defined in GLib:
+// G_PRIORITY_LOW = 300
+// G_PRIORITY_DEFAULT_IDLE = 200
+// G_PRIORITY_HIGH_IDLE = 100
+// G_PRIORITY_DEFAULT = 0
+// G_PRIORITY_HIGH = -100
+// We don't use those macros here to avoid having to include glib header only
+// for this. But we should take into account that GLib uses G_PRIORITY_DEFAULT
+// for timeout sourcea and G_PRIORITY_DEFAULT_IDLE for idle sources.
+// Changes in these priorities can have a huge impact in performance, and in
+// the correctness too, so be careful when changing them.
+enum RunLoopSourcePriority {
+    // RunLoop::dispatch().
+    RunLoopDispatcher = 100,
+
+    // RunLoopTimer priority by default. It can be changed with RunLoopTimer::setPriority().
+    RunLoopTimer = 0,
+
+    // Garbage collector timers.
+    JavascriptTimer = 200,
+
+    // callOnMainThread.
+    MainThreadDispatcherTimer = 100,
+
+    // Memory pressure monitor.
+    MemoryPressureHandlerTimer = -100,
+
+    // WebCore timers.
+    MainThreadSharedTimer = 100,
+
+    // Used for timers that discard resources like backing store, buffers, etc.
+    ReleaseUnusedResourcesTimer = 200,
+
+    // Rendering timer in the threaded compositor.
+    CompositingThreadUpdateTimer = 110,
+
+    // Layer flush.
+    LayerFlushTimer = -100,
+
+    // Rendering timer in the main thread when accelerated compositing is not used.
+    NonAcceleratedDrawingTimer = 100
+};
+
+} // namespace WTF
+
+using WTF::RunLoopSourcePriority;
+
+#endif // USE(GLIB)
index d1fe252..b294194 100644 (file)
@@ -43,6 +43,7 @@
 
 #if USE(GLIB)
 #include <glib-unix.h>
+#include <wtf/glib/RunLoopSourcePriority.h>
 #endif
 
 #define LOG_CHANNEL_PREFIX Log
@@ -103,6 +104,7 @@ MemoryPressureHandler::EventFDPoller::EventFDPoller(int fd, std::function<void (
 {
 #if USE(GLIB)
     m_source = adoptGRef(g_source_new(&eventFDSourceFunctions, sizeof(EventFDSource)));
+    g_source_set_priority(m_source.get(), RunLoopSourcePriority::MemoryPressureHandlerTimer);
     g_source_set_name(m_source.get(), "WTF: MemoryPressureHandler");
     if (!g_unix_set_fd_nonblocking(m_fd.value(), TRUE, nullptr)) {
         LOG(MemoryPressure, "Failed to set eventfd nonblocking");
index 5f0585d..873d379 100644 (file)
@@ -1,3 +1,16 @@
+2017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Update the priorities used in glib main loop sources
+        https://bugs.webkit.org/show_bug.cgi?id=170457
+
+        Reviewed by Žan Doberšek.
+
+        * platform/glib/MainThreadSharedTimerGLib.cpp:
+        (WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
+        * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
+        (WebCore::TextureMapperPlatformLayerProxy::TextureMapperPlatformLayerProxy):
+        (WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):
+
 2017-04-07  Zan Dobersek  <zdobersek@igalia.com>
 
         [GCrypt] Implement AES_CBC support
index 284f8b1..4afe29d 100644 (file)
 #include "config.h"
 #include "MainThreadSharedTimer.h"
 
-#include <glib.h>
+#include <wtf/glib/RunLoopSourcePriority.h>
 
 namespace WebCore {
 
 MainThreadSharedTimer::MainThreadSharedTimer()
     : m_timer(RunLoop::main(), this, &MainThreadSharedTimer::fired)
 {
-    // This is GDK_PRIORITY_REDRAW, but we don't want to depend on GDK here just to use a constant.
-    m_timer.setPriority(G_PRIORITY_HIGH_IDLE + 20);
+    m_timer.setPriority(RunLoopSourcePriority::MainThreadDispatcherTimer);
 }
 
 void MainThreadSharedTimer::setFireInterval(Seconds interval)
index a3ea247..af6bd73 100644 (file)
 #include "TextureMapperLayer.h"
 #include "TextureMapperPlatformLayerBuffer.h"
 
+#if USE(GLIB_EVENT_LOOP)
+#include <wtf/glib/RunLoopSourcePriority.h>
+#endif
+
 const double s_releaseUnusedSecondsTolerance = 1;
 const double s_releaseUnusedBuffersTimerInterval = 0.5;
 
@@ -43,6 +47,9 @@ TextureMapperPlatformLayerProxy::TextureMapperPlatformLayerProxy()
     , m_targetLayer(nullptr)
     , m_releaseUnusedBuffersTimer(RunLoop::current(), this, &TextureMapperPlatformLayerProxy::releaseUnusedBuffersTimerFired)
 {
+#if USE(GLIB_EVENT_LOOP)
+    m_releaseUnusedBuffersTimer.setPriority(RunLoopSourcePriority::ReleaseUnusedResourcesTimer);
+#endif
 }
 
 TextureMapperPlatformLayerProxy::~TextureMapperPlatformLayerProxy()
@@ -67,6 +74,9 @@ void TextureMapperPlatformLayerProxy::activateOnCompositingThread(Compositor* co
         m_targetLayer->setContentsLayer(m_currentBuffer.get());
 
     m_compositorThreadUpdateTimer = std::make_unique<RunLoop::Timer<TextureMapperPlatformLayerProxy>>(RunLoop::current(), this, &TextureMapperPlatformLayerProxy::compositorThreadUpdateTimerFired);
+#if USE(GLIB_EVENT_LOOP)
+    m_compositorThreadUpdateTimer->setPriority(RunLoopSourcePriority::CompositingThreadUpdateTimer);
+#endif
 }
 
 void TextureMapperPlatformLayerProxy::invalidate()
index 84dfe24..a52cd7a 100644 (file)
@@ -1,3 +1,27 @@
+2017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [GTK] Update the priorities used in glib main loop sources
+        https://bugs.webkit.org/show_bug.cgi?id=170457
+
+        Reviewed by Žan Doberšek.
+
+        * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
+        (WebKit::CompositingRunLoop::CompositingRunLoop):
+        * UIProcess/DrawingAreaProxyImpl.cpp:
+        (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
+        (WebKit::DrawingAreaProxyImpl::DrawingMonitor::DrawingMonitor):
+        * UIProcess/gtk/WaylandCompositor.cpp:
+        (WebKit::createWaylandLoopSource):
+        * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
+        (WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
+        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
+        (WebKit::CompositingCoordinator::CompositingCoordinator):
+        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
+        (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::DrawingAreaImpl):
+
 2017-04-06  Alex Christensen  <achristensen@webkit.org>
 
         Add WKContentExtensionStore.h and WKContentExtension.h to public WebKit.h
index a6eee3f..aadd6ab 100644 (file)
@@ -34,7 +34,7 @@
 #include <wtf/WorkQueue.h>
 
 #if USE(GLIB_EVENT_LOOP)
-#include <glib.h>
+#include <wtf/glib/RunLoopSourcePriority.h>
 #endif
 
 namespace WebKit {
@@ -113,7 +113,7 @@ CompositingRunLoop::CompositingRunLoop(std::function<void ()>&& updateFunction)
     , m_updateFunction(WTFMove(updateFunction))
 {
 #if USE(GLIB_EVENT_LOOP)
-    m_updateTimer.setPriority(G_PRIORITY_HIGH_IDLE);
+    m_updateTimer.setPriority(RunLoopSourcePriority::CompositingThreadUpdateTimer);
 #endif
 }
 
index 1445354..9d28643 100644 (file)
 #include <gtk/gtk.h>
 #endif
 
+#if USE(GLIB_EVENT_LOOP)
+#include <wtf/glib/RunLoopSourcePriority.h>
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -48,6 +52,9 @@ DrawingAreaProxyImpl::DrawingAreaProxyImpl(WebPageProxy& webPageProxy)
     : AcceleratedDrawingAreaProxy(webPageProxy)
     , m_discardBackingStoreTimer(RunLoop::current(), this, &DrawingAreaProxyImpl::discardBackingStore)
 {
+#if USE(GLIB_EVENT_LOOP)
+    m_discardBackingStoreTimer.setPriority(RunLoopSourcePriority::ReleaseUnusedResourcesTimer);
+#endif
 }
 
 DrawingAreaProxyImpl::~DrawingAreaProxyImpl()
@@ -197,6 +204,10 @@ DrawingAreaProxyImpl::DrawingMonitor::DrawingMonitor(WebPageProxy& webPage)
     : m_webPage(webPage)
     , m_timer(RunLoop::main(), this, &DrawingMonitor::stop)
 {
+#if USE(GLIB_EVENT_LOOP)
+    // Give redraws more priority.
+    m_timer.setPriority(GDK_PRIORITY_REDRAW - 10);
+#endif
 }
 
 DrawingAreaProxyImpl::DrawingMonitor::~DrawingMonitor()
index 99e1588..f03fd08 100644 (file)
@@ -417,7 +417,6 @@ static GRefPtr<GSource> createWaylandLoopSource(struct wl_display* display)
 {
     GRefPtr<GSource> source = adoptGRef(g_source_new(&waylandLoopSourceFunctions, sizeof(WaylandLoopSource)));
     g_source_set_name(source.get(), "Nested Wayland compositor display event source");
-    g_source_set_priority(source.get(), G_PRIORITY_DEFAULT + 1);
 
     auto* wlLoopSource = reinterpret_cast<WaylandLoopSource*>(source.get());
     wlLoopSource->display = display;
index a249fed..6874d1d 100644 (file)
 #include <WebCore/PageOverlayController.h>
 #include <WebCore/Settings.h>
 
+#if USE(GLIB_EVENT_LOOP)
+#include <wtf/glib/RunLoopSourcePriority.h>
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -54,6 +58,9 @@ AcceleratedDrawingArea::AcceleratedDrawingArea(WebPage& webPage, const WebPageCr
     , m_exitCompositingTimer(RunLoop::main(), this, &AcceleratedDrawingArea::exitAcceleratedCompositingMode)
     , m_discardPreviousLayerTreeHostTimer(RunLoop::main(), this, &AcceleratedDrawingArea::discardPreviousLayerTreeHost)
 {
+#if USE(GLIB_EVENT_LOOP)
+    m_discardPreviousLayerTreeHostTimer.setPriority(RunLoopSourcePriority::ReleaseUnusedResourcesTimer);
+#endif
     if (!m_webPage.isVisible())
         suspendPainting();
 }
index c308297..912f15c 100644 (file)
 #include <wtf/MemoryPressureHandler.h>
 #include <wtf/SetForScope.h>
 
+#if USE(GLIB_EVENT_LOOP)
+#include <wtf/glib/RunLoopSourcePriority.h>
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -46,8 +50,11 @@ namespace WebKit {
 CompositingCoordinator::CompositingCoordinator(Page* page, CompositingCoordinator::Client& client)
     : m_page(page)
     , m_client(client)
-    , m_releaseInactiveAtlasesTimer(*this, &CompositingCoordinator::releaseInactiveAtlasesTimerFired)
+    , m_releaseInactiveAtlasesTimer(RunLoop::main(), this, &CompositingCoordinator::releaseInactiveAtlasesTimerFired)
 {
+#if USE(GLIB_EVENT_LOOP)
+    m_releaseInactiveAtlasesTimer.setPriority(RunLoopSourcePriority::ReleaseUnusedResourcesTimer);
+#endif
 }
 
 CompositingCoordinator::~CompositingCoordinator()
index eb214cf..d60ca6d 100644 (file)
@@ -37,7 +37,6 @@
 #include <WebCore/GraphicsLayerClient.h>
 #include <WebCore/GraphicsLayerFactory.h>
 #include <WebCore/IntRect.h>
-#include <WebCore/Timer.h>
 
 namespace WebCore {
 class Page;
@@ -158,7 +157,7 @@ private:
     bool m_didInitializeRootCompositingLayer { false };
 
     WebCore::FloatRect m_visibleContentsRect;
-    WebCore::Timer m_releaseInactiveAtlasesTimer;
+    RunLoop::Timer<CompositingCoordinator> m_releaseInactiveAtlasesTimer;
 
     double m_lastAnimationServiceTime { 0 };
 };
index b740705..2f66137 100644 (file)
 #include "ThreadSafeCoordinatedSurface.h"
 #endif
 
+#if USE(GLIB_EVENT_LOOP)
+#include <wtf/glib/RunLoopSourcePriority.h>
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -60,6 +64,9 @@ CoordinatedLayerTreeHost::CoordinatedLayerTreeHost(WebPage& webPage)
     , m_coordinator(webPage.corePage(), *this)
     , m_layerFlushTimer(RunLoop::main(), this, &CoordinatedLayerTreeHost::layerFlushTimerFired)
 {
+#if USE(GLIB_EVENT_LOOP)
+    m_layerFlushTimer.setPriority(RunLoopSourcePriority::LayerFlushTimer);
+#endif
     m_coordinator.createRootLayer(m_webPage.size());
 
     CoordinatedSurface::setFactory(createCoordinatedSurface);
index 2b88fd7..eab036f 100644 (file)
 #include <WebCore/Page.h>
 #include <WebCore/Settings.h>
 
+#if USE(GLIB_EVENT_LOOP)
+#include <wtf/glib/RunLoopSourcePriority.h>
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -49,6 +53,9 @@ DrawingAreaImpl::DrawingAreaImpl(WebPage& webPage, const WebPageCreationParamete
     : AcceleratedDrawingArea(webPage, parameters)
     , m_displayTimer(RunLoop::main(), this, &DrawingAreaImpl::displayTimerFired)
 {
+#if USE(GLIB_EVENT_LOOP)
+    m_displayTimer.setPriority(RunLoopSourcePriority::NonAcceleratedDrawingTimer);
+#endif
 }
 
 void DrawingAreaImpl::setNeedsDisplay()