Changeset 215088 in webkit


Ignore:
Timestamp:
Apr 7, 2017, 3:43:43 AM (9 years ago)
Author:
Carlos Garcia Campos
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/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):

Location:
trunk/Source
Files:
1 added
18 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r215073 r215088  
     12017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Update the priorities used in glib main loop sources
     4        https://bugs.webkit.org/show_bug.cgi?id=170457
     5
     6        Reviewed by Žan Doberšek.
     7
     8        * runtime/JSRunLoopTimer.cpp:
     9        (JSC::JSRunLoopTimer::JSRunLoopTimer):
     10
    1112017-04-06  Filip Pizlo  <fpizlo@apple.com>
    212
  • trunk/Source/JavaScriptCore/runtime/JSRunLoopTimer.cpp

    r214732 r215088  
    3838#if USE(GLIB)
    3939#include <glib.h>
     40#include <wtf/glib/RunLoopSourcePriority.h>
    4041#endif
    4142
     
    134135    , m_timer(adoptGRef(g_source_new(&JSRunLoopTimerSourceFunctions, sizeof(GSource))))
    135136{
     137    g_source_set_priority(m_timer.get(), RunLoopSourcePriority::JavascriptTimer);
    136138    g_source_set_name(m_timer.get(), "[JavaScriptCore] JSRunLoopTimer");
    137139    g_source_set_callback(m_timer.get(), [](gpointer userData) -> gboolean {
  • trunk/Source/WTF/ChangeLog

    r215071 r215088  
     12017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Update the priorities used in glib main loop sources
     4        https://bugs.webkit.org/show_bug.cgi?id=170457
     5
     6        Reviewed by Žan Doberšek.
     7
     8        Add an enum to define prirorities used in different GLib main sources. It allows to give them a better name
     9        than high, low, medium, etc., but also to document them and other GLib based ports can define their own
     10        values without changing all the places where they are used. The default values are based on the priorities
     11        pre-defined by GLib.
     12
     13        * wtf/glib/MainThreadGLib.cpp:
     14        (WTF::MainThreadDispatcher::MainThreadDispatcher):
     15        * wtf/glib/RunLoopGLib.cpp:
     16        (WTF::RunLoop::RunLoop):
     17        (WTF::RunLoop::dispatchAfter):
     18        (WTF::RunLoop::TimerBase::TimerBase):
     19        * wtf/glib/RunLoopSourcePriority.h: Added.
     20        * wtf/linux/MemoryPressureHandlerLinux.cpp:
     21        (WTF::MemoryPressureHandler::EventFDPoller::EventFDPoller):
     22
    1232017-04-06  Filip Pizlo  <fpizlo@apple.com>
    224
  • trunk/Source/WTF/wtf/glib/MainThreadGLib.cpp

    r212878 r215088  
    3131#include "MainThread.h"
    3232
    33 #include <glib.h>
    3433#include <wtf/RunLoop.h>
     34#include <wtf/glib/RunLoopSourcePriority.h>
    3535
    3636static pthread_t mainThreadPthread;
     
    4343        : m_timer(RunLoop::main(), this, &MainThreadDispatcher::fired)
    4444    {
    45         m_timer.setPriority(G_PRIORITY_HIGH_IDLE + 20);
     45        m_timer.setPriority(RunLoopSourcePriority::MainThreadDispatcherTimer);
    4646    }
    4747
  • trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp

    r213896 r215088  
    3030#include <glib.h>
    3131#include <wtf/MainThread.h>
     32#include <wtf/glib/RunLoopSourcePriority.h>
    3233
    3334namespace WTF {
     
    6162
    6263    m_source = adoptGRef(g_source_new(&runLoopSourceFunctions, sizeof(GSource)));
     64    g_source_set_priority(m_source.get(), RunLoopSourcePriority::RunLoopDispatcher);
    6365    g_source_set_name(m_source.get(), "[WebKit] RunLoop work");
    6466    g_source_set_can_recurse(m_source.get(), TRUE);
     
    142144{
    143145    GRefPtr<GSource> source = adoptGRef(g_timeout_source_new(duration.millisecondsAs<guint>()));
     146    g_source_set_priority(source.get(), RunLoopSourcePriority::RunLoopTimer);
    144147    g_source_set_name(source.get(), "[WebKit] RunLoop dispatchAfter");
    145148
     
    157160    , m_source(adoptGRef(g_source_new(&runLoopSourceFunctions, sizeof(GSource))))
    158161{
     162    g_source_set_priority(m_source.get(), RunLoopSourcePriority::RunLoopTimer);
    159163    g_source_set_name(m_source.get(), "[WebKit] RunLoop::Timer work");
    160164    g_source_set_callback(m_source.get(), [](gpointer userData) -> gboolean {
  • trunk/Source/WTF/wtf/linux/MemoryPressureHandlerLinux.cpp

    r213214 r215088  
    4444#if USE(GLIB)
    4545#include <glib-unix.h>
     46#include <wtf/glib/RunLoopSourcePriority.h>
    4647#endif
    4748
     
    104105#if USE(GLIB)
    105106    m_source = adoptGRef(g_source_new(&eventFDSourceFunctions, sizeof(EventFDSource)));
     107    g_source_set_priority(m_source.get(), RunLoopSourcePriority::MemoryPressureHandlerTimer);
    106108    g_source_set_name(m_source.get(), "WTF: MemoryPressureHandler");
    107109    if (!g_unix_set_fd_nonblocking(m_fd.value(), TRUE, nullptr)) {
  • trunk/Source/WebCore/ChangeLog

    r215087 r215088  
     12017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Update the priorities used in glib main loop sources
     4        https://bugs.webkit.org/show_bug.cgi?id=170457
     5
     6        Reviewed by Žan Doberšek.
     7
     8        * platform/glib/MainThreadSharedTimerGLib.cpp:
     9        (WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
     10        * platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp:
     11        (WebCore::TextureMapperPlatformLayerProxy::TextureMapperPlatformLayerProxy):
     12        (WebCore::TextureMapperPlatformLayerProxy::activateOnCompositingThread):
     13
    1142017-04-07  Zan Dobersek  <zdobersek@igalia.com>
    215
  • trunk/Source/WebCore/platform/glib/MainThreadSharedTimerGLib.cpp

    r208415 r215088  
    2929#include "MainThreadSharedTimer.h"
    3030
    31 #include <glib.h>
     31#include <wtf/glib/RunLoopSourcePriority.h>
    3232
    3333namespace WebCore {
     
    3636    : m_timer(RunLoop::main(), this, &MainThreadSharedTimer::fired)
    3737{
    38     // This is GDK_PRIORITY_REDRAW, but we don't want to depend on GDK here just to use a constant.
    39     m_timer.setPriority(G_PRIORITY_HIGH_IDLE + 20);
     38    m_timer.setPriority(RunLoopSourcePriority::MainThreadDispatcherTimer);
    4039}
    4140
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperPlatformLayerProxy.cpp

    r211358 r215088  
    3434#include "TextureMapperPlatformLayerBuffer.h"
    3535
     36#if USE(GLIB_EVENT_LOOP)
     37#include <wtf/glib/RunLoopSourcePriority.h>
     38#endif
     39
    3640const double s_releaseUnusedSecondsTolerance = 1;
    3741const double s_releaseUnusedBuffersTimerInterval = 0.5;
     
    4448    , m_releaseUnusedBuffersTimer(RunLoop::current(), this, &TextureMapperPlatformLayerProxy::releaseUnusedBuffersTimerFired)
    4549{
     50#if USE(GLIB_EVENT_LOOP)
     51    m_releaseUnusedBuffersTimer.setPriority(RunLoopSourcePriority::ReleaseUnusedResourcesTimer);
     52#endif
    4653}
    4754
     
    6875
    6976    m_compositorThreadUpdateTimer = std::make_unique<RunLoop::Timer<TextureMapperPlatformLayerProxy>>(RunLoop::current(), this, &TextureMapperPlatformLayerProxy::compositorThreadUpdateTimerFired);
     77#if USE(GLIB_EVENT_LOOP)
     78    m_compositorThreadUpdateTimer->setPriority(RunLoopSourcePriority::CompositingThreadUpdateTimer);
     79#endif
    7080}
    7181
  • trunk/Source/WebKit2/ChangeLog

    r215084 r215088  
     12017-04-07  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Update the priorities used in glib main loop sources
     4        https://bugs.webkit.org/show_bug.cgi?id=170457
     5
     6        Reviewed by Žan Doberšek.
     7
     8        * Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp:
     9        (WebKit::CompositingRunLoop::CompositingRunLoop):
     10        * UIProcess/DrawingAreaProxyImpl.cpp:
     11        (WebKit::DrawingAreaProxyImpl::DrawingAreaProxyImpl):
     12        (WebKit::DrawingAreaProxyImpl::DrawingMonitor::DrawingMonitor):
     13        * UIProcess/gtk/WaylandCompositor.cpp:
     14        (WebKit::createWaylandLoopSource):
     15        * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
     16        (WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
     17        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp:
     18        (WebKit::CompositingCoordinator::CompositingCoordinator):
     19        * WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h:
     20        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
     21        (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
     22        * WebProcess/WebPage/DrawingAreaImpl.cpp:
     23        (WebKit::DrawingAreaImpl::DrawingAreaImpl):
     24
    1252017-04-06  Alex Christensen  <achristensen@webkit.org>
    226
  • trunk/Source/WebKit2/Shared/CoordinatedGraphics/threadedcompositor/CompositingRunLoop.cpp

    r211347 r215088  
    3535
    3636#if USE(GLIB_EVENT_LOOP)
    37 #include <glib.h>
     37#include <wtf/glib/RunLoopSourcePriority.h>
    3838#endif
    3939
     
    114114{
    115115#if USE(GLIB_EVENT_LOOP)
    116     m_updateTimer.setPriority(G_PRIORITY_HIGH_IDLE);
     116    m_updateTimer.setPriority(RunLoopSourcePriority::CompositingThreadUpdateTimer);
    117117#endif
    118118}
  • trunk/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.cpp

    r210920 r215088  
    4141#endif
    4242
     43#if USE(GLIB_EVENT_LOOP)
     44#include <wtf/glib/RunLoopSourcePriority.h>
     45#endif
     46
    4347using namespace WebCore;
    4448
     
    4953    , m_discardBackingStoreTimer(RunLoop::current(), this, &DrawingAreaProxyImpl::discardBackingStore)
    5054{
     55#if USE(GLIB_EVENT_LOOP)
     56    m_discardBackingStoreTimer.setPriority(RunLoopSourcePriority::ReleaseUnusedResourcesTimer);
     57#endif
    5158}
    5259
     
    198205    , m_timer(RunLoop::main(), this, &DrawingMonitor::stop)
    199206{
     207#if USE(GLIB_EVENT_LOOP)
     208    // Give redraws more priority.
     209    m_timer.setPriority(GDK_PRIORITY_REDRAW - 10);
     210#endif
    200211}
    201212
  • trunk/Source/WebKit2/UIProcess/gtk/WaylandCompositor.cpp

    r209177 r215088  
    418418    GRefPtr<GSource> source = adoptGRef(g_source_new(&waylandLoopSourceFunctions, sizeof(WaylandLoopSource)));
    419419    g_source_set_name(source.get(), "Nested Wayland compositor display event source");
    420     g_source_set_priority(source.get(), G_PRIORITY_DEFAULT + 1);
    421420
    422421    auto* wlLoopSource = reinterpret_cast<WaylandLoopSource*>(source.get());
  • trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp

    r212608 r215088  
    3939#include <WebCore/Settings.h>
    4040
     41#if USE(GLIB_EVENT_LOOP)
     42#include <wtf/glib/RunLoopSourcePriority.h>
     43#endif
     44
    4145using namespace WebCore;
    4246
     
    5559    , m_discardPreviousLayerTreeHostTimer(RunLoop::main(), this, &AcceleratedDrawingArea::discardPreviousLayerTreeHost)
    5660{
     61#if USE(GLIB_EVENT_LOOP)
     62    m_discardPreviousLayerTreeHostTimer.setPriority(RunLoopSourcePriority::ReleaseUnusedResourcesTimer);
     63#endif
    5764    if (!m_webPage.isVisible())
    5865        suspendPainting();
  • trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp

    r213214 r215088  
    4040#include <wtf/SetForScope.h>
    4141
     42#if USE(GLIB_EVENT_LOOP)
     43#include <wtf/glib/RunLoopSourcePriority.h>
     44#endif
     45
    4246using namespace WebCore;
    4347
     
    4751    : m_page(page)
    4852    , m_client(client)
    49     , m_releaseInactiveAtlasesTimer(*this, &CompositingCoordinator::releaseInactiveAtlasesTimerFired)
    50 {
     53    , m_releaseInactiveAtlasesTimer(RunLoop::main(), this, &CompositingCoordinator::releaseInactiveAtlasesTimerFired)
     54{
     55#if USE(GLIB_EVENT_LOOP)
     56    m_releaseInactiveAtlasesTimer.setPriority(RunLoopSourcePriority::ReleaseUnusedResourcesTimer);
     57#endif
    5158}
    5259
  • trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.h

    r213060 r215088  
    3838#include <WebCore/GraphicsLayerFactory.h>
    3939#include <WebCore/IntRect.h>
    40 #include <WebCore/Timer.h>
    4140
    4241namespace WebCore {
     
    159158
    160159    WebCore::FloatRect m_visibleContentsRect;
    161     WebCore::Timer m_releaseInactiveAtlasesTimer;
     160    RunLoop::Timer<CompositingCoordinator> m_releaseInactiveAtlasesTimer;
    162161
    163162    double m_lastAnimationServiceTime { 0 };
  • trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp

    r213060 r215088  
    4343#endif
    4444
     45#if USE(GLIB_EVENT_LOOP)
     46#include <wtf/glib/RunLoopSourcePriority.h>
     47#endif
     48
    4549using namespace WebCore;
    4650
     
    6165    , m_layerFlushTimer(RunLoop::main(), this, &CoordinatedLayerTreeHost::layerFlushTimerFired)
    6266{
     67#if USE(GLIB_EVENT_LOOP)
     68    m_layerFlushTimer.setPriority(RunLoopSourcePriority::LayerFlushTimer);
     69#endif
    6370    m_coordinator.createRootLayer(m_webPage.size());
    6471
  • trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp

    r213566 r215088  
    3838#include <WebCore/Settings.h>
    3939
     40#if USE(GLIB_EVENT_LOOP)
     41#include <wtf/glib/RunLoopSourcePriority.h>
     42#endif
     43
    4044using namespace WebCore;
    4145
     
    5054    , m_displayTimer(RunLoop::main(), this, &DrawingAreaImpl::displayTimerFired)
    5155{
     56#if USE(GLIB_EVENT_LOOP)
     57    m_displayTimer.setPriority(RunLoopSourcePriority::NonAcceleratedDrawingTimer);
     58#endif
    5259}
    5360
Note: See TracChangeset for help on using the changeset viewer.