<!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>[191881] trunk/Source</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/191881">191881</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-11-02 01:33:28 -0800 (Mon, 02 Nov 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GLIB] Remove support for GSocket main loop sources from GMainLoopSource
https://bugs.webkit.org/show_bug.cgi?id=150772
Reviewed by Žan Doberšek.
Source/WebKit2:
Add GSocketMonitor class to be used by Connection to monitor the
availability of the socket file descriptor instead of using a
GMainLoopSource.
* Platform/IPC/Connection.h:
* Platform/IPC/glib/GSocketMonitor.cpp: Added.
(IPC::GSocketMonitor::~GSocketMonitor):
(IPC::GSocketMonitor::socketSourceCallback):
(IPC::GSocketMonitor::start):
(IPC::GSocketMonitor::stop):
* Platform/IPC/glib/GSocketMonitor.h: Added.
* Platform/IPC/unix/ConnectionUnix.cpp:
(IPC::Connection::platformInvalidate):
(IPC::Connection::open):
* PlatformGTK.cmake:
Source/WTF:
It complicated the code just to make generic what is only used in
one place.
* wtf/glib/GMainLoopSource.cpp:
(WTF::GMainLoopSource::cancel): Deleted.
(WTF::GMainLoopSource::schedule): Deleted.
(WTF::GMainLoopSource::scheduleTimeoutSource): Deleted.
(WTF::GMainLoopSource::scheduleAfterDelay): Deleted.
(WTF::GMainLoopSource::finishVoidCallback): Deleted.
(WTF::GMainLoopSource::voidCallback): Deleted.
(WTF::GMainLoopSource::prepareBoolCallback): Deleted.
* wtf/glib/GMainLoopSource.h:
(WTF::GMainLoopSource::Context::operator=): Deleted.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfglibGMainLoopSourcecpp">trunk/Source/WTF/wtf/glib/GMainLoopSource.cpp</a></li>
<li><a href="#trunkSourceWTFwtfglibGMainLoopSourceh">trunk/Source/WTF/wtf/glib/GMainLoopSource.h</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCConnectionh">trunk/Source/WebKit2/Platform/IPC/Connection.h</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCunixConnectionUnixcpp">trunk/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp</a></li>
<li><a href="#trunkSourceWebKit2PlatformGTKcmake">trunk/Source/WebKit2/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li>trunk/Source/WebKit2/Platform/IPC/glib/</li>
<li><a href="#trunkSourceWebKit2PlatformIPCglibGSocketMonitorcpp">trunk/Source/WebKit2/Platform/IPC/glib/GSocketMonitor.cpp</a></li>
<li><a href="#trunkSourceWebKit2PlatformIPCglibGSocketMonitorh">trunk/Source/WebKit2/Platform/IPC/glib/GSocketMonitor.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (191880 => 191881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-11-02 09:15:39 UTC (rev 191880)
+++ trunk/Source/WTF/ChangeLog        2015-11-02 09:33:28 UTC (rev 191881)
</span><span class="lines">@@ -1,5 +1,26 @@
</span><span class="cx"> 2015-11-02 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><ins>+ [GLIB] Remove support for GSocket main loop sources from GMainLoopSource
+ https://bugs.webkit.org/show_bug.cgi?id=150772
+
+ Reviewed by Žan Doberšek.
+
+ It complicated the code just to make generic what is only used in
+ one place.
+
+ * wtf/glib/GMainLoopSource.cpp:
+ (WTF::GMainLoopSource::cancel): Deleted.
+ (WTF::GMainLoopSource::schedule): Deleted.
+ (WTF::GMainLoopSource::scheduleTimeoutSource): Deleted.
+ (WTF::GMainLoopSource::scheduleAfterDelay): Deleted.
+ (WTF::GMainLoopSource::finishVoidCallback): Deleted.
+ (WTF::GMainLoopSource::voidCallback): Deleted.
+ (WTF::GMainLoopSource::prepareBoolCallback): Deleted.
+ * wtf/glib/GMainLoopSource.h:
+ (WTF::GMainLoopSource::Context::operator=): Deleted.
+
+2015-11-02 Carlos Garcia Campos <cgarcia@igalia.com>
+
</ins><span class="cx"> [GLIB] Remove delete on destroy GMainLoopSources
</span><span class="cx"> https://bugs.webkit.org/show_bug.cgi?id=150771
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWTFwtfglibGMainLoopSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/glib/GMainLoopSource.cpp (191880 => 191881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/glib/GMainLoopSource.cpp        2015-11-02 09:15:39 UTC (rev 191880)
+++ trunk/Source/WTF/wtf/glib/GMainLoopSource.cpp        2015-11-02 09:33:28 UTC (rev 191881)
</span><span class="lines">@@ -54,8 +54,6 @@
</span><span class="cx">
</span><span class="cx"> m_status = Ready;
</span><span class="cx">
</span><del>- g_cancellable_cancel(m_context.socketCancellable.get());
-
</del><span class="cx"> if (!m_context.source)
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="lines">@@ -84,10 +82,8 @@
</span><span class="cx"> m_context = {
</span><span class="cx"> adoptGRef(g_idle_source_new()),
</span><span class="cx"> nullptr, // cancellable
</span><del>- nullptr, // socketCancellable
</del><span class="cx"> WTF::move(function),
</span><span class="cx"> nullptr, // boolCallback
</span><del>- nullptr, // socketCallback
</del><span class="cx"> WTF::move(destroyFunction)
</span><span class="cx"> };
</span><span class="cx"> scheduleIdleSource(name, reinterpret_cast<GSourceFunc>(voidSourceCallback), priority, context);
</span><span class="lines">@@ -101,38 +97,13 @@
</span><span class="cx"> m_context = {
</span><span class="cx"> adoptGRef(g_idle_source_new()),
</span><span class="cx"> nullptr, // cancellable
</span><del>- nullptr, // socketCancellable
</del><span class="cx"> nullptr, // voidCallback
</span><span class="cx"> WTF::move(function),
</span><del>- nullptr, // socketCallback
</del><span class="cx"> WTF::move(destroyFunction)
</span><span class="cx"> };
</span><span class="cx"> scheduleIdleSource(name, reinterpret_cast<GSourceFunc>(boolSourceCallback), priority, context);
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void GMainLoopSource::schedule(const char* name, std::function<bool (GIOCondition)>&& function, GSocket* socket, GIOCondition condition, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- cancel();
-
- ASSERT(!m_context.source);
- GCancellable* socketCancellable = g_cancellable_new();
- m_context = {
- adoptGRef(g_socket_create_source(socket, condition, socketCancellable)),
- nullptr, // cancellable
- adoptGRef(socketCancellable),
- nullptr, // voidCallback
- nullptr, // boolCallback
- WTF::move(function),
- WTF::move(destroyFunction)
- };
-
- ASSERT(m_status == Ready);
- m_status = Scheduled;
- g_source_set_name(m_context.source.get(), name);
- g_source_set_callback(m_context.source.get(), reinterpret_cast<GSourceFunc>(socketSourceCallback), this, nullptr);
- g_source_attach(m_context.source.get(), context);
-}
-
</del><span class="cx"> void GMainLoopSource::scheduleTimeoutSource(const char* name, GSourceFunc sourceFunction, int priority, GMainContext* context)
</span><span class="cx"> {
</span><span class="cx"> ASSERT(m_status == Ready);
</span><span class="lines">@@ -153,10 +124,8 @@
</span><span class="cx"> m_context = {
</span><span class="cx"> adoptGRef(g_timeout_source_new(delay.count())),
</span><span class="cx"> nullptr, // cancellable
</span><del>- nullptr, // socketCancellable
</del><span class="cx"> WTF::move(function),
</span><span class="cx"> nullptr, // boolCallback
</span><del>- nullptr, // socketCallback
</del><span class="cx"> WTF::move(destroyFunction)
</span><span class="cx"> };
</span><span class="cx"> scheduleTimeoutSource(name, reinterpret_cast<GSourceFunc>(voidSourceCallback), priority, context);
</span><span class="lines">@@ -170,10 +139,8 @@
</span><span class="cx"> m_context = {
</span><span class="cx"> adoptGRef(g_timeout_source_new(delay.count())),
</span><span class="cx"> nullptr, // cancellable
</span><del>- nullptr, // socketCancellable
</del><span class="cx"> nullptr, // voidCallback
</span><span class="cx"> WTF::move(function),
</span><del>- nullptr, // socketCallback
</del><span class="cx"> WTF::move(destroyFunction)
</span><span class="cx"> };
</span><span class="cx"> scheduleTimeoutSource(name, reinterpret_cast<GSourceFunc>(boolSourceCallback), priority, context);
</span><span class="lines">@@ -187,10 +154,8 @@
</span><span class="cx"> m_context = {
</span><span class="cx"> adoptGRef(g_timeout_source_new_seconds(delay.count())),
</span><span class="cx"> nullptr, // cancellable
</span><del>- nullptr, // socketCancellable
</del><span class="cx"> WTF::move(function),
</span><span class="cx"> nullptr, // boolCallback
</span><del>- nullptr, // socketCallback
</del><span class="cx"> WTF::move(destroyFunction)
</span><span class="cx"> };
</span><span class="cx"> scheduleTimeoutSource(name, reinterpret_cast<GSourceFunc>(voidSourceCallback), priority, context);
</span><span class="lines">@@ -204,10 +169,8 @@
</span><span class="cx"> m_context = {
</span><span class="cx"> adoptGRef(g_timeout_source_new_seconds(delay.count())),
</span><span class="cx"> nullptr, // cancellable
</span><del>- nullptr, // socketCancellable
</del><span class="cx"> nullptr, // voidCallback
</span><span class="cx"> WTF::move(function),
</span><del>- nullptr, // socketCallback
</del><span class="cx"> WTF::move(destroyFunction)
</span><span class="cx"> };
</span><span class="cx"> scheduleTimeoutSource(name, reinterpret_cast<GSourceFunc>(boolSourceCallback), priority, context);
</span><span class="lines">@@ -250,10 +213,8 @@
</span><span class="cx"> m_context = {
</span><span class="cx"> adoptGRef(createMicrosecondsTimeoutSource(delay.count())),
</span><span class="cx"> nullptr, // cancellable
</span><del>- nullptr, // socketCancellable
</del><span class="cx"> WTF::move(function),
</span><span class="cx"> nullptr, // boolCallback
</span><del>- nullptr, // socketCallback
</del><span class="cx"> WTF::move(destroyFunction)
</span><span class="cx"> };
</span><span class="cx"> scheduleTimeoutSource(name, reinterpret_cast<GSourceFunc>(voidSourceCallback), priority, context);
</span><span class="lines">@@ -267,10 +228,8 @@
</span><span class="cx"> m_context = {
</span><span class="cx"> adoptGRef(createMicrosecondsTimeoutSource(delay.count())),
</span><span class="cx"> nullptr, // cancellable
</span><del>- nullptr, // socketCancellable
</del><span class="cx"> nullptr, // voidCallback
</span><span class="cx"> WTF::move(function),
</span><del>- nullptr, // socketCallback
</del><span class="cx"> WTF::move(destroyFunction)
</span><span class="cx"> };
</span><span class="cx"> scheduleTimeoutSource(name, reinterpret_cast<GSourceFunc>(boolSourceCallback), priority, context);
</span><span class="lines">@@ -351,40 +310,6 @@
</span><span class="cx"> return retval;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool GMainLoopSource::socketCallback(GIOCondition condition)
-{
- if (!m_context.source)
- return Stop;
-
- Context context;
- context = WTF::move(m_context);
-
- ASSERT(context.socketCallback);
- ASSERT(m_status == Scheduled || m_status == Dispatching);
- m_status = Dispatching;
-
- if (g_cancellable_is_cancelled(context.socketCancellable.get())) {
- context.destroySource();
- return Stop;
- }
-
- bool retval = context.socketCallback(condition);
-
- if (m_status != Ready && !m_context.source) {
- // m_status should reflect whether the GMainLoopSource has been rescheduled during dispatch.
- ASSERT((!m_context.source && m_status == Dispatching) || m_status == Scheduled);
- if (retval && !m_context.source)
- m_context = WTF::move(context);
- else if (!retval)
- m_status = Ready;
- }
-
- if (context.source)
- context.destroySource();
-
- return retval;
-}
-
</del><span class="cx"> gboolean GMainLoopSource::voidSourceCallback(GMainLoopSource* source)
</span><span class="cx"> {
</span><span class="cx"> source->voidCallback();
</span><span class="lines">@@ -396,11 +321,6 @@
</span><span class="cx"> return source->boolCallback() == Continue;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-gboolean GMainLoopSource::socketSourceCallback(GSocket*, GIOCondition condition, GMainLoopSource* source)
-{
- return source->socketCallback(condition) == Continue;
-}
-
</del><span class="cx"> void GMainLoopSource::Context::destroySource()
</span><span class="cx"> {
</span><span class="cx"> g_source_destroy(source.get());
</span></span></pre></div>
<a id="trunkSourceWTFwtfglibGMainLoopSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/glib/GMainLoopSource.h (191880 => 191881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/glib/GMainLoopSource.h        2015-11-02 09:15:39 UTC (rev 191880)
+++ trunk/Source/WTF/wtf/glib/GMainLoopSource.h        2015-11-02 09:33:28 UTC (rev 191881)
</span><span class="lines">@@ -33,8 +33,6 @@
</span><span class="cx"> #include <wtf/Noncopyable.h>
</span><span class="cx"> #include <wtf/glib/GRefPtr.h>
</span><span class="cx">
</span><del>-typedef struct _GSocket GSocket;
-
</del><span class="cx"> namespace WTF {
</span><span class="cx">
</span><span class="cx"> class GMainLoopSource {
</span><span class="lines">@@ -60,8 +58,6 @@
</span><span class="cx"> WTF_EXPORT_PRIVATE virtual void scheduleAfterDelay(const char* name, std::function<bool()>&&, std::chrono::microseconds, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr);
</span><span class="cx"> WTF_EXPORT_PRIVATE virtual void cancel();
</span><span class="cx">
</span><del>- WTF_EXPORT_PRIVATE void schedule(const char* name, std::function<bool(GIOCondition)>&&, GSocket*, GIOCondition, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr);
-
</del><span class="cx"> protected:
</span><span class="cx"> enum Status { Ready, Scheduled, Dispatching };
</span><span class="cx">
</span><span class="lines">@@ -71,10 +67,8 @@
</span><span class="cx"> {
</span><span class="cx"> source = WTF::move(c.source);
</span><span class="cx"> cancellable = WTF::move(c.cancellable);
</span><del>- socketCancellable = WTF::move(c.socketCancellable);
</del><span class="cx"> voidCallback = WTF::move(c.voidCallback);
</span><span class="cx"> boolCallback = WTF::move(c.boolCallback);
</span><del>- socketCallback = WTF::move(c.socketCallback);
</del><span class="cx"> destroyCallback = WTF::move(c.destroyCallback);
</span><span class="cx"> return *this;
</span><span class="cx"> }
</span><span class="lines">@@ -83,10 +77,8 @@
</span><span class="cx">
</span><span class="cx"> GRefPtr<GSource> source;
</span><span class="cx"> GRefPtr<GCancellable> cancellable;
</span><del>- GRefPtr<GCancellable> socketCancellable;
</del><span class="cx"> std::function<void ()> voidCallback;
</span><span class="cx"> std::function<bool ()> boolCallback;
</span><del>- std::function<bool (GIOCondition)> socketCallback;
</del><span class="cx"> std::function<void ()> destroyCallback;
</span><span class="cx"> };
</span><span class="cx">
</span><span class="lines">@@ -101,11 +93,9 @@
</span><span class="cx"> private:
</span><span class="cx"> void scheduleIdleSource(const char* name, GSourceFunc, int priority, GMainContext*);
</span><span class="cx"> void scheduleTimeoutSource(const char* name, GSourceFunc, int priority, GMainContext*);
</span><del>- bool socketCallback(GIOCondition);
</del><span class="cx">
</span><span class="cx"> static gboolean voidSourceCallback(GMainLoopSource*);
</span><span class="cx"> static gboolean boolSourceCallback(GMainLoopSource*);
</span><del>- static gboolean socketSourceCallback(GSocket*, GIOCondition, GMainLoopSource*);
</del><span class="cx">
</span><span class="cx"> protected:
</span><span class="cx"> Context m_context;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (191880 => 191881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-11-02 09:15:39 UTC (rev 191880)
+++ trunk/Source/WebKit2/ChangeLog        2015-11-02 09:33:28 UTC (rev 191881)
</span><span class="lines">@@ -1,3 +1,26 @@
</span><ins>+2015-11-02 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GLIB] Remove support for GSocket main loop sources from GMainLoopSource
+ https://bugs.webkit.org/show_bug.cgi?id=150772
+
+ Reviewed by Žan Doberšek.
+
+ Add GSocketMonitor class to be used by Connection to monitor the
+ availability of the socket file descriptor instead of using a
+ GMainLoopSource.
+
+ * Platform/IPC/Connection.h:
+ * Platform/IPC/glib/GSocketMonitor.cpp: Added.
+ (IPC::GSocketMonitor::~GSocketMonitor):
+ (IPC::GSocketMonitor::socketSourceCallback):
+ (IPC::GSocketMonitor::start):
+ (IPC::GSocketMonitor::stop):
+ * Platform/IPC/glib/GSocketMonitor.h: Added.
+ * Platform/IPC/unix/ConnectionUnix.cpp:
+ (IPC::Connection::platformInvalidate):
+ (IPC::Connection::open):
+ * PlatformGTK.cmake:
+
</ins><span class="cx"> 2015-11-01 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Use RunLoop in WorkQueue implementation
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCConnectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/Connection.h (191880 => 191881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/Connection.h        2015-11-02 09:15:39 UTC (rev 191880)
+++ trunk/Source/WebKit2/Platform/IPC/Connection.h        2015-11-02 09:33:28 UTC (rev 191881)
</span><span class="lines">@@ -53,7 +53,7 @@
</span><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>-#include <wtf/glib/GMainLoopSource.h>
</del><ins>+#include "GSocketMonitor.h"
</ins><span class="cx"> #endif
</span><span class="cx">
</span><span class="cx"> namespace IPC {
</span><span class="lines">@@ -337,7 +337,7 @@
</span><span class="cx"> size_t m_fileDescriptorsSize;
</span><span class="cx"> int m_socketDescriptor;
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>- GMainLoopSource m_socketEventSource;
</del><ins>+ GSocketMonitor m_socketMonitor;
</ins><span class="cx"> #endif
</span><span class="cx"> #elif OS(DARWIN)
</span><span class="cx"> // Called on the connection queue.
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCglibGSocketMonitorcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Platform/IPC/glib/GSocketMonitor.cpp (0 => 191881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/glib/GSocketMonitor.cpp         (rev 0)
+++ trunk/Source/WebKit2/Platform/IPC/glib/GSocketMonitor.cpp        2015-11-02 09:33:28 UTC (rev 191881)
</span><span class="lines">@@ -0,0 +1,69 @@
</span><ins>+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "GSocketMonitor.h"
+
+#include <gio/gio.h>
+
+namespace IPC {
+
+GSocketMonitor::~GSocketMonitor()
+{
+ stop();
+}
+
+gboolean GSocketMonitor::socketSourceCallback(GSocket*, GIOCondition condition, GSocketMonitor* monitor)
+{
+ if (g_cancellable_is_cancelled(monitor->m_cancellable.get()))
+ return G_SOURCE_REMOVE;
+ return monitor->m_callback(condition);
+}
+
+void GSocketMonitor::start(GSocket* socket, GIOCondition condition, RunLoop& runLoop, std::function<gboolean (GIOCondition)>&& callback)
+{
+ stop();
+
+ m_cancellable = adoptGRef(g_cancellable_new());
+ m_source = adoptGRef(g_socket_create_source(socket, condition, m_cancellable.get()));
+ g_source_set_name(m_source.get(), "[WebKit] Socket monitor");
+ m_callback = WTF::move(callback);
+ g_source_set_callback(m_source.get(), reinterpret_cast<GSourceFunc>(socketSourceCallback), this, nullptr);
+ g_source_attach(m_source.get(), runLoop.mainContext());
+}
+
+void GSocketMonitor::stop()
+{
+ if (!m_source)
+ return;
+
+ g_cancellable_cancel(m_cancellable.get());
+ m_cancellable = nullptr;
+ g_source_destroy(m_source.get());
+ m_source = nullptr;
+ m_callback = nullptr;
+}
+
+} // namespace IPC
</ins></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCglibGSocketMonitorh"></a>
<div class="addfile"><h4>Added: trunk/Source/WebKit2/Platform/IPC/glib/GSocketMonitor.h (0 => 191881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/glib/GSocketMonitor.h         (rev 0)
+++ trunk/Source/WebKit2/Platform/IPC/glib/GSocketMonitor.h        2015-11-02 09:33:28 UTC (rev 191881)
</span><span class="lines">@@ -0,0 +1,59 @@
</span><ins>+/*
+ * Copyright (C) 2015 Igalia S.L.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef GSocketMonitor_h
+#define GSocketMonitor_h
+
+#include <functional>
+#include <glib.h>
+#include <wtf/Forward.h>
+#include <wtf/Noncopyable.h>
+#include <wtf/RunLoop.h>
+#include <wtf/glib/GRefPtr.h>
+
+typedef struct _GSocket GSocket;
+
+namespace IPC {
+
+class GSocketMonitor {
+ WTF_MAKE_NONCOPYABLE(GSocketMonitor);
+public:
+ GSocketMonitor() = default;
+ ~GSocketMonitor();
+
+ void start(GSocket*, GIOCondition, RunLoop&, std::function<gboolean (GIOCondition)>&&);
+ void stop();
+
+private:
+ static gboolean socketSourceCallback(GSocket*, GIOCondition, GSocketMonitor*);
+
+ GRefPtr<GSource> m_source;
+ GRefPtr<GCancellable> m_cancellable;
+ std::function<gboolean (GIOCondition)> m_callback;
+};
+
+} // namespace IPC
+
+#endif // GSocketMonitor_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2PlatformIPCunixConnectionUnixcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp (191880 => 191881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp        2015-11-02 09:15:39 UTC (rev 191880)
+++ trunk/Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp        2015-11-02 09:33:28 UTC (rev 191881)
</span><span class="lines">@@ -148,7 +148,7 @@
</span><span class="cx"> return;
</span><span class="cx">
</span><span class="cx"> #if PLATFORM(GTK)
</span><del>- m_socketEventSource.cancel();
</del><ins>+ m_socketMonitor.stop();
</ins><span class="cx"> #elif PLATFORM(EFL)
</span><span class="cx"> m_connectionQueue->unregisterSocketEventHandler(m_socketDescriptor);
</span><span class="cx"> #endif
</span><span class="lines">@@ -377,20 +377,20 @@
</span><span class="cx"> m_isConnected = true;
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx"> GRefPtr<GSocket> socket = adoptGRef(g_socket_new_from_fd(m_socketDescriptor, nullptr));
</span><del>- m_socketEventSource.schedule("[WebKit] Connection::SocketEventHandler", [protectedThis] (GIOCondition condition) {
</del><ins>+ m_socketMonitor.start(socket.get(), G_IO_IN, m_connectionQueue->runLoop(), [protectedThis] (GIOCondition condition) -> gboolean {
</ins><span class="cx"> if (condition & G_IO_HUP || condition & G_IO_ERR || condition & G_IO_NVAL) {
</span><span class="cx"> protectedThis->connectionDidClose();
</span><del>- return GMainLoopSource::Stop;
</del><ins>+ return G_SOURCE_REMOVE;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (condition & G_IO_IN) {
</span><span class="cx"> protectedThis->readyReadHandler();
</span><del>- return GMainLoopSource::Continue;
</del><ins>+ return G_SOURCE_CONTINUE;
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> ASSERT_NOT_REACHED();
</span><del>- return GMainLoopSource::Stop;
- }, socket.get(), G_IO_IN, nullptr, m_connectionQueue->runLoop().mainContext());
</del><ins>+ return G_SOURCE_REMOVE;
+ });
</ins><span class="cx"> #elif PLATFORM(EFL)
</span><span class="cx"> m_connectionQueue->registerSocketEventHandler(m_socketDescriptor,
</span><span class="cx"> [protectedThis] {
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformGTK.cmake (191880 => 191881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformGTK.cmake        2015-11-02 09:15:39 UTC (rev 191880)
+++ trunk/Source/WebKit2/PlatformGTK.cmake        2015-11-02 09:33:28 UTC (rev 191881)
</span><span class="lines">@@ -35,6 +35,7 @@
</span><span class="cx"> NetworkProcess/soup/NetworkProcessSoup.cpp
</span><span class="cx"> NetworkProcess/soup/RemoteNetworkingContextSoup.cpp
</span><span class="cx">
</span><ins>+ Platform/IPC/glib/GSocketMonitor.cpp
</ins><span class="cx"> Platform/IPC/unix/AttachmentUnix.cpp
</span><span class="cx"> Platform/IPC/unix/ConnectionUnix.cpp
</span><span class="cx">
</span><span class="lines">@@ -492,6 +493,7 @@
</span><span class="cx"> "${WEBKIT2_DIR}/DatabaseProcess/unix"
</span><span class="cx"> "${WEBKIT2_DIR}/NetworkProcess/gtk"
</span><span class="cx"> "${WEBKIT2_DIR}/NetworkProcess/unix"
</span><ins>+ "${WEBKIT2_DIR}/Platform/IPC/glib"
</ins><span class="cx"> "${WEBKIT2_DIR}/Shared/API/c/gtk"
</span><span class="cx"> "${WEBKIT2_DIR}/Shared/Network/CustomProtocols/soup"
</span><span class="cx"> "${WEBKIT2_DIR}/Shared/Downloads/soup"
</span><span class="lines">@@ -710,6 +712,7 @@
</span><span class="cx"> Platform/IPC/MessageSender.cpp
</span><span class="cx"> Platform/IPC/StringReference.cpp
</span><span class="cx">
</span><ins>+ Platform/IPC/glib/GSocketMonitor.cpp
</ins><span class="cx"> Platform/IPC/unix/AttachmentUnix.cpp
</span><span class="cx"> Platform/IPC/unix/ConnectionUnix.cpp
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitWebViewBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp (191880 => 191881)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2015-11-02 09:15:39 UTC (rev 191880)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitWebViewBase.cpp        2015-11-02 09:33:28 UTC (rev 191881)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx"> #include <glib/gi18n-lib.h>
</span><span class="cx"> #include <memory>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><ins>+#include <wtf/glib/GMainLoopSource.h>
</ins><span class="cx"> #include <wtf/glib/GRefPtr.h>
</span><span class="cx"> #include <wtf/text/CString.h>
</span><span class="cx">
</span></span></pre>
</div>
</div>
</body>
</html>