<!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>[169424] 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/169424">169424</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-05-28 09:22:15 -0700 (Wed, 28 May 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>Unreviewed, rolling out <a href="http://trac.webkit.org/projects/webkit/changeset/169423">r169423</a>.
https://bugs.webkit.org/show_bug.cgi?id=133348
It makes a lot of tests crash in assert (Requested by KaL on
#webkit).
Reverted changeset:
"[GTK] Use GMainLoopSource for idle and timeout sources in
WebKit2"
https://bugs.webkit.org/show_bug.cgi?id=130081
http://trac.webkit.org/changeset/169423</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 (169423 => 169424)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-28 15:34:53 UTC (rev 169423)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-28 16:22:15 UTC (rev 169424)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-05-28 Commit Queue <commit-queue@webkit.org>
+
+ Unreviewed, rolling out r169423.
+ https://bugs.webkit.org/show_bug.cgi?id=133348
+
+ It makes a lot of tests crash in assert (Requested by KaL on
+ #webkit).
+
+ Reverted changeset:
+
+ "[GTK] Use GMainLoopSource for idle and timeout sources in
+ WebKit2"
+ https://bugs.webkit.org/show_bug.cgi?id=130081
+ http://trac.webkit.org/changeset/169423
+
</ins><span class="cx"> 2014-05-28 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Use GMainLoopSource for idle and timeout sources in WebKit2
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformWorkQueueh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/WorkQueue.h (169423 => 169424)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/WorkQueue.h        2014-05-28 15:34:53 UTC (rev 169423)
+++ trunk/Source/WebKit2/Platform/WorkQueue.h        2014-05-28 16:22:15 UTC (rev 169424)
</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><del>-#include <wtf/gobject/GMainLoopSource.h>
</del><span class="cx"> #include <wtf/gobject/GRefPtr.h>
</span><ins>+typedef gboolean (*GSourceFunc) (gpointer data);
</ins><span class="cx"> #elif PLATFORM(EFL)
</span><span class="cx"> #include <DispatchQueueEfl.h>
</span><span class="cx"> #endif
</span><span class="lines">@@ -79,14 +79,19 @@
</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><ins>+ class EventSource;
+ class SocketEventSource;
+
</ins><span class="cx"> static void startWorkQueueThread(WorkQueue*);
</span><span class="cx"> void workQueueThreadBody();
</span><ins>+ void dispatchOnSource(GSource*, std::function<void ()>, GSourceFunc);
</ins><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>- GMainLoopSource m_socketEventSource;
</del><ins>+ Mutex m_eventSourcesLock;
+ HashMap<int, Vector<SocketEventSource*>> m_eventSources;
</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 (169423 => 169424)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp        2014-05-28 15:34:53 UTC (rev 169423)
+++ trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp        2014-05-28 16:22:15 UTC (rev 169424)
</span><span class="lines">@@ -29,7 +29,98 @@
</span><span class="cx"> #include "WorkQueue.h"
</span><span class="cx">
</span><span class="cx"> #include <gio/gio.h>
</span><ins>+#include <glib.h>
+#include <wtf/gobject/GRefPtr.h>
</ins><span class="cx">
</span><ins>+// 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
</ins><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">@@ -81,40 +172,69 @@
</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>- 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;
- }
</del><ins>+ 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));
</ins><span class="cx">
</span><del>- if (condition & G_IO_IN) {
- function();
- return GMainLoopSource::Continue;
- }
</del><ins>+ g_source_set_callback(dispatchSource.get(), reinterpret_cast<GSourceFunc>(&WorkQueue::SocketEventSource::eventCallback),
+ eventSource, reinterpret_cast<GDestroyNotify>(&WorkQueue::EventSource::deleteEventSource));
</ins><span class="cx">
</span><del>- ASSERT_NOT_REACHED();
- return GMainLoopSource::Stop;
- }, socket.get(), G_IO_IN,
- [this] { deref(); },
- m_eventContext.get());
</del><ins>+ // 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());
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-void WorkQueue::unregisterSocketEventHandler(int)
</del><ins>+void WorkQueue::unregisterSocketEventHandler(int fileDescriptor)
</ins><span class="cx"> {
</span><del>- m_socketEventSource.cancel();
</del><ins>+ 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);
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+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());
+}
+
</ins><span class="cx"> void WorkQueue::dispatch(std::function<void ()> function)
</span><span class="cx"> {
</span><del>- ref();
- GMainLoopSource::createAndDeleteOnDestroy().schedule("[WebKit] WorkQueue::dispatch", std::move(function), G_PRIORITY_DEFAULT,
- [this] { deref(); }, m_eventContext.get());
</del><ins>+ 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));
</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>- 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());
</del><ins>+ 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));
</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 (169423 => 169424)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp        2014-05-28 15:34:53 UTC (rev 169423)
+++ trunk/Source/WebKit2/Shared/Downloads/soup/DownloadSoup.cpp        2014-05-28 16:22:15 UTC (rev 169424)
</span><span class="lines">@@ -32,7 +32,6 @@
</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><del>-#include <wtf/gobject/GMainLoopSource.h>
</del><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">@@ -50,11 +49,14 @@
</span><span class="cx"> public:
</span><span class="cx"> DownloadClient(Download* download)
</span><span class="cx"> : m_download(download)
</span><ins>+ , m_handleResponseLaterID(0)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ~DownloadClient()
</span><span class="cx"> {
</span><ins>+ if (m_handleResponseLaterID)
+ g_source_remove(m_handleResponseLaterID);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void deleteIntermediateFileInNeeded()
</span><span class="lines">@@ -115,8 +117,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_handleResponseLater.isScheduled()) {
- m_handleResponseLater.cancel();
</del><ins>+ if (m_handleResponseLaterID) {
+ g_source_remove(m_handleResponseLaterID);
</ins><span class="cx"> handleResponse();
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -175,19 +177,26 @@
</span><span class="cx">
</span><span class="cx"> void handleResponse()
</span><span class="cx"> {
</span><del>- didReceiveResponse(nullptr, m_delayedResponse);
</del><ins>+ m_handleResponseLaterID = 0;
+ didReceiveResponse(0, m_delayedResponse);
</ins><span class="cx"> }
</span><span class="cx">
</span><ins>+ static gboolean handleResponseLaterCallback(DownloadClient* downloadClient)
+ {
+ downloadClient->handleResponse();
+ return FALSE;
+ }
+
</ins><span class="cx"> void handleResponseLater(const ResourceResponse& response)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_response.isNull());
</span><del>- ASSERT(!m_handleResponseLater.isScheduled());
</del><ins>+ ASSERT(!m_handleResponseLaterID);
</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_handleResponseLater.schedule("[WebKit] DownloadHandleResponseLater", std::bind(&DownloadClient::handleResponse, this));
</del><ins>+ m_handleResponseLaterID = g_idle_add_full(G_PRIORITY_DEFAULT, reinterpret_cast<GSourceFunc>(handleResponseLaterCallback), this, 0);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> Download* m_download;
</span><span class="lines">@@ -196,7 +205,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>- GMainLoopSource m_handleResponseLater;
</del><ins>+ unsigned m_handleResponseLaterID;
</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 (169423 => 169424)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.cpp        2014-05-28 15:34:53 UTC (rev 169423)
+++ trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.cpp        2014-05-28 16:22:15 UTC (rev 169424)
</span><span class="lines">@@ -45,6 +45,7 @@
</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><ins>+ , m_saveToFileIdleId(0)
</ins><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">@@ -62,15 +63,22 @@
</span><span class="cx">
</span><span class="cx"> PluginInfoCache::~PluginInfoCache()
</span><span class="cx"> {
</span><del>- if (m_saveToFileIdle.isScheduled()) {
- m_saveToFileIdle.cancel();
</del><ins>+ if (m_saveToFileIdleId) {
+ g_source_remove(m_saveToFileIdleId);
</ins><span class="cx"> saveToFile();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+gboolean PluginInfoCache::saveToFileIdleCallback(PluginInfoCache* cache)
+{
+ cache->saveToFile();
+ return FALSE;
+}
+
</ins><span class="cx"> void PluginInfoCache::saveToFile()
</span><span class="cx"> {
</span><span class="cx"> std::lock_guard<std::mutex> lock(m_mutex);
</span><ins>+ m_saveToFileIdleId = 0;
</ins><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">@@ -133,10 +141,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_saveToFileIdle.isScheduled())
</del><ins>+ if (m_saveToFileIdleId)
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- m_saveToFileIdle.schedule("[WebKit] PluginInfoCache::saveToFile", std::bind(&PluginInfoCache::saveToFile, this), G_PRIORITY_DEFAULT_IDLE);
</del><ins>+ m_saveToFileIdleId = g_idle_add(reinterpret_cast<GSourceFunc>(PluginInfoCache::saveToFileIdleCallback), this);
</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 (169423 => 169424)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.h        2014-05-28 15:34:53 UTC (rev 169423)
+++ trunk/Source/WebKit2/UIProcess/Plugins/gtk/PluginInfoCache.h        2014-05-28 16:22:15 UTC (rev 169424)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #include "PluginModuleInfo.h"
</span><span class="cx"> #include <mutex>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><del>-#include <wtf/gobject/GMainLoopSource.h>
</del><span class="cx"> #include <wtf/gobject/GUniquePtr.h>
</span><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -50,10 +49,11 @@
</span><span class="cx"> ~PluginInfoCache();
</span><span class="cx">
</span><span class="cx"> void saveToFile();
</span><ins>+ static gboolean saveToFileIdleCallback(PluginInfoCache*);
</ins><span class="cx">
</span><span class="cx"> GUniquePtr<GKeyFile> m_cacheFile;
</span><span class="cx"> GUniquePtr<char> m_cachePath;
</span><del>- GMainLoopSource m_saveToFileIdle;
</del><ins>+ unsigned m_saveToFileIdleId;
</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 (169423 => 169424)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp        2014-05-28 15:34:53 UTC (rev 169423)
+++ trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp        2014-05-28 16:22:15 UTC (rev 169424)
</span><span class="lines">@@ -74,6 +74,7 @@
</span><span class="cx"> , m_notifyAfterScheduledLayerFlush(false)
</span><span class="cx"> , m_lastFlushTime(0)
</span><span class="cx"> , m_layerFlushSchedulingEnabled(true)
</span><ins>+ , m_layerFlushTimerCallbackId(0)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -281,15 +282,24 @@
</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><ins>+gboolean LayerTreeHostGtk::layerFlushTimerFiredCallback(LayerTreeHostGtk* layerTreeHost)
+{
+ layerTreeHost->layerFlushTimerFired();
+ return FALSE;
+}
+
</ins><span class="cx"> void LayerTreeHostGtk::layerFlushTimerFired()
</span><span class="cx"> {
</span><ins>+ ASSERT(m_layerFlushTimerCallbackId);
+ m_layerFlushTimerCallbackId = 0;
+
</ins><span class="cx"> flushAndRenderLayers();
</span><span class="cx">
</span><del>- if (!m_layerFlushTimerCallback.isScheduled() && toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations()) {
</del><ins>+ if (toTextureMapperLayer(m_rootLayer.get())->descendantsOrSelfHaveRunningAnimations() && !m_layerFlushTimerCallbackId) {
</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_layerFlushTimerCallback.scheduleAfterDelay("[WebKit] layerFlushTimer", std::bind(&LayerTreeHostGtk::layerFlushTimerFired, this),
- std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::duration<double>(nextFlush)), GDK_PRIORITY_EVENTS);
</del><ins>+ 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");
</ins><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -388,8 +398,10 @@
</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_layerFlushTimerCallback.isScheduled())
- m_layerFlushTimerCallback.schedule("[WebKit] layerFlushTimer", std::bind(&LayerTreeHostGtk::layerFlushTimerFired, this), GDK_PRIORITY_EVENTS);
</del><ins>+ 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");
+ }
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void LayerTreeHostGtk::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled)
</span><span class="lines">@@ -414,7 +426,11 @@
</span><span class="cx">
</span><span class="cx"> void LayerTreeHostGtk::cancelPendingLayerFlush()
</span><span class="cx"> {
</span><del>- m_layerFlushTimerCallback.cancel();
</del><ins>+ if (!m_layerFlushTimerCallbackId)
+ return;
+
+ g_source_remove(m_layerFlushTimerCallbackId);
+ m_layerFlushTimerCallbackId = 0;
</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 (169423 => 169424)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h        2014-05-28 15:34:53 UTC (rev 169423)
+++ trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h        2014-05-28 16:22:15 UTC (rev 169424)
</span><span class="lines">@@ -36,7 +36,6 @@
</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><del>-#include <wtf/gobject/GMainLoopSource.h>
</del><span class="cx">
</span><span class="cx"> namespace WebKit {
</span><span class="cx">
</span><span class="lines">@@ -93,6 +92,7 @@
</span><span class="cx"> void cancelPendingLayerFlush();
</span><span class="cx">
</span><span class="cx"> void layerFlushTimerFired();
</span><ins>+ static gboolean layerFlushTimerFiredCallback(LayerTreeHostGtk*);
</ins><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>- GMainLoopSource m_layerFlushTimerCallback;
</del><ins>+ unsigned m_layerFlushTimerCallbackId;
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>
</body>
</html>