Changeset 239202 in webkit


Ignore:
Timestamp:
Dec 14, 2018 4:14:40 AM (5 years ago)
Author:
zandobersek@gmail.com
Message:

[GLib] RunLoop::dispatchAfter() GSource requires microsecond precision
https://bugs.webkit.org/show_bug.cgi?id=192696

Reviewed by Michael Catanzaro.

The GSource we set up in GLib's RunLoop::dispatchAfter() implementation
should support microsecond-precision delays. Such delays are common in
JSC's Watchdog implementation and missing support for them has been
causing test failures in the testapi program as well as some JSC
tests that depend on the termination determination functionality of the
JSC::Watchdog class.

RunLoop::dispatchAfter() is changed to spawn a raw GSource that uses the
existing GSourceFuncs implementation used elsewhere in GLib's RunLoop.
The GSource's ready time is set manually, now with the necessary
microsecond precision.

  • wtf/glib/RunLoopGLib.cpp:

(WTF::RunLoop::dispatchAfter):

Location:
trunk/Source/WTF
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r239195 r239202  
     12018-12-14  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [GLib] RunLoop::dispatchAfter() GSource requires microsecond precision
     4        https://bugs.webkit.org/show_bug.cgi?id=192696
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        The GSource we set up in GLib's RunLoop::dispatchAfter() implementation
     9        should support microsecond-precision delays. Such delays are common in
     10        JSC's Watchdog implementation and missing support for them has been
     11        causing test failures in the `testapi` program as well as some JSC
     12        tests that depend on the termination determination functionality of the
     13        JSC::Watchdog class.
     14
     15        RunLoop::dispatchAfter() is changed to spawn a raw GSource that uses the
     16        existing GSourceFuncs implementation used elsewhere in GLib's RunLoop.
     17        The GSource's ready time is set manually, now with the necessary
     18        microsecond precision.
     19
     20        * wtf/glib/RunLoopGLib.cpp:
     21        (WTF::RunLoop::dispatchAfter):
     22
    1232018-12-13  Saam Barati  <sbarati@apple.com>
    224
  • trunk/Source/WTF/wtf/glib/RunLoopGLib.cpp

    r237099 r239202  
    143143void RunLoop::dispatchAfter(Seconds duration, Function<void()>&& function)
    144144{
    145     GRefPtr<GSource> source = adoptGRef(g_timeout_source_new(duration.millisecondsAs<guint>()));
     145    GRefPtr<GSource> source = adoptGRef(g_source_new(&runLoopSourceFunctions, sizeof(GSource)));
    146146    g_source_set_priority(source.get(), RunLoopSourcePriority::RunLoopTimer);
    147147    g_source_set_name(source.get(), "[WebKit] RunLoop dispatchAfter");
     148    g_source_set_ready_time(source.get(), g_get_monotonic_time() + duration.microsecondsAs<gint64>());
    148149
    149150    std::unique_ptr<DispatchAfterContext> context = std::make_unique<DispatchAfterContext>(WTFMove(function));
Note: See TracChangeset for help on using the changeset viewer.