Title: [215088] trunk/Source
Revision
215088
Author
carlo...@webkit.org
Date
2017-04-07 03:43:43 -0700 (Fri, 07 Apr 2017)

Log Message

[GTK] Update the priorities used in glib main loop sources
https://bugs.webkit.org/show_bug.cgi?id=170457

Reviewed by Žan Doberšek.

Source/_javascript_Core:

* 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):

Modified Paths

Added Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (215087 => 215088)


--- trunk/Source/_javascript_Core/ChangeLog	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-04-07 10:43:43 UTC (rev 215088)
@@ -1,3 +1,13 @@
+2017-04-07  Carlos Garcia Campos  <cgar...@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  <fpi...@apple.com>
 
         Rename allocateStack to allocateStackByGraphColoring.

Modified: trunk/Source/_javascript_Core/runtime/JSRunLoopTimer.cpp (215087 => 215088)


--- trunk/Source/_javascript_Core/runtime/JSRunLoopTimer.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/_javascript_Core/runtime/JSRunLoopTimer.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -37,6 +37,7 @@
 
 #if USE(GLIB)
 #include <glib.h>
+#include <wtf/glib/RunLoopSourcePriority.h>
 #endif
 
 namespace JSC {
@@ -133,6 +134,7 @@
     , m_apiLock(&vm->apiLock())
     , m_timer(adoptGRef(g_source_new(&JSRunLoopTimerSourceFunctions, sizeof(GSource))))
 {
+    g_source_set_priority(m_timer.get(), RunLoopSourcePriority::_javascript_Timer);
     g_source_set_name(m_timer.get(), "[_javascript_Core] JSRunLoopTimer");
     g_source_set_callback(m_timer.get(), [](gpointer userData) -> gboolean {
         auto& runLoopTimer = *static_cast<JSRunLoopTimer*>(userData);

Modified: trunk/Source/WTF/ChangeLog (215087 => 215088)


--- trunk/Source/WTF/ChangeLog	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WTF/ChangeLog	2017-04-07 10:43:43 UTC (rev 215088)
@@ -1,3 +1,25 @@
+2017-04-07  Carlos Garcia Campos  <cgar...@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  <fpi...@apple.com>
 
         Linear scan should run liveness only once

Modified: trunk/Source/WTF/wtf/glib/MainThreadGLib.cpp (215087 => 215088)


--- trunk/Source/WTF/wtf/glib/MainThreadGLib.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WTF/wtf/glib/MainThreadGLib.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -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 @@
     MainThreadDispatcher()
         : m_timer(RunLoop::main(), this, &MainThreadDispatcher::fired)
     {
-        m_timer.setPriority(G_PRIORITY_HIGH_IDLE + 20);
+        m_timer.setPriority(RunLoopSourcePriority::MainThreadDispatcherTimer);
     }
 
     void schedule()

Modified: trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp (215087 => 215088)


--- trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -29,6 +29,7 @@
 
 #include <glib.h>
 #include <wtf/MainThread.h>
+#include <wtf/glib/RunLoopSourcePriority.h>
 
 namespace WTF {
 
@@ -60,6 +61,7 @@
     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 @@
 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 @@
     : 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);

Added: trunk/Source/WTF/wtf/glib/RunLoopSourcePriority.h (0 => 215088)


--- trunk/Source/WTF/wtf/glib/RunLoopSourcePriority.h	                        (rev 0)
+++ trunk/Source/WTF/wtf/glib/RunLoopSourcePriority.h	2017-04-07 10:43:43 UTC (rev 215088)
@@ -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.
+    _javascript_Timer = 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)

Modified: trunk/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp (215087 => 215088)


--- trunk/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -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 @@
 {
 #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");

Modified: trunk/Source/WebCore/ChangeLog (215087 => 215088)


--- trunk/Source/WebCore/ChangeLog	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WebCore/ChangeLog	2017-04-07 10:43:43 UTC (rev 215088)
@@ -1,3 +1,16 @@
+2017-04-07  Carlos Garcia Campos  <cgar...@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  <zdober...@igalia.com>
 
         [GCrypt] Implement AES_CBC support

Modified: trunk/Source/WebCore/platform/glib/MainThreadSharedTimerGLib.cpp (215087 => 215088)


--- trunk/Source/WebCore/platform/glib/MainThreadSharedTimerGLib.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WebCore/platform/glib/MainThreadSharedTimerGLib.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -28,7 +28,7 @@
 #include "config.h"
 #include "MainThreadSharedTimer.h"
 
-#include <glib.h>
+#include <wtf/glib/RunLoopSourcePriority.h>
 
 namespace WebCore {
 
@@ -35,8 +35,7 @@
 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)

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp (215087 => 215088)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -33,6 +33,10 @@
 #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 @@
     , 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 @@
         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()

Modified: trunk/Source/WebKit2/ChangeLog (215087 => 215088)


--- trunk/Source/WebKit2/ChangeLog	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WebKit2/ChangeLog	2017-04-07 10:43:43 UTC (rev 215088)
@@ -1,3 +1,27 @@
+2017-04-07  Carlos Garcia Campos  <cgar...@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  <achristen...@webkit.org>
 
         Add WKContentExtensionStore.h and WKContentExtension.h to public WebKit.h

Modified: trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp (215087 => 215088)


--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -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 @@
     , m_updateFunction(WTFMove(updateFunction))
 {
 #if USE(GLIB_EVENT_LOOP)
-    m_updateTimer.setPriority(G_PRIORITY_HIGH_IDLE);
+    m_updateTimer.setPriority(RunLoopSourcePriority::CompositingThreadUpdateTimer);
 #endif
 }
 

Modified: trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp (215087 => 215088)


--- trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -40,6 +40,10 @@
 #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 @@
     : 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 @@
     : 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()

Modified: trunk/Source/WebKit2/UIProcess/gtk/WaylandCompositor.cpp (215087 => 215088)


--- trunk/Source/WebKit2/UIProcess/gtk/WaylandCompositor.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WebKit2/UIProcess/gtk/WaylandCompositor.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -417,7 +417,6 @@
 {
     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;

Modified: trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp (215087 => 215088)


--- trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -38,6 +38,10 @@
 #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 @@
     , 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();
 }

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp (215087 => 215088)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -39,6 +39,10 @@
 #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 @@
 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()

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h (215087 => 215088)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h	2017-04-07 10:43:43 UTC (rev 215088)
@@ -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 @@
     bool m_didInitializeRootCompositingLayer { false };
 
     WebCore::FloatRect m_visibleContentsRect;
-    WebCore::Timer m_releaseInactiveAtlasesTimer;
+    RunLoop::Timer<CompositingCoordinator> m_releaseInactiveAtlasesTimer;
 
     double m_lastAnimationServiceTime { 0 };
 };

Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (215087 => 215088)


--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -42,6 +42,10 @@
 #include "ThreadSafeCoordinatedSurface.h"
 #endif
 
+#if USE(GLIB_EVENT_LOOP)
+#include <wtf/glib/RunLoopSourcePriority.h>
+#endif
+
 using namespace WebCore;
 
 namespace WebKit {
@@ -60,6 +64,9 @@
     , 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);

Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp (215087 => 215088)


--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp	2017-04-07 07:37:36 UTC (rev 215087)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp	2017-04-07 10:43:43 UTC (rev 215088)
@@ -37,6 +37,10 @@
 #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 @@
     : AcceleratedDrawingArea(webPage, parameters)
     , m_displayTimer(RunLoop::main(), this, &DrawingAreaImpl::displayTimerFired)
 {
+#if USE(GLIB_EVENT_LOOP)
+    m_displayTimer.setPriority(RunLoopSourcePriority::NonAcceleratedDrawingTimer);
+#endif
 }
 
 void DrawingAreaImpl::setNeedsDisplay()
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to