Diff
Modified: trunk/Source/WebKit2/ChangeLog (192781 => 192782)
--- 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)
@@ -1,3 +1,16 @@
+2015-11-27 Carlos Garcia Campos <[email protected]>
+
+ [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):
+
2015-11-23 Carlos Garcia Campos <[email protected]>
[GTK] Use the network process unconditionally
Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (192781 => 192782)
--- 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)
@@ -65,7 +65,6 @@
#include <glib/gi18n-lib.h>
#include <memory>
#include <wtf/HashMap.h>
-#include <wtf/glib/GMainLoopSource.h>
#include <wtf/glib/GRefPtr.h>
#include <wtf/text/CString.h>
@@ -149,6 +148,19 @@
typedef HashMap<uint32_t, GUniquePtr<GdkEvent>> TouchEventsMap;
struct _WebKitWebViewBasePrivate {
+#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
+ _WebKitWebViewBasePrivate()
+ : clearRedirectedWindowSoonTimer(RunLoop::main(), this, &_WebKitWebViewBasePrivate::clearRedirectedWindowSoonTimerFired)
+ {
+ }
+
+ void clearRedirectedWindowSoonTimerFired()
+ {
+ if (redirectedWindow)
+ redirectedWindow->resize(IntSize());
+ }
+#endif
+
WebKitWebViewChildrenMap children;
std::unique_ptr<PageClientImpl> pageClient;
RefPtr<WebPageProxy> pageProxy;
@@ -190,7 +202,7 @@
#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
std::unique_ptr<RedirectedXCompositeWindow> redirectedWindow;
- GMainLoopSource clearRedirectedWindowSoon;
+ RunLoop::Timer<WebKitWebViewBasePrivate> clearRedirectedWindowSoonTimer;
#endif
#if ENABLE(DRAG_SUPPORT)
@@ -1358,12 +1370,8 @@
#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
static void webkitWebViewBaseClearRedirectedWindowSoon(WebKitWebViewBase* webkitWebViewBase)
{
- WebKitWebViewBasePrivate* priv = webkitWebViewBase->priv;
- static const std::chrono::seconds clearRedirectedWindowSoonDelay = 2_s;
- priv->clearRedirectedWindowSoon.scheduleAfterDelay("[WebKit] Clear RedirectedWindow soon", [priv]() {
- if (priv->redirectedWindow)
- priv->redirectedWindow->resize(IntSize());
- }, clearRedirectedWindowSoonDelay);
+ static const double clearRedirectedWindowSoonDelay = 2;
+ webkitWebViewBase->priv->clearRedirectedWindowSoonTimer.startOneShot(clearRedirectedWindowSoonDelay);
}
#endif
@@ -1390,7 +1398,7 @@
void webkitWebViewBaseEnterAcceleratedCompositingMode(WebKitWebViewBase* webkitWebViewBase)
{
#if USE(REDIRECTED_XCOMPOSITE_WINDOW)
- webkitWebViewBase->priv->clearRedirectedWindowSoon.cancel();
+ webkitWebViewBase->priv->clearRedirectedWindowSoonTimer.stop();
#else
UNUSED_PARAM(webkitWebViewBase);
#endif
Modified: trunk/Tools/ChangeLog (192781 => 192782)
--- trunk/Tools/ChangeLog 2015-11-27 14:16:31 UTC (rev 192781)
+++ trunk/Tools/ChangeLog 2015-11-27 16:54:45 UTC (rev 192782)
@@ -1,3 +1,24 @@
+2015-11-27 Carlos Garcia Campos <[email protected]>
+
+ [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):
+
2015-11-27 Csaba Osztrogonác <[email protected]>
[cmake] Add testb3 to the build system
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestResources.cpp (192781 => 192782)
--- 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)
@@ -22,7 +22,6 @@
#include "WebKitTestServer.h"
#include "WebViewTest.h"
#include <wtf/Vector.h>
-#include <wtf/glib/GMainLoopSource.h>
#include <wtf/glib/GMutexLocker.h>
#include <wtf/glib/GRefPtr.h>
@@ -706,12 +705,27 @@
}
// By default sync XHRs have a 10 seconds timeout, we don't want to wait all that so use our own timeout.
- GMainLoopSource timeoutSource;
- timeoutSource.scheduleAfterDelay("Timeout", [] { g_assert_not_reached(); }, std::chrono::seconds(1));
+ guint timeoutSourceID = g_timeout_add(1000, [] (gpointer) -> gboolean {
+ g_assert_not_reached();
+ return G_SOURCE_REMOVE;
+ }, nullptr);
- GMainLoopSource unlockServerSource;
- unlockServerSource.schedule("Unlock Server Idle", [&lock] { lock.unlock(); });
+ struct UnlockServerSourceContext {
+ WTF::GMutexLocker<GMutex>& lock;
+ guint unlockServerSourceID;
+ } context = {
+ lock,
+ g_idle_add_full(G_PRIORITY_DEFAULT, [](gpointer userData) -> gboolean {
+ auto& context = *static_cast<UnlockServerSourceContext*>(userData);
+ context.unlockServerSourceID = 0;
+ context.lock.unlock();
+ return G_SOURCE_REMOVE;
+ }, &context, nullptr)
+ };
test->waitUntilResourcesLoaded(s_maxConnectionsPerHost + 3); // s_maxConnectionsPerHost resource + main resource + 2 XHR.
+ g_source_remove(timeoutSourceID);
+ if (context.unlockServerSourceID)
+ g_source_remove(context.unlockServerSourceID);
}
static void addCacheHTTPHeadersToResponse(SoupMessage* message)
Modified: trunk/Tools/TestWebKitAPI/gtk/WebKit2Gtk/WebViewTest.cpp (192781 => 192782)
--- 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)
@@ -23,7 +23,6 @@
#include <_javascript_Core/JSRetainPtr.h>
#include <WebCore/GUniquePtrGtk.h>
-#include <wtf/glib/GMainLoopSource.h>
WebViewTest::WebViewTest(WebKitUserContentManager* userContentManager)
: m_webView(WEBKIT_WEB_VIEW(g_object_ref_sink(g_object_new(WEBKIT_TYPE_WEB_VIEW, "web-context", m_webContext.get(), "user-content-manager", userContentManager, nullptr))))
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.cpp (192781 => 192782)
--- 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)
@@ -96,6 +96,9 @@
, m_databaseMaxQuota(-1)
, m_userStyleSheetEnabled(false)
, m_userStyleSheetLocation(adoptWK(WKStringCreateWithUTF8CString("")))
+#if PLATFORM(GTK)
+ , m_waitToDumpWatchdogTimer(RunLoop::main(), this, &TestRunner::waitToDumpWatchdogTimerFired)
+#endif
{
platformInitialize();
}
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/TestRunner.h (192781 => 192782)
--- 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)
@@ -38,8 +38,11 @@
#include <CoreFoundation/CFRunLoop.h>
typedef RetainPtr<CFRunLoopTimerRef> PlatformTimerRef;
#elif PLATFORM(GTK)
-#include <wtf/glib/GMainLoopSource.h>
-typedef GMainLoopSource PlatformTimerRef;
+#include <wtf/RunLoop.h>
+namespace WTR {
+class TestRunner;
+typedef RunLoop::Timer<TestRunner> PlatformTimerRef;
+}
#elif PLATFORM(EFL)
typedef Ecore_Timer* PlatformTimerRef;
#endif
Modified: trunk/Tools/WebKitTestRunner/InjectedBundle/gtk/TestRunnerGtk.cpp (192781 => 192782)
--- 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)
@@ -40,16 +40,15 @@
void TestRunner::invalidateWaitToDumpWatchdogTimer()
{
- m_waitToDumpWatchdogTimer.cancel();
+ m_waitToDumpWatchdogTimer.stop();
}
void TestRunner::initializeWaitToDumpWatchdogTimerIfNeeded()
{
- if (m_waitToDumpWatchdogTimer.isScheduled())
+ if (m_waitToDumpWatchdogTimer.isActive())
return;
- m_waitToDumpWatchdogTimer.scheduleAfterDelay("[WTR] waitToDumpWatchdogTimerCallback", [this] { waitToDumpWatchdogTimerFired(); },
- std::chrono::milliseconds(m_timeout));
+ m_waitToDumpWatchdogTimer.startOneShot(m_timeout / 1000.0);
}
JSRetainPtr<JSStringRef> TestRunner::pathToLocalResource(JSStringRef url)
Modified: trunk/Tools/WebKitTestRunner/gtk/TestControllerGtk.cpp (192781 => 192782)
--- 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)
@@ -31,17 +31,33 @@
#include <gtk/gtk.h>
#include <wtf/Platform.h>
#include <wtf/RunLoop.h>
-#include <wtf/glib/GMainLoopSource.h>
+#include <wtf/glib/GRefPtr.h>
#include <wtf/glib/GUniquePtr.h>
#include <wtf/text/WTFString.h>
namespace WTR {
-static GMainLoopSource timeoutSource;
+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_CONTINUE;
+ }, source.get(), nullptr);
+ g_source_attach(source.get(), nullptr);
+ }
+ return source.get();
+}
void TestController::notifyDone()
{
- timeoutSource.cancel();
+ g_source_set_ready_time(timeoutSource(), -1);
RunLoop::main().stop();
}
@@ -61,12 +77,17 @@
void TestController::platformRunUntil(bool&, double timeout)
{
if (timeout > 0) {
- timeoutSource.scheduleAfterDelay("[WTR] Test timeout source", [] {
- fprintf(stderr, "FAIL: TestControllerRunLoop timed out.\n");
- RunLoop::main().stop();
- }, std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(timeout)));
+ // 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<double>(timeout);
+ auto safeDuration = std::chrono::microseconds::max();
+ if (timeoutDuration < safeDuration)
+ safeDuration = std::chrono::duration_cast<std::chrono::microseconds>(timeoutDuration);
+ gint64 currentTime = g_get_monotonic_time();
+ gint64 targetTime = currentTime + std::min<gint64>(G_MAXINT64 - currentTime, safeDuration.count());
+ ASSERT(targetTime >= currentTime);
+ g_source_set_ready_time(timeoutSource(), targetTime);
} else
- timeoutSource.cancel();
+ g_source_set_ready_time(timeoutSource(), -1);
RunLoop::main().run();
}