Changeset 176566 in webkit
- Timestamp:
- Nov 28, 2014, 8:39:36 AM (10 years ago)
- Location:
- trunk/Tools
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r176564 r176566 1 2014-11-28 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 [GTK] Use GMainLoopSource in WebKitTestRunner 4 https://bugs.webkit.org/show_bug.cgi?id=138831 5 6 Reviewed by Sergio Villar Senin. 7 8 * WebKitTestRunner/InjectedBundle/TestRunner.h: 9 * WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp: 10 (WTR::TestRunner::platformInitialize): 11 (WTR::TestRunner::invalidateWaitToDumpWatchdogTimer): 12 (WTR::TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded): 13 (WTR::waitToDumpWatchdogTimerCallback): Deleted. 14 * WebKitTestRunner/gtk/TestControllerGtk.cpp: 15 (WTR::TestController::notifyDone): 16 (WTR::TestController::platformRunUntil): 17 (WTR::cancelTimeout): Deleted. 18 1 19 2014-11-24 Philippe Normand <pnormand@igalia.com> 2 20 -
trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h
r176011 r176566 39 39 typedef RetainPtr<CFRunLoopTimerRef> PlatformTimerRef; 40 40 #elif PLATFORM(GTK) 41 typedef unsigned int PlatformTimerRef; 41 #include <wtf/gobject/GMainLoopSource.h> 42 typedef GMainLoopSource PlatformTimerRef; 42 43 #elif PLATFORM(EFL) 43 44 typedef Ecore_Timer* PlatformTimerRef; -
trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp
r162599 r176566 35 35 namespace WTR { 36 36 37 static gboolean waitToDumpWatchdogTimerCallback(gpointer)38 {39 InjectedBundle::shared().testRunner()->waitToDumpWatchdogTimerFired();40 return FALSE;41 }42 43 37 void TestRunner::platformInitialize() 44 38 { 45 m_waitToDumpWatchdogTimer = 0;46 39 } 47 40 48 41 void TestRunner::invalidateWaitToDumpWatchdogTimer() 49 42 { 50 if (!m_waitToDumpWatchdogTimer) 51 return; 52 g_source_remove(m_waitToDumpWatchdogTimer); 53 m_waitToDumpWatchdogTimer = 0; 43 m_waitToDumpWatchdogTimer.cancel(); 54 44 } 55 45 56 46 void TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded() 57 47 { 58 if (m_waitToDumpWatchdogTimer )48 if (m_waitToDumpWatchdogTimer.isScheduled()) 59 49 return; 60 50 61 m_waitToDumpWatchdogTimer = g_timeout_add(waitToDumpWatchdogTimerInterval * 1000, 62 waitToDumpWatchdogTimerCallback, 0); 63 g_source_set_name_by_id(m_waitToDumpWatchdogTimer, "[WebKit] waitToDumpWatchdogTimerCallback"); 51 m_waitToDumpWatchdogTimer.scheduleAfterDelay("[WTR] waitToDumpWatchdogTimerCallback", [this] { waitToDumpWatchdogTimerFired(); }, 52 std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(waitToDumpWatchdogTimerInterval))); 64 53 } 65 54 -
trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp
r168045 r176566 30 30 #include <gtk/gtk.h> 31 31 #include <wtf/Platform.h> 32 #include <wtf/gobject/GMainLoopSource.h> 32 33 #include <wtf/gobject/GUniquePtr.h> 33 34 #include <wtf/text/WTFString.h> … … 35 36 namespace WTR { 36 37 37 static guint gTimeoutSourceId = 0; 38 39 static void cancelTimeout() 40 { 41 if (!gTimeoutSourceId) 42 return; 43 g_source_remove(gTimeoutSourceId); 44 gTimeoutSourceId = 0; 45 } 38 static GMainLoopSource timeoutSource; 46 39 47 40 void TestController::notifyDone() 48 41 { 49 42 gtk_main_quit(); 50 cancelTimeout();43 timeoutSource.cancel(); 51 44 } 52 45 … … 59 52 } 60 53 61 static gboolean timeoutCallback(gpointer)62 {63 fprintf(stderr, "FAIL: TestControllerRunLoop timed out.\n");64 gtk_main_quit();65 return FALSE;66 }67 68 54 void TestController::platformWillRunTest(const TestInvocation&) 69 55 { … … 72 58 void TestController::platformRunUntil(bool&, double timeout) 73 59 { 74 cancelTimeout(); 75 if (timeout != m_noTimeout) { 76 gTimeoutSourceId = g_timeout_add(timeout * 1000, timeoutCallback, 0); 77 g_source_set_name_by_id(gTimeoutSourceId, "[WebKit] timeoutCallback"); 78 } 60 timeoutSource.scheduleAfterDelay("[WTR] Test timeout source", [] { 61 fprintf(stderr, "FAIL: TestControllerRunLoop timed out.\n"); 62 gtk_main_quit(); 63 }, std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(timeout))); 79 64 gtk_main(); 80 65 }
Note:
See TracChangeset
for help on using the changeset viewer.