Unreviewed, rolling out r176566.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Dec 2014 14:48:34 +0000 (14:48 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 1 Dec 2014 14:48:34 +0000 (14:48 +0000)
https://bugs.webkit.org/show_bug.cgi?id=139124

It broke the GTK performance tests. (Requested by clopez on
#webkit).

Reverted changeset:

"[GTK] Use GMainLoopSource in WebKitTestRunner"
https://bugs.webkit.org/show_bug.cgi?id=138831
http://trac.webkit.org/changeset/176566

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

Tools/ChangeLog
Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp
Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp

index aad0a95..a17a63e 100644 (file)
@@ -1,3 +1,17 @@
+2014-12-01  Commit Queue  <commit-queue@webkit.org>
+
+        Unreviewed, rolling out r176566.
+        https://bugs.webkit.org/show_bug.cgi?id=139124
+
+        It broke the GTK performance tests. (Requested by clopez on
+        #webkit).
+
+        Reverted changeset:
+
+        "[GTK] Use GMainLoopSource in WebKitTestRunner"
+        https://bugs.webkit.org/show_bug.cgi?id=138831
+        http://trac.webkit.org/changeset/176566
+
 2014-11-29  Anders Carlsson  <andersca@apple.com>
 
         Crash when calling WKPageClose on the originated page from within createNewPage callback
index b6488d4..394e908 100644 (file)
@@ -38,8 +38,7 @@
 #include <CoreFoundation/CFRunLoop.h>
 typedef RetainPtr<CFRunLoopTimerRef> PlatformTimerRef;
 #elif PLATFORM(GTK)
-#include <wtf/gobject/GMainLoopSource.h>
-typedef GMainLoopSource PlatformTimerRef;
+typedef unsigned int PlatformTimerRef;
 #elif PLATFORM(EFL)
 typedef Ecore_Timer* PlatformTimerRef;
 #endif
index 850e737..2543748 100644 (file)
 
 namespace WTR {
 
+static gboolean waitToDumpWatchdogTimerCallback(gpointer)
+{
+    InjectedBundle::shared().testRunner()->waitToDumpWatchdogTimerFired();
+    return FALSE;
+}
+
 void TestRunner::platformInitialize()
 {
+    m_waitToDumpWatchdogTimer = 0;
 }
 
 void TestRunner::invalidateWaitToDumpWatchdogTimer()
 {
-    m_waitToDumpWatchdogTimer.cancel();
+    if (!m_waitToDumpWatchdogTimer)
+        return;
+    g_source_remove(m_waitToDumpWatchdogTimer);
+    m_waitToDumpWatchdogTimer = 0;
 }
 
 void TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded()
 {
-    if (m_waitToDumpWatchdogTimer.isScheduled())
+    if (m_waitToDumpWatchdogTimer)
         return;
 
-    m_waitToDumpWatchdogTimer.scheduleAfterDelay("[WTR] waitToDumpWatchdogTimerCallback", [this] { waitToDumpWatchdogTimerFired(); },
-        std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(waitToDumpWatchdogTimerInterval)));
+    m_waitToDumpWatchdogTimer = g_timeout_add(waitToDumpWatchdogTimerInterval * 1000,
+                                              waitToDumpWatchdogTimerCallback, 0);
+    g_source_set_name_by_id(m_waitToDumpWatchdogTimer, "[WebKit] waitToDumpWatchdogTimerCallback");
 }
 
 JSRetainPtr<JSStringRef> TestRunner::pathToLocalResource(JSStringRef url)
index 16352ff..e5cb71e 100644 (file)
 
 #include <gtk/gtk.h>
 #include <wtf/Platform.h>
-#include <wtf/gobject/GMainLoopSource.h>
 #include <wtf/gobject/GUniquePtr.h>
 #include <wtf/text/WTFString.h>
 
 namespace WTR {
 
-static GMainLoopSource timeoutSource;
+static guint gTimeoutSourceId = 0;
+
+static void cancelTimeout()
+{
+    if (!gTimeoutSourceId)
+        return;
+    g_source_remove(gTimeoutSourceId);
+    gTimeoutSourceId = 0;
+}
 
 void TestController::notifyDone()
 {
     gtk_main_quit();
-    timeoutSource.cancel();
+    cancelTimeout();
 }
 
 void TestController::platformInitialize()
@@ -51,16 +58,24 @@ void TestController::platformDestroy()
 {
 }
 
+static gboolean timeoutCallback(gpointer)
+{
+    fprintf(stderr, "FAIL: TestControllerRunLoop timed out.\n");
+    gtk_main_quit();
+    return FALSE;
+}
+
 void TestController::platformWillRunTest(const TestInvocation&)
 {
 }
 
 void TestController::platformRunUntil(bool&, double timeout)
 {
-    timeoutSource.scheduleAfterDelay("[WTR] Test timeout source", [] {
-        fprintf(stderr, "FAIL: TestControllerRunLoop timed out.\n");
-        gtk_main_quit();
-    }, std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(timeout)));
+    cancelTimeout();
+    if (timeout != m_noTimeout) {
+        gTimeoutSourceId = g_timeout_add(timeout * 1000, timeoutCallback, 0);
+        g_source_set_name_by_id(gTimeoutSourceId, "[WebKit] timeoutCallback");
+    }
     gtk_main();
 }