WebKit Bugzilla
Attachment 357712 Details for
Bug 192855
: [GTK][WPE] Unify TestController::platformRunUntil() and honor condition flag
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch v2
bug-192855-20181219232705.patch (text/plain), 4.66 KB, created by
Adrian Perez
on 2018-12-19 13:27:07 PST
(
hide
)
Description:
Patch v2
Filename:
MIME Type:
Creator:
Adrian Perez
Created:
2018-12-19 13:27:07 PST
Size:
4.66 KB
patch
obsolete
>Subversion Revision: 239384 >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index 29fb744c6d9cea64afaac21ff95a910e33bd7f4f..40f99b0c31105cd0fcb2efed19eed5becaeb17c0 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,16 @@ >+2018-12-19 Adrian Perez de Castro <aperez@igalia.com> >+ >+ [GTK][WPE] Unify TestController::platformRunUntil() and honor condition flag >+ https://bugs.webkit.org/show_bug.cgi?id=192855 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * WebKitTestRunner/gtk/TestControllerGtk.cpp: >+ (WTR::TestController::notifyDone): Use the WPE implementation. >+ (WTR::TestController::platformRunUntil): Use the WPE implementation. >+ * WebKitTestRunner/wpe/TestControllerWPE.cpp: >+ (WTR::TestController::platformRunUntil): Honor the condition flag. >+ > 2018-12-19 Megan Gardner <megan_gardner@apple.com> > > Allow clients to set the navigator platform >diff --git a/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp b/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp >index 4f2e8c43a53b0fd98103152990254bd4ee68c352..5b2010ea12e7f293650428b2472c7a304f1ff808 100644 >--- a/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp >+++ b/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp >@@ -37,27 +37,8 @@ > > namespace WTR { > >-static GSource* timeoutSource() >-{ >- static GRefPtr<GSource> 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(), "[WTR] Test timeout source"); >- g_source_set_callback(source.get(), [](gpointer userData) -> gboolean { >- g_source_set_ready_time(static_cast<GSource*>(userData), -1); >- fprintf(stderr, "FAIL: TestControllerRunLoop timed out.\n"); >- RunLoop::main().stop(); >- return G_SOURCE_REMOVE; >- }, source.get(), nullptr); >- g_source_attach(source.get(), nullptr); >- } >- return source.get(); >-} >- > void TestController::notifyDone() > { >- g_source_set_ready_time(timeoutSource(), -1); > RunLoop::main().stop(); > } > >@@ -74,17 +55,31 @@ void TestController::platformDestroy() > { > } > >-void TestController::platformRunUntil(bool&, WTF::Seconds timeout) >+void TestController::platformRunUntil(bool& done, WTF::Seconds timeout) > { >- if (timeout > 0_s) { >- // FIXME: This conversion is now repeated in several places, it should be moved to a common place in WTF and used everywhere. >- gint64 currentTime = g_get_monotonic_time(); >- gint64 targetTime = currentTime + std::min<gint64>(G_MAXINT64 - currentTime, timeout.microsecondsAs<int64_t>()); >- ASSERT(targetTime >= currentTime); >- g_source_set_ready_time(timeoutSource(), targetTime); >- } else >- g_source_set_ready_time(timeoutSource(), -1); >- RunLoop::main().run(); >+ struct TimeoutTimer { >+ TimeoutTimer() >+ : timer(RunLoop::main(), this, &TimeoutTimer::fired) >+ { } >+ >+ void fired() >+ { >+ timedOut = true; >+ RunLoop::main().stop(); >+ } >+ >+ RunLoop::Timer<TimeoutTimer> timer; >+ bool timedOut { false }; >+ } timeoutTimer; >+ >+ timeoutTimer.timer.setPriority(G_PRIORITY_DEFAULT_IDLE); >+ if (timeout >= 0_s) >+ timeoutTimer.timer.startOneShot(timeout); >+ >+ while (!(done | timeoutTimer.timedOut)) >+ RunLoop::main().run(); >+ >+ timeoutTimer.timer.stop(); > } > > static char* getEnvironmentVariableAsUTF8String(const char* variableName) >diff --git a/Tools/WebKitTestRunner/wpe/TestControllerWPE.cpp b/Tools/WebKitTestRunner/wpe/TestControllerWPE.cpp >index fe30d3de8552575a86fee6a4587b45354b18ed5c..53b88d078f9b9b04c0b4c2942e89ea44c17a5bd9 100644 >--- a/Tools/WebKitTestRunner/wpe/TestControllerWPE.cpp >+++ b/Tools/WebKitTestRunner/wpe/TestControllerWPE.cpp >@@ -58,22 +58,29 @@ void TestController::platformInitializeContext() > { > } > >-void TestController::platformRunUntil(bool& condition, WTF::Seconds timeout) >+void TestController::platformRunUntil(bool& done, WTF::Seconds timeout) > { > struct TimeoutTimer { > TimeoutTimer() > : timer(RunLoop::main(), this, &TimeoutTimer::fired) > { } > >- void fired() { RunLoop::main().stop(); } >+ void fired() >+ { >+ timedOut = true; >+ RunLoop::main().stop(); >+ } >+ > RunLoop::Timer<TimeoutTimer> timer; >+ bool timedOut { false }; > } timeoutTimer; > > timeoutTimer.timer.setPriority(G_PRIORITY_DEFAULT_IDLE); > if (timeout >= 0_s) > timeoutTimer.timer.startOneShot(timeout); > >- RunLoop::main().run(); >+ while (!(done || timeoutTimer.timedOut)) >+ RunLoop::main().run(); > > timeoutTimer.timer.stop(); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192855
:
357683
|
357712
|
357737