<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[192782] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/192782">192782</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-11-27 08:54:45 -0800 (Fri, 27 Nov 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Remove the remaining uses of GMainLoopSource
https://bugs.webkit.org/show_bug.cgi?id=151632

Reviewed by Žan Doberšek.

Source/WebKit2:

* UIProcess/API/gtk/WebKitWebViewBase.cpp:
(_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate):
(_WebKitWebViewBasePrivate::clearRedirectedWindowSoonTimerFired):
(webkitWebViewBaseClearRedirectedWindowSoon):
(webkitWebViewBaseEnterAcceleratedCompositingMode):

Tools:

* TestWebKitAPI/Tests/WebKit2Gtk/TestResources.cpp:
(testWebViewSyncRequestOnMaxConns):
* TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
* WebKitTestRunner/InjectedBundle/TestRunner.cpp:
(WTR::TestRunner::TestRunner):
* WebKitTestRunner/InjectedBundle/TestRunner.h:
* WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp:
(WTR::TestRunner::invalidateWaitToDumpWatchdogTimer):
(WTR::TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded):
* WebKitTestRunner/gtk/TestControllerGtk.cpp:
(WTR::timeoutSource):
(WTR::TestController::notifyDone):
(WTR::TestController::platformRunUntil):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestResourcescpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestResources.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPIgtkWebKit2GtkWebViewTestcpp">trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh">trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h</a></li>
<li><a href="#trunkToolsWebKitTestRunnerInjectedBundlegtkTestRunnerGtkcpp">trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp</a></li>
<li><a href="#trunkToolsWebKitTestRunnergtkTestControllerGtkcpp">trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (192781 => 192782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-11-27 14:16:31 UTC (rev 192781)
+++ trunk/Source/WebKit2/ChangeLog        2015-11-27 16:54:45 UTC (rev 192782)
</span><span class="lines">@@ -1,3 +1,16 @@
</span><ins>+2015-11-27  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Remove the remaining uses of GMainLoopSource
+        https://bugs.webkit.org/show_bug.cgi?id=151632
+
+        Reviewed by Žan Doberšek.
+
+        * UIProcess/API/gtk/WebKitWebViewBase.cpp:
+        (_WebKitWebViewBasePrivate::_WebKitWebViewBasePrivate):
+        (_WebKitWebViewBasePrivate::clearRedirectedWindowSoonTimerFired):
+        (webkitWebViewBaseClearRedirectedWindowSoon):
+        (webkitWebViewBaseEnterAcceleratedCompositingMode):
+
</ins><span class="cx"> 2015-11-23  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Use the network process unconditionally
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (192781 => 192782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2015-11-27 14:16:31 UTC (rev 192781)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2015-11-27 16:54:45 UTC (rev 192782)
</span><span class="lines">@@ -65,7 +65,6 @@
</span><span class="cx"> #include &lt;glib/gi18n-lib.h&gt;
</span><span class="cx"> #include &lt;memory&gt;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><del>-#include &lt;wtf/glib/GMainLoopSource.h&gt;
</del><span class="cx"> #include &lt;wtf/glib/GRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/CString.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -149,6 +148,19 @@
</span><span class="cx"> typedef HashMap&lt;uint32_t, GUniquePtr&lt;GdkEvent&gt;&gt; TouchEventsMap;
</span><span class="cx"> 
</span><span class="cx"> struct _WebKitWebViewBasePrivate {
</span><ins>+#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
+    _WebKitWebViewBasePrivate()
+        : clearRedirectedWindowSoonTimer(RunLoop::main(), this, &amp;_WebKitWebViewBasePrivate::clearRedirectedWindowSoonTimerFired)
+    {
+    }
+
+    void clearRedirectedWindowSoonTimerFired()
+    {
+        if (redirectedWindow)
+            redirectedWindow-&gt;resize(IntSize());
+    }
+#endif
+
</ins><span class="cx">     WebKitWebViewChildrenMap children;
</span><span class="cx">     std::unique_ptr&lt;PageClientImpl&gt; pageClient;
</span><span class="cx">     RefPtr&lt;WebPageProxy&gt; pageProxy;
</span><span class="lines">@@ -190,7 +202,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(REDIRECTED_XCOMPOSITE_WINDOW)
</span><span class="cx">     std::unique_ptr&lt;RedirectedXCompositeWindow&gt; redirectedWindow;
</span><del>-    GMainLoopSource clearRedirectedWindowSoon;
</del><ins>+    RunLoop::Timer&lt;WebKitWebViewBasePrivate&gt; clearRedirectedWindowSoonTimer;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(DRAG_SUPPORT)
</span><span class="lines">@@ -1358,12 +1370,8 @@
</span><span class="cx"> #if USE(REDIRECTED_XCOMPOSITE_WINDOW)
</span><span class="cx"> static void webkitWebViewBaseClearRedirectedWindowSoon(WebKitWebViewBase* webkitWebViewBase)
</span><span class="cx"> {
</span><del>-    WebKitWebViewBasePrivate* priv = webkitWebViewBase-&gt;priv;
-    static const std::chrono::seconds clearRedirectedWindowSoonDelay = 2_s;
-    priv-&gt;clearRedirectedWindowSoon.scheduleAfterDelay(&quot;[WebKit] Clear RedirectedWindow soon&quot;, [priv]() {
-        if (priv-&gt;redirectedWindow)
-            priv-&gt;redirectedWindow-&gt;resize(IntSize());
-    }, clearRedirectedWindowSoonDelay);
</del><ins>+    static const double clearRedirectedWindowSoonDelay = 2;
+    webkitWebViewBase-&gt;priv-&gt;clearRedirectedWindowSoonTimer.startOneShot(clearRedirectedWindowSoonDelay);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -1390,7 +1398,7 @@
</span><span class="cx"> void webkitWebViewBaseEnterAcceleratedCompositingMode(WebKitWebViewBase* webkitWebViewBase)
</span><span class="cx"> {
</span><span class="cx"> #if USE(REDIRECTED_XCOMPOSITE_WINDOW)
</span><del>-    webkitWebViewBase-&gt;priv-&gt;clearRedirectedWindowSoon.cancel();
</del><ins>+    webkitWebViewBase-&gt;priv-&gt;clearRedirectedWindowSoonTimer.stop();
</ins><span class="cx"> #else
</span><span class="cx">     UNUSED_PARAM(webkitWebViewBase);
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (192781 => 192782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-11-27 14:16:31 UTC (rev 192781)
+++ trunk/Tools/ChangeLog        2015-11-27 16:54:45 UTC (rev 192782)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2015-11-27  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Remove the remaining uses of GMainLoopSource
+        https://bugs.webkit.org/show_bug.cgi?id=151632
+
+        Reviewed by Žan Doberšek.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestResources.cpp:
+        (testWebViewSyncRequestOnMaxConns):
+        * TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp:
+        * WebKitTestRunner/InjectedBundle/TestRunner.cpp:
+        (WTR::TestRunner::TestRunner):
+        * WebKitTestRunner/InjectedBundle/TestRunner.h:
+        * WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp:
+        (WTR::TestRunner::invalidateWaitToDumpWatchdogTimer):
+        (WTR::TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded):
+        * WebKitTestRunner/gtk/TestControllerGtk.cpp:
+        (WTR::timeoutSource):
+        (WTR::TestController::notifyDone):
+        (WTR::TestController::platformRunUntil):
+
</ins><span class="cx"> 2015-11-27  Csaba Osztrogonác  &lt;ossy@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         [cmake] Add testb3 to the build system
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestResourcescpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestResources.cpp (192781 => 192782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestResources.cpp        2015-11-27 14:16:31 UTC (rev 192781)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestResources.cpp        2015-11-27 16:54:45 UTC (rev 192782)
</span><span class="lines">@@ -22,7 +22,6 @@
</span><span class="cx"> #include &quot;WebKitTestServer.h&quot;
</span><span class="cx"> #include &quot;WebViewTest.h&quot;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><del>-#include &lt;wtf/glib/GMainLoopSource.h&gt;
</del><span class="cx"> #include &lt;wtf/glib/GMutexLocker.h&gt;
</span><span class="cx"> #include &lt;wtf/glib/GRefPtr.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -706,12 +705,27 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // By default sync XHRs have a 10 seconds timeout, we don't want to wait all that so use our own timeout.
</span><del>-    GMainLoopSource timeoutSource;
-    timeoutSource.scheduleAfterDelay(&quot;Timeout&quot;, [] { g_assert_not_reached(); }, std::chrono::seconds(1));
</del><ins>+    guint timeoutSourceID = g_timeout_add(1000, [] (gpointer) -&gt; gboolean {
+        g_assert_not_reached();
+        return G_SOURCE_REMOVE;
+    }, nullptr);
</ins><span class="cx"> 
</span><del>-    GMainLoopSource unlockServerSource;
-    unlockServerSource.schedule(&quot;Unlock Server Idle&quot;, [&amp;lock] { lock.unlock(); });
</del><ins>+    struct UnlockServerSourceContext {
+        WTF::GMutexLocker&lt;GMutex&gt;&amp; lock;
+        guint unlockServerSourceID;
+    } context = {
+        lock,
+        g_idle_add_full(G_PRIORITY_DEFAULT, [](gpointer userData) -&gt; gboolean {
+            auto&amp; context = *static_cast&lt;UnlockServerSourceContext*&gt;(userData);
+            context.unlockServerSourceID = 0;
+            context.lock.unlock();
+            return G_SOURCE_REMOVE;
+        }, &amp;context, nullptr)
+    };
</ins><span class="cx">     test-&gt;waitUntilResourcesLoaded(s_maxConnectionsPerHost + 3); // s_maxConnectionsPerHost resource + main resource + 2 XHR.
</span><ins>+    g_source_remove(timeoutSourceID);
+    if (context.unlockServerSourceID)
+        g_source_remove(context.unlockServerSourceID);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void addCacheHTTPHeadersToResponse(SoupMessage* message)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIgtkWebKit2GtkWebViewTestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp (192781 => 192782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp        2015-11-27 14:16:31 UTC (rev 192781)
+++ trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp        2015-11-27 16:54:45 UTC (rev 192782)
</span><span class="lines">@@ -23,7 +23,6 @@
</span><span class="cx"> 
</span><span class="cx"> #include &lt;JavaScriptCore/JSRetainPtr.h&gt;
</span><span class="cx"> #include &lt;WebCore/GUniquePtrGtk.h&gt;
</span><del>-#include &lt;wtf/glib/GMainLoopSource.h&gt;
</del><span class="cx"> 
</span><span class="cx"> WebViewTest::WebViewTest(WebKitUserContentManager* userContentManager)
</span><span class="cx">     : m_webView(WEBKIT_WEB_VIEW(g_object_ref_sink(g_object_new(WEBKIT_TYPE_WEB_VIEW, &quot;web-context&quot;, m_webContext.get(), &quot;user-content-manager&quot;, userContentManager, nullptr))))
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (192781 => 192782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2015-11-27 14:16:31 UTC (rev 192781)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp        2015-11-27 16:54:45 UTC (rev 192782)
</span><span class="lines">@@ -96,6 +96,9 @@
</span><span class="cx">     , m_databaseMaxQuota(-1)
</span><span class="cx">     , m_userStyleSheetEnabled(false)
</span><span class="cx">     , m_userStyleSheetLocation(adoptWK(WKStringCreateWithUTF8CString(&quot;&quot;)))
</span><ins>+#if PLATFORM(GTK)
+    , m_waitToDumpWatchdogTimer(RunLoop::main(), this, &amp;TestRunner::waitToDumpWatchdogTimerFired)
+#endif
</ins><span class="cx"> {
</span><span class="cx">     platformInitialize();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundleTestRunnerh"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (192781 => 192782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2015-11-27 14:16:31 UTC (rev 192781)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h        2015-11-27 16:54:45 UTC (rev 192782)
</span><span class="lines">@@ -38,8 +38,11 @@
</span><span class="cx"> #include &lt;CoreFoundation/CFRunLoop.h&gt;
</span><span class="cx"> typedef RetainPtr&lt;CFRunLoopTimerRef&gt; PlatformTimerRef;
</span><span class="cx"> #elif PLATFORM(GTK)
</span><del>-#include &lt;wtf/glib/GMainLoopSource.h&gt;
-typedef GMainLoopSource PlatformTimerRef;
</del><ins>+#include &lt;wtf/RunLoop.h&gt;
+namespace WTR {
+class TestRunner;
+typedef RunLoop::Timer&lt;TestRunner&gt; PlatformTimerRef;
+}
</ins><span class="cx"> #elif PLATFORM(EFL)
</span><span class="cx"> typedef Ecore_Timer* PlatformTimerRef;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnerInjectedBundlegtkTestRunnerGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp (192781 => 192782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp        2015-11-27 14:16:31 UTC (rev 192781)
+++ trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp        2015-11-27 16:54:45 UTC (rev 192782)
</span><span class="lines">@@ -40,16 +40,15 @@
</span><span class="cx"> 
</span><span class="cx"> void TestRunner::invalidateWaitToDumpWatchdogTimer()
</span><span class="cx"> {
</span><del>-    m_waitToDumpWatchdogTimer.cancel();
</del><ins>+    m_waitToDumpWatchdogTimer.stop();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded()
</span><span class="cx"> {
</span><del>-    if (m_waitToDumpWatchdogTimer.isScheduled())
</del><ins>+    if (m_waitToDumpWatchdogTimer.isActive())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    m_waitToDumpWatchdogTimer.scheduleAfterDelay(&quot;[WTR] waitToDumpWatchdogTimerCallback&quot;, [this] { waitToDumpWatchdogTimerFired(); },
-        std::chrono::milliseconds(m_timeout));
</del><ins>+    m_waitToDumpWatchdogTimer.startOneShot(m_timeout / 1000.0);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSRetainPtr&lt;JSStringRef&gt; TestRunner::pathToLocalResource(JSStringRef url)
</span></span></pre></div>
<a id="trunkToolsWebKitTestRunnergtkTestControllerGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp (192781 => 192782)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp        2015-11-27 14:16:31 UTC (rev 192781)
+++ trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp        2015-11-27 16:54:45 UTC (rev 192782)
</span><span class="lines">@@ -31,17 +31,33 @@
</span><span class="cx"> #include &lt;gtk/gtk.h&gt;
</span><span class="cx"> #include &lt;wtf/Platform.h&gt;
</span><span class="cx"> #include &lt;wtf/RunLoop.h&gt;
</span><del>-#include &lt;wtf/glib/GMainLoopSource.h&gt;
</del><ins>+#include &lt;wtf/glib/GRefPtr.h&gt;
</ins><span class="cx"> #include &lt;wtf/glib/GUniquePtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace WTR {
</span><span class="cx"> 
</span><del>-static GMainLoopSource timeoutSource;
</del><ins>+static GSource* timeoutSource()
+{
+    static GRefPtr&lt;GSource&gt; source = nullptr;
+    if (!source) {
+        source = adoptGRef(g_timeout_source_new(0));
+        g_source_set_ready_time(source.get(), -1);
+        g_source_set_name(source.get(), &quot;[WTR] Test timeout source&quot;);
+        g_source_set_callback(source.get(), [](gpointer userData) -&gt; gboolean {
+            g_source_set_ready_time(static_cast&lt;GSource*&gt;(userData), -1);
+            fprintf(stderr, &quot;FAIL: TestControllerRunLoop timed out.\n&quot;);
+            RunLoop::main().stop();
+            return G_SOURCE_CONTINUE;
+        }, source.get(), nullptr);
+        g_source_attach(source.get(), nullptr);
+    }
+    return source.get();
+}
</ins><span class="cx"> 
</span><span class="cx"> void TestController::notifyDone()
</span><span class="cx"> {
</span><del>-    timeoutSource.cancel();
</del><ins>+    g_source_set_ready_time(timeoutSource(), -1);
</ins><span class="cx">     RunLoop::main().stop();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -61,12 +77,17 @@
</span><span class="cx"> void TestController::platformRunUntil(bool&amp;, double timeout)
</span><span class="cx"> {
</span><span class="cx">     if (timeout &gt; 0) {
</span><del>-        timeoutSource.scheduleAfterDelay(&quot;[WTR] Test timeout source&quot;, [] {
-            fprintf(stderr, &quot;FAIL: TestControllerRunLoop timed out.\n&quot;);
-            RunLoop::main().stop();
-        }, std::chrono::duration_cast&lt;std::chrono::microseconds&gt;(std::chrono::duration&lt;double&gt;(timeout)));
</del><ins>+        // FIXME: This conversion is now repeated in several places, it should be moved to a common place in WTF and used everywhere.
+        auto timeoutDuration = std::chrono::duration&lt;double&gt;(timeout);
+        auto safeDuration = std::chrono::microseconds::max();
+        if (timeoutDuration &lt; safeDuration)
+            safeDuration = std::chrono::duration_cast&lt;std::chrono::microseconds&gt;(timeoutDuration);
+        gint64 currentTime = g_get_monotonic_time();
+        gint64 targetTime = currentTime + std::min&lt;gint64&gt;(G_MAXINT64 - currentTime, safeDuration.count());
+        ASSERT(targetTime &gt;= currentTime);
+        g_source_set_ready_time(timeoutSource(), targetTime);
</ins><span class="cx">     } else
</span><del>-        timeoutSource.cancel();
</del><ins>+        g_source_set_ready_time(timeoutSource(), -1);
</ins><span class="cx">     RunLoop::main().run();
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>