https://bugs.webkit.org/show_bug.cgi?id=150592
Reviewed by Žan Doberšek.
Source/WebCore:
* platform/network/ResourceHandle.h:
* platform/network/ResourceHandleInternal.h:
(WebCore::ResourceHandleInternal::ResourceHandleInternal):
* platform/network/soup/ResourceHandleSoup.cpp:
(WebCore::cleanupSoupRequestOperation):
(WebCore::ResourceHandle::timeoutFired):
(WebCore::ResourceHandle::sendPendingRequest):
(WebCore::ResourceHandle::platformSetDefersLoading):
Source/WebKit2:
* Shared/Downloads/soup/DownloadSoup.cpp:
(WebKit::DownloadClient::DownloadClient):
(WebKit::DownloadClient::didReceiveData):
(WebKit::DownloadClient::handleResponseLater):
* UIProcess/gtk/GestureController.cpp:
(WebKit::GestureController::DragGesture::begin):
(WebKit::GestureController::DragGesture::update):
(WebKit::GestureController::DragGesture::end):
(WebKit::GestureController::DragGesture::longPressFired):
(WebKit::GestureController::DragGesture::DragGesture):
(WebKit::GestureController::ZoomGesture::scaleChanged):
(WebKit::GestureController::ZoomGesture::ZoomGesture):
* UIProcess/gtk/GestureController.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@191787
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
+2015-10-30 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Use RunLoop::Timer instead of GMainLoopSource
+ https://bugs.webkit.org/show_bug.cgi?id=150592
+
+ Reviewed by Žan Doberšek.
+
+ * platform/network/ResourceHandle.h:
+ * platform/network/ResourceHandleInternal.h:
+ (WebCore::ResourceHandleInternal::ResourceHandleInternal):
+ * platform/network/soup/ResourceHandleSoup.cpp:
+ (WebCore::cleanupSoupRequestOperation):
+ (WebCore::ResourceHandle::timeoutFired):
+ (WebCore::ResourceHandle::sendPendingRequest):
+ (WebCore::ResourceHandle::platformSetDefersLoading):
+
2015-10-30 Hunseop Jeong <hs85.jeong@samsung.com>
REGRESSION(r191776): EFL build broken.
static void getConnectionTimingData(NSDictionary *timingData, ResourceLoadTiming&);
#endif
+#if USE(SOUP)
+ void timeoutFired();
+#endif
+
friend class ResourceHandleInternal;
std::unique_ptr<ResourceHandleInternal> d;
#if USE(SOUP)
#include "GUniquePtrSoup.h"
#include <libsoup/soup.h>
-#include <wtf/glib/GMainLoopSource.h>
+#include <wtf/RunLoop.h>
#include <wtf/glib/GRefPtr.h>
#endif
#endif
#if USE(SOUP)
, m_cancelled(false)
+ , m_timeoutSource(RunLoop::main(), loader, &ResourceHandle::timeoutFired)
, m_bodySize(0)
, m_bodyDataSent(0)
, m_redirectCount(0)
GRefPtr<SoupMultipartInputStream> m_multipartInputStream;
GRefPtr<GCancellable> m_cancellable;
GRefPtr<GAsyncResult> m_deferredResult;
- GMainLoopSource m_timeoutSource;
+ RunLoop::Timer<ResourceHandle> m_timeoutSource;
GUniquePtr<SoupBuffer> m_soupBuffer;
unsigned long m_bodySize;
unsigned long m_bodyDataSent;
d->m_soupMessage.clear();
}
- d->m_timeoutSource.cancel();
+ d->m_timeoutSource.stop();
if (!isDestroying)
handle->deref();
return newHandle;
}
+void ResourceHandle::timeoutFired()
+{
+ client()->didFail(this, ResourceError::timeoutError(firstRequest().url().string()));
+ cancel();
+}
+
void ResourceHandle::sendPendingRequest()
{
#if ENABLE(WEB_TIMING)
m_requestTime = monotonicallyIncreasingTime();
#endif
- if (d->m_firstRequest.timeoutInterval() > 0) {
- d->m_timeoutSource.scheduleAfterDelay("[WebKit] ResourceHandle request timeout", [this] {
- client()->didFail(this, ResourceError::timeoutError(firstRequest().url().string()));
- cancel();
- }, std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(d->m_firstRequest.timeoutInterval())),
- G_PRIORITY_DEFAULT, nullptr, g_main_context_get_thread_default());
- }
+ if (d->m_firstRequest.timeoutInterval() > 0)
+ d->m_timeoutSource.startOneShot(d->m_firstRequest.timeoutInterval());
// Balanced by a deref() in cleanupSoupRequestOperation, which should always run.
ref();
// Except when canceling a possible timeout timer, we only need to take action here to UN-defer loading.
if (defersLoading) {
- d->m_timeoutSource.cancel();
+ d->m_timeoutSource.stop();
return;
}
+2015-10-30 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Use RunLoop::Timer instead of GMainLoopSource
+ https://bugs.webkit.org/show_bug.cgi?id=150592
+
+ Reviewed by Žan Doberšek.
+
+ * Shared/Downloads/soup/DownloadSoup.cpp:
+ (WebKit::DownloadClient::DownloadClient):
+ (WebKit::DownloadClient::didReceiveData):
+ (WebKit::DownloadClient::handleResponseLater):
+ * UIProcess/gtk/GestureController.cpp:
+ (WebKit::GestureController::DragGesture::begin):
+ (WebKit::GestureController::DragGesture::update):
+ (WebKit::GestureController::DragGesture::end):
+ (WebKit::GestureController::DragGesture::longPressFired):
+ (WebKit::GestureController::DragGesture::DragGesture):
+ (WebKit::GestureController::ZoomGesture::scaleChanged):
+ (WebKit::GestureController::ZoomGesture::ZoomGesture):
+ * UIProcess/gtk/GestureController.h:
+
2015-10-29 Carlos Garcia Campos <cgarcia@igalia.com>
[GTK] Use a persistent main loop source in RunLoop glib implementation
#include <WebCore/NotImplemented.h>
#include <WebCore/ResourceHandleInternal.h>
#include <gio/gio.h>
-#include <wtf/glib/GMainLoopSource.h>
+#include <wtf/RunLoop.h>
#include <wtf/glib/GRefPtr.h>
#include <wtf/glib/GUniquePtr.h>
#include <wtf/text/CString.h>
public:
DownloadClient(Download* download)
: m_download(download)
+ , m_handleResponseLater(RunLoop::main(), this, &DownloadClient::handleResponse)
, m_allowOverwrite(false)
{
}
void didReceiveData(ResourceHandle*, const char* data, unsigned length, int /*encodedDataLength*/)
{
- if (m_handleResponseLater.isScheduled()) {
- m_handleResponseLater.cancel();
+ if (m_handleResponseLater.isActive()) {
+ m_handleResponseLater.stop();
handleResponse();
}
void handleResponseLater(const ResourceResponse& response)
{
ASSERT(m_response.isNull());
- ASSERT(!m_handleResponseLater.isScheduled());
+ ASSERT(!m_handleResponseLater.isActive());
m_delayedResponse = response;
// Call didReceiveResponse in an idle to make sure the download is added
// to the DownloadManager downloads map.
- m_handleResponseLater.schedule("[WebKit] DownloadHandleResponseLater", std::function<void()>(std::bind(&DownloadClient::handleResponse, this)));
+ m_handleResponseLater.startOneShot(0);
}
Download* m_download;
GRefPtr<GFile> m_destinationFile;
GRefPtr<GFile> m_intermediateFile;
ResourceResponse m_delayedResponse;
- GMainLoopSource m_handleResponseLater;
+ RunLoop::Timer<DownloadClient> m_handleResponseLater;
bool m_allowOverwrite;
};
GtkWidget* widget = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture));
unsigned delay;
g_object_get(gtk_widget_get_settings(widget), "gtk-long-press-time", &delay, nullptr);
- dragGesture->m_longPressTimeout.scheduleAfterDelay("[WebKit] DragGesture long press timeout", [dragGesture]() {
- dragGesture->m_inDrag = true;
- }, std::chrono::milliseconds(delay));
+ dragGesture->m_longPressTimeout.startOneShot(delay / 1000.0);
}
void GestureController::DragGesture::update(DragGesture* dragGesture, double x, double y, GtkGesture* gesture)
GtkWidget* widget = gtk_event_controller_get_widget(GTK_EVENT_CONTROLLER(gesture));
if (!dragGesture->m_inDrag && gtk_drag_check_threshold(widget, dragGesture->m_start.x(), dragGesture->m_start.y(), dragGesture->m_start.x() + x, dragGesture->m_start.y() + y)) {
dragGesture->m_inDrag = true;
- dragGesture->m_longPressTimeout.cancel();
+ dragGesture->m_longPressTimeout.stop();
}
if (dragGesture->m_inDrag)
void GestureController::DragGesture::end(DragGesture* dragGesture, GdkEventSequence* sequence, GtkGesture* gesture)
{
- dragGesture->m_longPressTimeout.cancel();
+ dragGesture->m_longPressTimeout.stop();
if (!dragGesture->m_inDrag) {
dragGesture->handleTap(gtk_gesture_get_last_event(gesture, sequence));
gtk_gesture_set_state(gesture, GTK_EVENT_SEQUENCE_DENIED);
gtk_gesture_set_state(gesture, GTK_EVENT_SEQUENCE_DENIED);
}
+void GestureController::DragGesture::longPressFired()
+{
+ m_inDrag = true;
+}
+
GestureController::DragGesture::DragGesture(WebPageProxy& page)
: Gesture(gtk_gesture_drag_new(page.viewWidget()), page)
+ , m_longPressTimeout(RunLoop::main(), this, &GestureController::DragGesture::longPressFired)
, m_inDrag(false)
{
gtk_gesture_single_set_touch_only(GTK_GESTURE_SINGLE(m_gesture.get()), TRUE);
{
zoomGesture->m_scale = zoomGesture->m_initialScale * scale;
zoomGesture->m_viewPoint = zoomGesture->center();
- if (zoomGesture->m_idle.isScheduled())
+ if (zoomGesture->m_idle.isActive())
return;
- zoomGesture->m_idle.schedule("[WebKit] Zoom Gesture Idle", std::bind(&GestureController::ZoomGesture::handleZoom, zoomGesture));
+ zoomGesture->m_idle.startOneShot(0);
}
GestureController::ZoomGesture::ZoomGesture(WebPageProxy& page)
: Gesture(gtk_gesture_zoom_new(page.viewWidget()), page)
, m_initialScale(0)
, m_scale(0)
+ , m_idle(RunLoop::main(), this, &GestureController::ZoomGesture::handleZoom)
{
g_signal_connect_swapped(m_gesture.get(), "begin", G_CALLBACK(begin), this);
g_signal_connect_swapped(m_gesture.get(), "scale-changed", G_CALLBACK(scaleChanged), this);
#include <WebCore/FloatPoint.h>
#include <wtf/Noncopyable.h>
-#include <wtf/glib/GMainLoopSource.h>
+#include <wtf/RunLoop.h>
#include <wtf/glib/GRefPtr.h>
typedef union _GdkEvent GdkEvent;
private:
void handleDrag(const GdkEvent*, double x, double y);
void handleTap(const GdkEvent*);
+ void longPressFired();
static void begin(DragGesture*, double x, double y, GtkGesture*);
static void update(DragGesture*, double x, double y, GtkGesture*);
WebCore::FloatPoint m_start;
WebCore::FloatPoint m_offset;
- GMainLoopSource m_longPressTimeout;
+ RunLoop::Timer<DragGesture> m_longPressTimeout;
GRefPtr<GtkGesture> m_longPress;
bool m_inDrag;
};
gdouble m_scale;
WebCore::IntPoint m_initialPoint;
WebCore::IntPoint m_viewPoint;
- GMainLoopSource m_idle;
+ RunLoop::Timer<ZoomGesture> m_idle;
};
DragGesture m_dragGesture;