<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[169444] trunk/Source/WebKit2</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/169444">169444</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-05-29 03:33:02 -0700 (Thu, 29 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GTK] Use GMainLoopSource for idle and timeout sources in WebKit2
https://bugs.webkit.org/show_bug.cgi?id=130081
Reviewed by Martin Robinson.
* Platform/WorkQueue.h:
* Platform/gtk/WorkQueueGtk.cpp:
(WorkQueue::registerSocketEventHandler): Stop pretending it's
possible to register a socket event handler for more than one
descriptor.
(WorkQueue::unregisterSocketEventHandler):
(WorkQueue::dispatch):
(WorkQueue::dispatchAfter):
* Shared/Downloads/soup/DownloadSoup.cpp:
(WebKit::DownloadClient::DownloadClient):
(WebKit::DownloadClient::~DownloadClient):
(WebKit::DownloadClient::didReceiveData):
(WebKit::DownloadClient::handleResponse):
(WebKit::DownloadClient::handleResponseLater):
* UIProcess/Plugins/gtk/PluginInfoCache.cpp:
(WebKit::PluginInfoCache::PluginInfoCache):
(WebKit::PluginInfoCache::~PluginInfoCache):
(WebKit::PluginInfoCache::saveToFile):
(WebKit::PluginInfoCache::updatePluginInfo):
* UIProcess/Plugins/gtk/PluginInfoCache.h:
* WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
(WebKit::LayerTreeHostGtk::LayerTreeHostGtk):
(WebKit::LayerTreeHostGtk::layerFlushTimerFired):
(WebKit::LayerTreeHostGtk::scheduleLayerFlush):
(WebKit::LayerTreeHostGtk::cancelPendingLayerFlush):
* WebProcess/WebPage/gtk/LayerTreeHostGtk.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformWorkQueueh">trunk/Source/WebKit2/Platform/WorkQueue.h</a></li>
<li><a href="#trunkSourceWebKit2PlatformgtkWorkQueueGtkcpp">trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedDownloadssoupDownloadSoupcpp">trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPluginsgtkPluginInfoCachecpp">trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessPluginsgtkPluginInfoCacheh">trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagegtkLayerTreeHostGtkcpp">trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagegtkLayerTreeHostGtkh">trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (169443 => 169444)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-29 09:38:27 UTC (rev 169443)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-29 10:33:02 UTC (rev 169444)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2014-05-28 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GTK] Use GMainLoopSource for idle and timeout sources in WebKit2
+ https://bugs.webkit.org/show_bug.cgi?id=130081
+
+ Reviewed by Martin Robinson.
+
+ * Platform/WorkQueue.h:
+ * Platform/gtk/WorkQueueGtk.cpp:
+ (WorkQueue::registerSocketEventHandler): Stop pretending it's
+ possible to register a socket event handler for more than one
+ descriptor.
+ (WorkQueue::unregisterSocketEventHandler):
+ (WorkQueue::dispatch):
+ (WorkQueue::dispatchAfter):
+ * Shared/Downloads/soup/DownloadSoup.cpp:
+ (WebKit::DownloadClient::DownloadClient):
+ (WebKit::DownloadClient::~DownloadClient):
+ (WebKit::DownloadClient::didReceiveData):
+ (WebKit::DownloadClient::handleResponse):
+ (WebKit::DownloadClient::handleResponseLater):
+ * UIProcess/Plugins/gtk/PluginInfoCache.cpp:
+ (WebKit::PluginInfoCache::PluginInfoCache):
+ (WebKit::PluginInfoCache::~PluginInfoCache):
+ (WebKit::PluginInfoCache::saveToFile):
+ (WebKit::PluginInfoCache::updatePluginInfo):
+ * UIProcess/Plugins/gtk/PluginInfoCache.h:
+ * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
+ (WebKit::LayerTreeHostGtk::LayerTreeHostGtk):
+ (WebKit::LayerTreeHostGtk::layerFlushTimerFired):
+ (WebKit::LayerTreeHostGtk::scheduleLayerFlush):
+ (WebKit::LayerTreeHostGtk::cancelPendingLayerFlush):
+ * WebProcess/WebPage/gtk/LayerTreeHostGtk.h:
+
</ins><span class="cx"> 2014-05-28 Gavin Barraclough <baraclough@apple.com>
</span><span class="cx">
</span><span class="cx"> viewStateDidChange should always fully update ViewState
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformWorkQueueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/WorkQueue.h (169443 => 169444)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/WorkQueue.h        2014-05-29 09:38:27 UTC (rev 169443)
+++ trunk/Source/WebKit2/Platform/WorkQueue.h        2014-05-29 10:33:02 UTC (rev 169444)
</span><span class="lines">@@ -45,8 +45,8 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(GTK)
</span><ins>+#include <wtf/gobject/GMainLoopSource.h>
</ins><span class="cx"> #include <wtf/gobject/GRefPtr.h>
</span><del>-typedef gboolean (*GSourceFunc) (gpointer data);
</del><span class="cx"> #elif PLATFORM(EFL)
</span><span class="cx"> #include <DispatchQueueEfl.h>
</span><span class="cx"> #endif
</span><span class="lines">@@ -79,19 +79,14 @@
</span><span class="cx"> static void executeFunction(void*);
</span><span class="cx"> dispatch_queue_t m_dispatchQueue;
</span><span class="cx"> #elif PLATFORM(GTK)
</span><del>- class EventSource;
- class SocketEventSource;
-
</del><span class="cx"> static void startWorkQueueThread(WorkQueue*);
</span><span class="cx"> void workQueueThreadBody();
</span><del>- void dispatchOnSource(GSource*, std::function<void ()>, GSourceFunc);
</del><span class="cx">
</span><span class="cx"> ThreadIdentifier m_workQueueThread;
</span><span class="cx"> GRefPtr<GMainContext> m_eventContext;
</span><span class="cx"> Mutex m_eventLoopLock;
</span><span class="cx"> GRefPtr<GMainLoop> m_eventLoop;
</span><del>- Mutex m_eventSourcesLock;
- HashMap<int, Vector<SocketEventSource*>> m_eventSources;
</del><ins>+ GMainLoopSource m_socketEventSource;
</ins><span class="cx"> #elif PLATFORM(EFL)
</span><span class="cx"> RefPtr<DispatchQueue> m_dispatchQueue;
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformgtkWorkQueueGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp (169443 => 169444)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp        2014-05-29 09:38:27 UTC (rev 169443)
+++ trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp        2014-05-29 10:33:02 UTC (rev 169444)
</span><span class="lines">@@ -29,98 +29,7 @@
</span><span class="cx"> #include "WorkQueue.h"
</span><span class="cx">
</span><span class="cx"> #include <gio/gio.h>
</span><del>-#include <glib.h>
-#include <wtf/gobject/GRefPtr.h>
</del><span class="cx">
</span><del>-// WorkQueue::EventSource
-class WorkQueue::EventSource {
-public:
- EventSource(std::function<void()> function, WorkQueue* workQueue)
- : m_function(std::move(function))
- , m_workQueue(workQueue)
- {
- ASSERT(workQueue);
- }
-
- virtual ~EventSource() { }
-
- void performWork()
- {
- m_function();
- }
-
- static gboolean performWorkOnce(EventSource* eventSource)
- {
- ASSERT(eventSource);
- eventSource->performWork();
- return FALSE;
- }
-
- static void deleteEventSource(EventSource* eventSource)
- {
- ASSERT(eventSource);
- delete eventSource;
- }
-
-private:
- std::function<void ()> m_function;
- RefPtr<WorkQueue> m_workQueue;
-};
-
-class WorkQueue::SocketEventSource : public WorkQueue::EventSource {
-public:
- SocketEventSource(std::function<void ()> function, WorkQueue* workQueue, GCancellable* cancellable, std::function<void ()> closeFunction)
- : EventSource(std::move(function), workQueue)
- , m_cancellable(cancellable)
- , m_closeFunction(std::move(closeFunction))
- {
- ASSERT(cancellable);
- }
-
- void cancel()
- {
- g_cancellable_cancel(m_cancellable);
- }
-
- void didClose()
- {
- m_closeFunction();
- }
-
- bool isCancelled() const
- {
- return g_cancellable_is_cancelled(m_cancellable);
- }
-
- static gboolean eventCallback(GSocket*, GIOCondition condition, SocketEventSource* eventSource)
- {
- ASSERT(eventSource);
-
- if (eventSource->isCancelled()) {
- // EventSource has been cancelled, return FALSE to destroy the source.
- return FALSE;
- }
-
- if (condition & G_IO_HUP || condition & G_IO_ERR || condition & G_IO_NVAL) {
- eventSource->didClose();
- return FALSE;
- }
-
- if (condition & G_IO_IN) {
- eventSource->performWork();
- return TRUE;
- }
-
- ASSERT_NOT_REACHED();
- return FALSE;
- }
-
-private:
- GCancellable* m_cancellable;
- std::function<void ()> m_closeFunction;
-};
-
-// WorkQueue
</del><span class="cx"> static const size_t kVisualStudioThreadNameLimit = 31;
</span><span class="cx">
</span><span class="cx"> void WorkQueue::platformInitialize(const char* name)
</span><span class="lines">@@ -172,69 +81,40 @@
</span><span class="cx"> void WorkQueue::registerSocketEventHandler(int fileDescriptor, std::function<void ()> function, std::function<void ()> closeFunction)
</span><span class="cx"> {
</span><span class="cx"> GRefPtr<GSocket> socket = adoptGRef(g_socket_new_from_fd(fileDescriptor, 0));
</span><del>- ASSERT(socket);
- GRefPtr<GCancellable> cancellable = adoptGRef(g_cancellable_new());
- GRefPtr<GSource> dispatchSource = adoptGRef(g_socket_create_source(socket.get(), G_IO_IN, cancellable.get()));
- ASSERT(dispatchSource);
- SocketEventSource* eventSource = new SocketEventSource(std::move(function), this,
- cancellable.get(), std::move(closeFunction));
</del><ins>+ ref();
+ m_socketEventSource.schedule("[WebKit] WorkQueue::SocketEventHandler", [function, closeFunction](GIOCondition condition) {
+ if (condition & G_IO_HUP || condition & G_IO_ERR || condition & G_IO_NVAL) {
+ closeFunction();
+ return GMainLoopSource::Stop;
+ }
</ins><span class="cx">
</span><del>- g_source_set_callback(dispatchSource.get(), reinterpret_cast<GSourceFunc>(&WorkQueue::SocketEventSource::eventCallback),
- eventSource, reinterpret_cast<GDestroyNotify>(&WorkQueue::EventSource::deleteEventSource));
</del><ins>+ if (condition & G_IO_IN) {
+ function();
+ return GMainLoopSource::Continue;
+ }
</ins><span class="cx">
</span><del>- // Set up the event sources under the mutex since this is shared across multiple threads.
- {
- MutexLocker locker(m_eventSourcesLock);
- Vector<SocketEventSource*> sources;
- auto it = m_eventSources.find(fileDescriptor);
- if (it != m_eventSources.end())
- sources = it->value;
-
- sources.append(eventSource);
- m_eventSources.set(fileDescriptor, sources);
- }
-
- g_source_attach(dispatchSource.get(), m_eventContext.get());
</del><ins>+ ASSERT_NOT_REACHED();
+ return GMainLoopSource::Stop;
+ }, socket.get(), G_IO_IN,
+ [this] { deref(); },
+ m_eventContext.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WorkQueue::unregisterSocketEventHandler(int fileDescriptor)
</del><ins>+void WorkQueue::unregisterSocketEventHandler(int)
</ins><span class="cx"> {
</span><del>- ASSERT(fileDescriptor);
-
- MutexLocker locker(m_eventSourcesLock);
-
- ASSERT(m_eventSources.contains(fileDescriptor));
- auto it = m_eventSources.find(fileDescriptor);
-
- if (it != m_eventSources.end()) {
- Vector<SocketEventSource*> sources = it->value;
- for (unsigned i = 0; i < sources.size(); i++)
- sources[i]->cancel();
-
- m_eventSources.remove(it);
- }
</del><ins>+ m_socketEventSource.cancel();
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WorkQueue::dispatchOnSource(GSource* dispatchSource, std::function<void ()> function, GSourceFunc sourceCallback)
-{
- g_source_set_callback(dispatchSource, sourceCallback, new EventSource(std::move(function), this),
- reinterpret_cast<GDestroyNotify>(&WorkQueue::EventSource::deleteEventSource));
-
- g_source_attach(dispatchSource, m_eventContext.get());
-}
-
</del><span class="cx"> void WorkQueue::dispatch(std::function<void ()> function)
</span><span class="cx"> {
</span><del>- GRefPtr<GSource> dispatchSource = adoptGRef(g_idle_source_new());
- g_source_set_priority(dispatchSource.get(), G_PRIORITY_DEFAULT);
- dispatchOnSource(dispatchSource.get(), std::move(function),
- reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnce));
</del><ins>+ ref();
+ GMainLoopSource::createAndDeleteOnDestroy().schedule("[WebKit] WorkQueue::dispatch", std::move(function), G_PRIORITY_DEFAULT,
+ [this] { deref(); }, m_eventContext.get());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WorkQueue::dispatchAfter(std::chrono::nanoseconds duration, std::function<void ()> function)
</span><span class="cx"> {
</span><del>- GRefPtr<GSource> dispatchSource = adoptGRef(g_timeout_source_new(
- static_cast<guint>(std::chrono::duration_cast<std::chrono::milliseconds>(duration).count())));
- dispatchOnSource(dispatchSource.get(), std::move(function),
- reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnce));
</del><ins>+ ref();
+ GMainLoopSource::createAndDeleteOnDestroy().scheduleAfterDelay("[WebKit] WorkQueue::dispatchAfter", std::move(function),
+ std::chrono::duration_cast<std::chrono::milliseconds>(duration), G_PRIORITY_DEFAULT, [this] { deref(); }, m_eventContext.get());
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedDownloadssoupDownloadSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp (169443 => 169444)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp        2014-05-29 09:38:27 UTC (rev 169443)
+++ trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp        2014-05-29 10:33:02 UTC (rev 169444)
</span><span class="lines">@@ -32,6 +32,7 @@
</span><span class="cx"> #include <WebCore/NotImplemented.h>
</span><span class="cx"> #include <WebCore/ResourceHandleInternal.h>
</span><span class="cx"> #include <gio/gio.h>
</span><ins>+#include <wtf/gobject/GMainLoopSource.h>
</ins><span class="cx"> #include <wtf/gobject/GRefPtr.h>
</span><span class="cx"> #include <wtf/gobject/GUniquePtr.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="lines">@@ -49,14 +50,11 @@
</span><span class="cx"> public:
</span><span class="cx"> DownloadClient(Download* download)
</span><span class="cx"> : m_download(download)
</span><del>- , m_handleResponseLaterID(0)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ~DownloadClient()
</span><span class="cx"> {
</span><del>- if (m_handleResponseLaterID)
- g_source_remove(m_handleResponseLaterID);
</del><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void deleteIntermediateFileInNeeded()
</span><span class="lines">@@ -117,8 +115,8 @@
</span><span class="cx">
</span><span class="cx"> void didReceiveData(ResourceHandle*, const char* data, unsigned length, int /*encodedDataLength*/)
</span><span class="cx"> {
</span><del>- if (m_handleResponseLaterID) {
- g_source_remove(m_handleResponseLaterID);
</del><ins>+ if (m_handleResponseLater.isScheduled()) {
+ m_handleResponseLater.cancel();
</ins><span class="cx"> handleResponse();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -177,26 +175,19 @@
</span><span class="cx">
</span><span class="cx"> void handleResponse()
</span><span class="cx"> {
</span><del>- m_handleResponseLaterID = 0;
- didReceiveResponse(0, m_delayedResponse);
</del><ins>+ didReceiveResponse(nullptr, m_delayedResponse);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>- static gboolean handleResponseLaterCallback(DownloadClient* downloadClient)
- {
- downloadClient->handleResponse();
- return FALSE;
- }
-
</del><span class="cx"> void handleResponseLater(const ResourceResponse& response)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_response.isNull());
</span><del>- ASSERT(!m_handleResponseLaterID);
</del><ins>+ ASSERT(!m_handleResponseLater.isScheduled());
</ins><span class="cx">
</span><span class="cx"> m_delayedResponse = response;
</span><span class="cx">
</span><span class="cx"> // Call didReceiveResponse in an idle to make sure the download is added
</span><span class="cx"> // to the DownloadManager downloads map.
</span><del>- m_handleResponseLaterID = g_idle_add_full(G_PRIORITY_DEFAULT, reinterpret_cast<GSourceFunc>(handleResponseLaterCallback), this, 0);
</del><ins>+ m_handleResponseLater.schedule("[WebKit] DownloadHandleResponseLater", std::bind(&DownloadClient::handleResponse, this));
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Download* m_download;
</span><span class="lines">@@ -205,7 +196,7 @@
</span><span class="cx"> String m_destinationURI;
</span><span class="cx"> GRefPtr<GFile> m_intermediateFile;
</span><span class="cx"> ResourceResponse m_delayedResponse;
</span><del>- unsigned m_handleResponseLaterID;
</del><ins>+ GMainLoopSource m_handleResponseLater;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> void Download::start()
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPluginsgtkPluginInfoCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.cpp (169443 => 169444)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.cpp        2014-05-29 09:38:27 UTC (rev 169443)
+++ trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.cpp        2014-05-29 10:33:02 UTC (rev 169444)
</span><span class="lines">@@ -45,7 +45,6 @@
</span><span class="cx"> PluginInfoCache::PluginInfoCache()
</span><span class="cx"> : m_cacheFile(g_key_file_new())
</span><span class="cx"> , m_cachePath(g_build_filename(g_get_user_cache_dir(), "webkitgtk", "plugins", nullptr))
</span><del>- , m_saveToFileIdleId(0)
</del><span class="cx"> {
</span><span class="cx"> g_key_file_load_from_file(m_cacheFile.get(), m_cachePath.get(), G_KEY_FILE_NONE, nullptr);
</span><span class="cx">
</span><span class="lines">@@ -63,22 +62,15 @@
</span><span class="cx">
</span><span class="cx"> PluginInfoCache::~PluginInfoCache()
</span><span class="cx"> {
</span><del>- if (m_saveToFileIdleId) {
- g_source_remove(m_saveToFileIdleId);
</del><ins>+ if (m_saveToFileIdle.isScheduled()) {
+ m_saveToFileIdle.cancel();
</ins><span class="cx"> saveToFile();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><del>-gboolean PluginInfoCache::saveToFileIdleCallback(PluginInfoCache* cache)
-{
- cache->saveToFile();
- return FALSE;
-}
-
</del><span class="cx"> void PluginInfoCache::saveToFile()
</span><span class="cx"> {
</span><span class="cx"> std::lock_guard<std::mutex> lock(m_mutex);
</span><del>- m_saveToFileIdleId = 0;
</del><span class="cx">
</span><span class="cx"> gsize dataLength;
</span><span class="cx"> GUniquePtr<char> data(g_key_file_to_data(m_cacheFile.get(), &dataLength, nullptr));
</span><span class="lines">@@ -141,10 +133,10 @@
</span><span class="cx"> // Save the cache file in an idle to make sure it happens in the main thread and
</span><span class="cx"> // it's done only once when this is called multiple times in a very short time.
</span><span class="cx"> std::lock_guard<std::mutex> lock(m_mutex);
</span><del>- if (m_saveToFileIdleId)
</del><ins>+ if (m_saveToFileIdle.isScheduled())
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- m_saveToFileIdleId = g_idle_add(reinterpret_cast<GSourceFunc>(PluginInfoCache::saveToFileIdleCallback), this);
</del><ins>+ m_saveToFileIdle.schedule("[WebKit] PluginInfoCache::saveToFile", std::bind(&PluginInfoCache::saveToFile, this), G_PRIORITY_DEFAULT_IDLE);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessPluginsgtkPluginInfoCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.h (169443 => 169444)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.h        2014-05-29 09:38:27 UTC (rev 169443)
+++ trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.h        2014-05-29 10:33:02 UTC (rev 169444)
</span><span class="lines">@@ -31,6 +31,7 @@
</span><span class="cx"> #include "PluginModuleInfo.h"
</span><span class="cx"> #include <mutex>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><ins>+#include <wtf/gobject/GMainLoopSource.h>
</ins><span class="cx"> #include <wtf/gobject/GUniquePtr.h>
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -49,11 +50,10 @@
</span><span class="cx"> ~PluginInfoCache();
</span><span class="cx">
</span><span class="cx"> void saveToFile();
</span><del>- static gboolean saveToFileIdleCallback(PluginInfoCache*);
</del><span class="cx">
</span><span class="cx"> GUniquePtr<GKeyFile> m_cacheFile;
</span><span class="cx"> GUniquePtr<char> m_cachePath;
</span><del>- unsigned m_saveToFileIdleId;
</del><ins>+ GMainLoopSource m_saveToFileIdle;
</ins><span class="cx"> std::mutex m_mutex;
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagegtkLayerTreeHostGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp (169443 => 169444)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp        2014-05-29 09:38:27 UTC (rev 169443)
+++ trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp        2014-05-29 10:33:02 UTC (rev 169444)
</span><span class="lines">@@ -74,7 +74,6 @@
</span><span class="cx"> , m_notifyAfterScheduledLayerFlush(false)
</span><span class="cx"> , m_lastFlushTime(0)
</span><span class="cx"> , m_layerFlushSchedulingEnabled(true)
</span><del>- , m_layerFlushTimerCallbackId(0)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -282,24 +281,15 @@
</span><span class="cx"> // FIXME: Draw page overlays. https://bugs.webkit.org/show_bug.cgi?id=131433.
</span><span class="cx"> }
</span><span class="cx">
</span><del>-gboolean LayerTreeHostGtk::layerFlushTimerFiredCallback(LayerTreeHostGtk* layerTreeHost)
-{
- layerTreeHost->layerFlushTimerFired();
- return FALSE;
-}
-
</del><span class="cx"> void LayerTreeHostGtk::layerFlushTimerFired()
</span><span class="cx"> {
</span><del>- ASSERT(m_layerFlushTimerCallbackId);
- m_layerFlushTimerCallbackId = 0;
-
</del><span class="cx"> flushAndRenderLayers();
</span><span class="cx">
</span><del>- if (toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations() && !m_layerFlushTimerCallbackId) {
</del><ins>+ if (!m_layerFlushTimerCallback.isScheduled() && toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations()) {
</ins><span class="cx"> const double targetFPS = 60;
</span><span class="cx"> double nextFlush = std::max((1 / targetFPS) - (currentTime() - m_lastFlushTime), 0.0);
</span><del>- m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, nextFlush * 1000.0, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
- g_source_set_name_by_id(m_layerFlushTimerCallbackId, "[WebKit] layerFlushTimerFiredCallback");
</del><ins>+ m_layerFlushTimerCallback.scheduleAfterDelay("[WebKit] layerFlushTimer", std::bind(&LayerTreeHostGtk::layerFlushTimerFired, this),
+ std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::duration<double>(nextFlush)), GDK_PRIORITY_EVENTS);
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -398,10 +388,8 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> // We use a GLib timer because otherwise GTK+ event handling during dragging can starve WebCore timers, which have a lower priority.
</span><del>- if (!m_layerFlushTimerCallbackId) {
- m_layerFlushTimerCallbackId = g_timeout_add_full(GDK_PRIORITY_EVENTS, 0, reinterpret_cast<GSourceFunc>(layerFlushTimerFiredCallback), this, 0);
- g_source_set_name_by_id(m_layerFlushTimerCallbackId, "[WebKit] layerFlushTimerFiredCallback");
- }
</del><ins>+ if (!m_layerFlushTimerCallback.isScheduled())
+ m_layerFlushTimerCallback.schedule("[WebKit] layerFlushTimer", std::bind(&LayerTreeHostGtk::layerFlushTimerFired, this), GDK_PRIORITY_EVENTS);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void LayerTreeHostGtk::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled)
</span><span class="lines">@@ -426,11 +414,7 @@
</span><span class="cx">
</span><span class="cx"> void LayerTreeHostGtk::cancelPendingLayerFlush()
</span><span class="cx"> {
</span><del>- if (!m_layerFlushTimerCallbackId)
- return;
-
- g_source_remove(m_layerFlushTimerCallbackId);
- m_layerFlushTimerCallbackId = 0;
</del><ins>+ m_layerFlushTimerCallback.cancel();
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagegtkLayerTreeHostGtkh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h (169443 => 169444)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h        2014-05-29 09:38:27 UTC (rev 169443)
+++ trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h        2014-05-29 10:33:02 UTC (rev 169444)
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #include <WebCore/GraphicsLayerClient.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/OwnPtr.h>
</span><ins>+#include <wtf/gobject/GMainLoopSource.h>
</ins><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="lines">@@ -92,7 +93,6 @@
</span><span class="cx"> void cancelPendingLayerFlush();
</span><span class="cx">
</span><span class="cx"> void layerFlushTimerFired();
</span><del>- static gboolean layerFlushTimerFiredCallback(LayerTreeHostGtk*);
</del><span class="cx">
</span><span class="cx"> WebCore::GLContext* glContext();
</span><span class="cx">
</span><span class="lines">@@ -107,7 +107,7 @@
</span><span class="cx"> OwnPtr<WebCore::GLContext> m_context;
</span><span class="cx"> double m_lastFlushTime;
</span><span class="cx"> bool m_layerFlushSchedulingEnabled;
</span><del>- unsigned m_layerFlushTimerCallbackId;
</del><ins>+ GMainLoopSource m_layerFlushTimerCallback;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>
</body>
</html>