<!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>[192791] trunk</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/192791">192791</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-11-30 00:05:51 -0800 (Mon, 30 Nov 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[GLIB] Remove GMainLoopSource and GThreadSafeMainLoopSource
https://bugs.webkit.org/show_bug.cgi?id=151633
Reviewed by Csaba Osztrogonác.
Source/WTF:
* WTF.vcxproj/WTF.vcxproj:
* WTF.vcxproj/WTF.vcxproj.filters:
* wtf/PlatformEfl.cmake:
* wtf/PlatformGTK.cmake:
* wtf/glib/GMainLoopSource.cpp: Removed.
* wtf/glib/GMainLoopSource.h: Removed.
* wtf/glib/GThreadSafeMainLoopSource.cpp: Removed.
* wtf/glib/GThreadSafeMainLoopSource.h: Removed.
Tools:
* TestWebKitAPI/PlatformGTK.cmake:
* TestWebKitAPI/Tests/WTF/glib/GMainLoopSource.cpp: Removed.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFWTFvcxprojWTFvcxproj">trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj</a></li>
<li><a href="#trunkSourceWTFWTFvcxprojWTFvcxprojfilters">trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters</a></li>
<li><a href="#trunkSourceWTFwtfPlatformEflcmake">trunk/Source/WTF/wtf/PlatformEfl.cmake</a></li>
<li><a href="#trunkSourceWTFwtfPlatformGTKcmake">trunk/Source/WTF/wtf/PlatformGTK.cmake</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPIPlatformGTKcmake">trunk/Tools/TestWebKitAPI/PlatformGTK.cmake</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<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="#trunkSourceWTFwtfglibGThreadSafeMainLoopSourcecpp">trunk/Source/WTF/wtf/glib/GThreadSafeMainLoopSource.cpp</a></li>
<li><a href="#trunkSourceWTFwtfglibGThreadSafeMainLoopSourceh">trunk/Source/WTF/wtf/glib/GThreadSafeMainLoopSource.h</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFglibGMainLoopSourcecpp">trunk/Tools/TestWebKitAPI/Tests/WTF/glib/GMainLoopSource.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (192790 => 192791)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2015-11-30 00:56:22 UTC (rev 192790)
+++ trunk/Source/WTF/ChangeLog        2015-11-30 08:05:51 UTC (rev 192791)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2015-11-30 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GLIB] Remove GMainLoopSource and GThreadSafeMainLoopSource
+ https://bugs.webkit.org/show_bug.cgi?id=151633
+
+ Reviewed by Csaba Osztrogonác.
+
+ * WTF.vcxproj/WTF.vcxproj:
+ * WTF.vcxproj/WTF.vcxproj.filters:
+ * wtf/PlatformEfl.cmake:
+ * wtf/PlatformGTK.cmake:
+ * wtf/glib/GMainLoopSource.cpp: Removed.
+ * wtf/glib/GMainLoopSource.h: Removed.
+ * wtf/glib/GThreadSafeMainLoopSource.cpp: Removed.
+ * wtf/glib/GThreadSafeMainLoopSource.h: Removed.
+
</ins><span class="cx"> 2015-11-27 Csaba Osztrogonác <ossy@webkit.org>
</span><span class="cx">
</span><span class="cx"> Fix build warning in bignum.cc
</span></span></pre></div>
<a id="trunkSourceWTFWTFvcxprojWTFvcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj (192790 => 192791)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj        2015-11-30 00:56:22 UTC (rev 192790)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj        2015-11-30 08:05:51 UTC (rev 192791)
</span><span class="lines">@@ -83,16 +83,6 @@
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
</span><span class="cx"> </ClCompile>
</span><del>- <ClCompile Include="..\wtf\glib\GMainLoopSource.cpp">
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='DebugSuffix|x64'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
- <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
- </ClCompile>
</del><span class="cx"> <ClCompile Include="..\wtf\glib\GRefPtr.cpp">
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
</span><span class="lines">@@ -103,7 +93,6 @@
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|Win32'">true</ExcludedFromBuild>
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
</span><span class="cx"> </ClCompile>
</span><del>- <ClCompile Include="..\wtf\glib\GThreadSafeMainLoopSource.cpp" />
</del><span class="cx"> <ClCompile Include="..\wtf\GregorianDateTime.cpp" />
</span><span class="cx"> <ClCompile Include="..\wtf\HashTable.cpp" />
</span><span class="cx"> <ClCompile Include="..\wtf\Lock.cpp" />
</span><span class="lines">@@ -209,11 +198,9 @@
</span><span class="cx"> <ClInclude Include="..\wtf\Functional.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\GetPtr.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\glib\GLibUtilities.h" />
</span><del>- <ClInclude Include="..\wtf\glib\GMainLoopSource.h" />
</del><span class="cx"> <ClInclude Include="..\wtf\glib\GMutexLocker.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\glib\GTypedefs.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\glib\GRefPtr.h" />
</span><del>- <ClInclude Include="..\wtf\glib\GThreadSafeMainLoopSource.h" />
</del><span class="cx"> <ClInclude Include="..\wtf\glib\GUniquePtr.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\GregorianDateTime.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\HashCountedSet.h" />
</span></span></pre></div>
<a id="trunkSourceWTFWTFvcxprojWTFvcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters (192790 => 192791)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters        2015-11-30 00:56:22 UTC (rev 192790)
+++ trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters        2015-11-30 08:05:51 UTC (rev 192791)
</span><span class="lines">@@ -240,15 +240,9 @@
</span><span class="cx"> <ClCompile Include="..\wtf\win\RunLoopWin.cpp">
</span><span class="cx"> <Filter>wtf\win</Filter>
</span><span class="cx"> </ClCompile>
</span><del>- <ClCompile Include="..\wtf\glib\GMainLoopSource.cpp">
- <Filter>wtf\glib</Filter>
- </ClCompile>
</del><span class="cx"> <ClCompile Include="..\wtf\FastBitVector.cpp">
</span><span class="cx"> <Filter>wtf</Filter>
</span><span class="cx"> </ClCompile>
</span><del>- <ClCompile Include="..\wtf\glib\GThreadSafeMainLoopSource.cpp">
- <Filter>wtf\glib</Filter>
- </ClCompile>
</del><span class="cx"> <ClCompile Include="..\wtf\RefCounter.cpp" />
</span><span class="cx"> <ClCompile Include="..\wtf\win\WTFDLL.cpp">
</span><span class="cx"> <Filter>wtf\win</Filter>
</span><span class="lines">@@ -707,18 +701,12 @@
</span><span class="cx"> <ClInclude Include="..\wtf\RunLoop.h">
</span><span class="cx"> <Filter>wtf</Filter>
</span><span class="cx"> </ClInclude>
</span><del>- <ClInclude Include="..\wtf\glib\GMainLoopSource.h">
- <Filter>wtf\glib</Filter>
- </ClInclude>
</del><span class="cx"> <ClInclude Include="..\wtf\glib\GUniquePtr.h">
</span><span class="cx"> <Filter>wtf\glib</Filter>
</span><span class="cx"> </ClInclude>
</span><span class="cx"> <ClInclude Include="..\wtf\HashMethod.h">
</span><span class="cx"> <Filter>wtf</Filter>
</span><span class="cx"> </ClInclude>
</span><del>- <ClInclude Include="..\wtf\glib\GThreadSafeMainLoopSource.h">
- <Filter>wtf\glib</Filter>
- </ClInclude>
</del><span class="cx"> <ClInclude Include="..\wtf\RefCounter.h" />
</span><span class="cx"> <ClInclude Include="..\wtf\WorkQueue.h">
</span><span class="cx"> <Filter>wtf</Filter>
</span></span></pre></div>
<a id="trunkSourceWTFwtfPlatformEflcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/PlatformEfl.cmake (192790 => 192791)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/PlatformEfl.cmake        2015-11-30 00:56:22 UTC (rev 192790)
+++ trunk/Source/WTF/wtf/PlatformEfl.cmake        2015-11-30 08:05:51 UTC (rev 192791)
</span><span class="lines">@@ -4,9 +4,7 @@
</span><span class="cx"> efl/RunLoopEfl.cpp
</span><span class="cx"> efl/WorkQueueEfl.cpp
</span><span class="cx">
</span><del>- glib/GMainLoopSource.cpp
</del><span class="cx"> glib/GRefPtr.cpp
</span><del>- glib/GThreadSafeMainLoopSource.cpp
</del><span class="cx"> )
</span><span class="cx">
</span><span class="cx"> list(APPEND WTF_LIBRARIES
</span></span></pre></div>
<a id="trunkSourceWTFwtfPlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/PlatformGTK.cmake (192790 => 192791)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/PlatformGTK.cmake        2015-11-30 00:56:22 UTC (rev 192790)
+++ trunk/Source/WTF/wtf/PlatformGTK.cmake        2015-11-30 08:05:51 UTC (rev 192791)
</span><span class="lines">@@ -3,9 +3,7 @@
</span><span class="cx">
</span><span class="cx"> list(APPEND WTF_SOURCES
</span><span class="cx"> glib/GLibUtilities.cpp
</span><del>- glib/GMainLoopSource.cpp
</del><span class="cx"> glib/GRefPtr.cpp
</span><del>- glib/GThreadSafeMainLoopSource.cpp
</del><span class="cx"> glib/MainThreadGLib.cpp
</span><span class="cx"> glib/RunLoopGLib.cpp
</span><span class="cx"> glib/WorkQueueGLib.cpp
</span></span></pre></div>
<a id="trunkSourceWTFwtfglibGMainLoopSourcecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WTF/wtf/glib/GMainLoopSource.cpp (192790 => 192791)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/glib/GMainLoopSource.cpp        2015-11-30 00:56:22 UTC (rev 192790)
+++ trunk/Source/WTF/wtf/glib/GMainLoopSource.cpp        2015-11-30 08:05:51 UTC (rev 192791)
</span><span class="lines">@@ -1,333 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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 "GMainLoopSource.h"
-
-#if USE(GLIB)
-
-#include <gio/gio.h>
-
-namespace WTF {
-
-GMainLoopSource::~GMainLoopSource()
-{
- cancel();
-}
-
-bool GMainLoopSource::isScheduled() const
-{
- return m_status == Scheduled;
-}
-
-bool GMainLoopSource::isActive() const
-{
- return m_status != Ready;
-}
-
-void GMainLoopSource::cancel()
-{
- // A valid context should only be present if GMainLoopSource is in the Scheduled or Dispatching state.
- ASSERT(!m_context.source || m_status == Scheduled || m_status == Dispatching);
-
- m_status = Ready;
-
- if (!m_context.source)
- return;
-
- Context context;
- context = WTF::move(m_context);
- context.destroySource();
-}
-
-void GMainLoopSource::scheduleIdleSource(const char* name, GSourceFunc sourceFunction, int priority, GMainContext* context)
-{
- ASSERT(m_status == Ready);
- m_status = Scheduled;
-
- g_source_set_name(m_context.source.get(), name);
- if (priority != G_PRIORITY_DEFAULT_IDLE)
- g_source_set_priority(m_context.source.get(), priority);
- g_source_set_callback(m_context.source.get(), sourceFunction, this, nullptr);
- g_source_attach(m_context.source.get(), context);
-}
-
-void GMainLoopSource::schedule(const char* name, std::function<void ()>&& function, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- cancel();
-
- ASSERT(!m_context.source);
- m_context = {
- adoptGRef(g_idle_source_new()),
- nullptr, // cancellable
- WTF::move(function),
- nullptr, // boolCallback
- WTF::move(destroyFunction)
- };
- scheduleIdleSource(name, reinterpret_cast<GSourceFunc>(voidSourceCallback), priority, context);
-}
-
-void GMainLoopSource::schedule(const char* name, std::function<bool ()>&& function, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- cancel();
-
- ASSERT(!m_context.source);
- m_context = {
- adoptGRef(g_idle_source_new()),
- nullptr, // cancellable
- nullptr, // voidCallback
- WTF::move(function),
- WTF::move(destroyFunction)
- };
- scheduleIdleSource(name, reinterpret_cast<GSourceFunc>(boolSourceCallback), priority, context);
-}
-
-void GMainLoopSource::scheduleTimeoutSource(const char* name, GSourceFunc sourceFunction, int priority, GMainContext* context)
-{
- ASSERT(m_status == Ready);
- m_status = Scheduled;
-
- g_source_set_name(m_context.source.get(), name);
- if (priority != G_PRIORITY_DEFAULT)
- g_source_set_priority(m_context.source.get(), priority);
- g_source_set_callback(m_context.source.get(), sourceFunction, this, nullptr);
- g_source_attach(m_context.source.get(), context);
-}
-
-void GMainLoopSource::scheduleAfterDelay(const char* name, std::function<void ()>&& function, std::chrono::milliseconds delay, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- cancel();
-
- ASSERT(!m_context.source);
- m_context = {
- adoptGRef(g_timeout_source_new(delay.count())),
- nullptr, // cancellable
- WTF::move(function),
- nullptr, // boolCallback
- WTF::move(destroyFunction)
- };
- scheduleTimeoutSource(name, reinterpret_cast<GSourceFunc>(voidSourceCallback), priority, context);
-}
-
-void GMainLoopSource::scheduleAfterDelay(const char* name, std::function<bool ()>&& function, std::chrono::milliseconds delay, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- cancel();
-
- ASSERT(!m_context.source);
- m_context = {
- adoptGRef(g_timeout_source_new(delay.count())),
- nullptr, // cancellable
- nullptr, // voidCallback
- WTF::move(function),
- WTF::move(destroyFunction)
- };
- scheduleTimeoutSource(name, reinterpret_cast<GSourceFunc>(boolSourceCallback), priority, context);
-}
-
-void GMainLoopSource::scheduleAfterDelay(const char* name, std::function<void ()>&& function, std::chrono::seconds delay, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- cancel();
-
- ASSERT(!m_context.source);
- m_context = {
- adoptGRef(g_timeout_source_new_seconds(delay.count())),
- nullptr, // cancellable
- WTF::move(function),
- nullptr, // boolCallback
- WTF::move(destroyFunction)
- };
- scheduleTimeoutSource(name, reinterpret_cast<GSourceFunc>(voidSourceCallback), priority, context);
-}
-
-void GMainLoopSource::scheduleAfterDelay(const char* name, std::function<bool ()>&& function, std::chrono::seconds delay, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- cancel();
-
- ASSERT(!m_context.source);
- m_context = {
- adoptGRef(g_timeout_source_new_seconds(delay.count())),
- nullptr, // cancellable
- nullptr, // voidCallback
- WTF::move(function),
- WTF::move(destroyFunction)
- };
- scheduleTimeoutSource(name, reinterpret_cast<GSourceFunc>(boolSourceCallback), priority, context);
-}
-
-struct MicrosecondsTimeoutSource {
- GSource source;
- uint64_t delay;
-};
-
-static GSourceFuncs microsecondsTimeoutSourceFunctions = {
- nullptr, // prepare
- nullptr, // check
- // dispatch
- [](GSource* source, GSourceFunc callback, gpointer userData) -> gboolean
- {
- bool repeat = callback(userData);
- if (repeat)
- g_source_set_ready_time(source, g_source_get_time(source) + reinterpret_cast<MicrosecondsTimeoutSource*>(source)->delay);
- return repeat;
- },
- nullptr, // finalize
- nullptr, // closure_callback
- nullptr // closure_marshall
-};
-
-static GSource* createMicrosecondsTimeoutSource(uint64_t delay)
-{
- GSource* source = g_source_new(&microsecondsTimeoutSourceFunctions, sizeof(MicrosecondsTimeoutSource));
- reinterpret_cast<MicrosecondsTimeoutSource*>(source)->delay = delay;
- g_source_set_ready_time(source, g_get_monotonic_time() + delay);
- return source;
-}
-
-void GMainLoopSource::scheduleAfterDelay(const char* name, std::function<void ()>&& function, std::chrono::microseconds delay, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- cancel();
-
- ASSERT(!m_context.source);
- m_context = {
- adoptGRef(createMicrosecondsTimeoutSource(delay.count())),
- nullptr, // cancellable
- WTF::move(function),
- nullptr, // boolCallback
- WTF::move(destroyFunction)
- };
- scheduleTimeoutSource(name, reinterpret_cast<GSourceFunc>(voidSourceCallback), priority, context);
-}
-
-void GMainLoopSource::scheduleAfterDelay(const char* name, std::function<bool ()>&& function, std::chrono::microseconds delay, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- cancel();
-
- ASSERT(!m_context.source);
- m_context = {
- adoptGRef(createMicrosecondsTimeoutSource(delay.count())),
- nullptr, // cancellable
- nullptr, // voidCallback
- WTF::move(function),
- WTF::move(destroyFunction)
- };
- scheduleTimeoutSource(name, reinterpret_cast<GSourceFunc>(boolSourceCallback), priority, context);
-}
-
-bool GMainLoopSource::prepareVoidCallback(Context& context)
-{
- if (!m_context.source)
- return false;
-
- context = WTF::move(m_context);
-
- ASSERT(context.voidCallback);
- ASSERT(m_status == Scheduled);
- m_status = Dispatching;
-
- return true;
-}
-
-void GMainLoopSource::finishVoidCallback()
-{
- m_status = Ready;
-}
-
-void GMainLoopSource::voidCallback()
-{
- Context context;
- if (!prepareVoidCallback(context))
- return;
-
- context.voidCallback();
- if (m_status != Ready && !m_context.source) {
- // Switch to Ready if it hasn't been re-scheduled or cancelled.
- finishVoidCallback();
- }
-
- context.destroySource();
-}
-
-bool GMainLoopSource::prepareBoolCallback(Context& context)
-{
- if (!m_context.source)
- return false;
-
- context = WTF::move(m_context);
-
- ASSERT(context.boolCallback);
- ASSERT(m_status == Scheduled || m_status == Dispatching);
- m_status = Dispatching;
- return true;
-}
-
-void GMainLoopSource::finishBoolCallback(bool retval, Context& context)
-{
- // 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;
-}
-
-bool GMainLoopSource::boolCallback()
-{
- Context context;
- if (!prepareBoolCallback(context))
- return Stop;
-
- bool retval = context.boolCallback();
- if (m_status != Ready && !m_context.source) {
- // Prepare for a new iteration or switch to Ready if it hasn't been re-scheduled or cancelled.
- finishBoolCallback(retval, context);
- }
-
- if (context.source)
- context.destroySource();
-
- return retval;
-}
-
-gboolean GMainLoopSource::voidSourceCallback(GMainLoopSource* source)
-{
- source->voidCallback();
- return G_SOURCE_REMOVE;
-}
-
-gboolean GMainLoopSource::boolSourceCallback(GMainLoopSource* source)
-{
- return source->boolCallback() == Continue;
-}
-
-void GMainLoopSource::Context::destroySource()
-{
- g_source_destroy(source.get());
- if (destroyCallback)
- destroyCallback();
-}
-
-} // namespace WTF
-
-#endif // USE(GLIB)
</del></span></pre></div>
<a id="trunkSourceWTFwtfglibGMainLoopSourceh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WTF/wtf/glib/GMainLoopSource.h (192790 => 192791)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/glib/GMainLoopSource.h        2015-11-30 00:56:22 UTC (rev 192790)
+++ trunk/Source/WTF/wtf/glib/GMainLoopSource.h        2015-11-30 08:05:51 UTC (rev 192791)
</span><span class="lines">@@ -1,111 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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 GMainLoopSource_h
-#define GMainLoopSource_h
-
-#if USE(GLIB)
-
-#include <functional>
-#include <glib.h>
-#include <wtf/Noncopyable.h>
-#include <wtf/glib/GRefPtr.h>
-
-namespace WTF {
-
-class GMainLoopSource {
- WTF_MAKE_NONCOPYABLE(GMainLoopSource);
- WTF_MAKE_FAST_ALLOCATED;
-public:
- WTF_EXPORT_PRIVATE GMainLoopSource() = default;
- WTF_EXPORT_PRIVATE virtual ~GMainLoopSource();
-
- static const bool Stop = false;
- static const bool Continue = true;
-
- WTF_EXPORT_PRIVATE bool isScheduled() const;
- WTF_EXPORT_PRIVATE bool isActive() const;
-
- WTF_EXPORT_PRIVATE virtual void schedule(const char* name, std::function<void()>&&, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr);
- WTF_EXPORT_PRIVATE virtual void schedule(const char* name, std::function<bool()>&&, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr);
- WTF_EXPORT_PRIVATE virtual void scheduleAfterDelay(const char* name, std::function<void()>&&, std::chrono::milliseconds, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr);
- WTF_EXPORT_PRIVATE virtual void scheduleAfterDelay(const char* name, std::function<bool()>&&, std::chrono::milliseconds, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr);
- WTF_EXPORT_PRIVATE virtual void scheduleAfterDelay(const char* name, std::function<void()>&&, std::chrono::seconds, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr);
- WTF_EXPORT_PRIVATE virtual void scheduleAfterDelay(const char* name, std::function<bool()>&&, std::chrono::seconds, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr);
- WTF_EXPORT_PRIVATE virtual void scheduleAfterDelay(const char* name, std::function<void()>&&, std::chrono::microseconds, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr);
- 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);
- WTF_EXPORT_PRIVATE virtual void cancel();
-
-protected:
- enum Status { Ready, Scheduled, Dispatching };
-
- struct Context {
- Context() = default;
- Context& operator=(Context&& c)
- {
- source = WTF::move(c.source);
- cancellable = WTF::move(c.cancellable);
- voidCallback = WTF::move(c.voidCallback);
- boolCallback = WTF::move(c.boolCallback);
- destroyCallback = WTF::move(c.destroyCallback);
- return *this;
- }
-
- void destroySource();
-
- GRefPtr<GSource> source;
- GRefPtr<GCancellable> cancellable;
- std::function<void ()> voidCallback;
- std::function<bool ()> boolCallback;
- std::function<void ()> destroyCallback;
- };
-
- virtual void voidCallback();
- virtual bool boolCallback();
-
- virtual bool prepareVoidCallback(Context&);
- virtual void finishVoidCallback();
- virtual bool prepareBoolCallback(Context&);
- virtual void finishBoolCallback(bool retval, Context&);
-
-private:
- void scheduleIdleSource(const char* name, GSourceFunc, int priority, GMainContext*);
- void scheduleTimeoutSource(const char* name, GSourceFunc, int priority, GMainContext*);
-
- static gboolean voidSourceCallback(GMainLoopSource*);
- static gboolean boolSourceCallback(GMainLoopSource*);
-
-protected:
- Context m_context;
- Status m_status { Ready };
-};
-
-} // namespace WTF
-
-using WTF::GMainLoopSource;
-
-#endif // USE(GLIB)
-
-#endif // GMainLoopSource_h
</del></span></pre></div>
<a id="trunkSourceWTFwtfglibGThreadSafeMainLoopSourcecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WTF/wtf/glib/GThreadSafeMainLoopSource.cpp (192790 => 192791)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/glib/GThreadSafeMainLoopSource.cpp        2015-11-30 00:56:22 UTC (rev 192790)
+++ trunk/Source/WTF/wtf/glib/GThreadSafeMainLoopSource.cpp        2015-11-30 08:05:51 UTC (rev 192791)
</span><span class="lines">@@ -1,173 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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 "GThreadSafeMainLoopSource.h"
-
-#if USE(GLIB)
-
-#include <gio/gio.h>
-#include <wtf/glib/GMutexLocker.h>
-
-namespace WTF {
-
-GThreadSafeMainLoopSource::GThreadSafeMainLoopSource()
-{
- g_rec_mutex_init(&m_mutex);
-}
-
-GThreadSafeMainLoopSource::~GThreadSafeMainLoopSource()
-{
- cancel();
- g_rec_mutex_clear(&m_mutex);
-}
-
-void GThreadSafeMainLoopSource::cancel()
-{
- GMutexLocker<GRecMutex> locker(m_mutex);
-
- // The general cancellable object should only be present if we're currently dispatching this GMainLoopSource.
- ASSERT(!m_cancellable || m_status == Dispatching);
-
- // The source is perhaps being cancelled in the middle of a callback dispatch.
- // Cancelling this GCancellable object will convey this information to the
- // current execution context when the callback dispatch is finished.
- g_cancellable_cancel(m_cancellable.get());
- m_cancellable = nullptr;
-
- GMainLoopSource::cancel();
-}
-
-void GThreadSafeMainLoopSource::schedule(const char* name, std::function<void ()>&& function, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- GMutexLocker<GRecMutex> locker(m_mutex);
- GMainLoopSource::schedule(name, WTF::move(function), priority, WTF::move(destroyFunction), context);
- m_context.cancellable = adoptGRef(g_cancellable_new());
-}
-
-void GThreadSafeMainLoopSource::schedule(const char* name, std::function<bool ()>&& function, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- GMutexLocker<GRecMutex> locker(m_mutex);
- GMainLoopSource::schedule(name, WTF::move(function), priority, WTF::move(destroyFunction), context);
- m_context.cancellable = adoptGRef(g_cancellable_new());
-}
-
-void GThreadSafeMainLoopSource::scheduleAfterDelay(const char* name, std::function<void ()>&& function, std::chrono::milliseconds delay, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- GMutexLocker<GRecMutex> locker(m_mutex);
- GMainLoopSource::scheduleAfterDelay(name, WTF::move(function), delay, priority, WTF::move(destroyFunction), context);
- m_context.cancellable = adoptGRef(g_cancellable_new());
-}
-
-void GThreadSafeMainLoopSource::scheduleAfterDelay(const char* name, std::function<bool ()>&& function, std::chrono::milliseconds delay, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- GMutexLocker<GRecMutex> locker(m_mutex);
- GMainLoopSource::scheduleAfterDelay(name, WTF::move(function), delay, priority, WTF::move(destroyFunction), context);
- m_context.cancellable = adoptGRef(g_cancellable_new());
-}
-
-void GThreadSafeMainLoopSource::scheduleAfterDelay(const char* name, std::function<void ()>&& function, std::chrono::seconds delay, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- GMutexLocker<GRecMutex> locker(m_mutex);
- GMainLoopSource::scheduleAfterDelay(name, WTF::move(function), delay, priority, WTF::move(destroyFunction), context);
- m_context.cancellable = adoptGRef(g_cancellable_new());
-}
-
-void GThreadSafeMainLoopSource::scheduleAfterDelay(const char* name, std::function<bool ()>&& function, std::chrono::seconds delay, int priority, std::function<void ()>&& destroyFunction, GMainContext* context)
-{
- GMutexLocker<GRecMutex> locker(m_mutex);
- GMainLoopSource::scheduleAfterDelay(name, WTF::move(function), delay, priority, WTF::move(destroyFunction), context);
- m_context.cancellable = adoptGRef(g_cancellable_new());
-}
-
-bool GThreadSafeMainLoopSource::prepareVoidCallback(Context& context)
-{
- GMutexLocker<GRecMutex> locker(m_mutex);
- bool retval = GMainLoopSource::prepareVoidCallback(context);
- m_cancellable = context.cancellable;
- return retval;
-}
-
-void GThreadSafeMainLoopSource::finishVoidCallback()
-{
- GMutexLocker<GRecMutex> locker(m_mutex);
- GMainLoopSource::finishVoidCallback();
- m_cancellable = nullptr;
-}
-
-void GThreadSafeMainLoopSource::voidCallback()
-{
- Context context;
- if (!prepareVoidCallback(context))
- return;
-
- context.voidCallback();
-
- if (g_cancellable_is_cancelled(context.cancellable.get())) {
- context.destroySource();
- return;
- }
-
- finishVoidCallback();
- context.destroySource();
-}
-
-bool GThreadSafeMainLoopSource::prepareBoolCallback(Context& context)
-{
- GMutexLocker<GRecMutex> locker(m_mutex);
- bool retval = GMainLoopSource::prepareBoolCallback(context);
- m_cancellable = context.cancellable;
- return retval;
-}
-
-void GThreadSafeMainLoopSource::finishBoolCallback(bool retval, Context& context)
-{
- GMutexLocker<GRecMutex> locker(m_mutex);
- GMainLoopSource::finishBoolCallback(retval, context);
- m_cancellable = nullptr;
-}
-
-bool GThreadSafeMainLoopSource::boolCallback()
-{
- Context context;
- if (!prepareBoolCallback(context))
- return Stop;
-
- bool retval = context.boolCallback();
-
- if (g_cancellable_is_cancelled(context.cancellable.get())) {
- context.destroySource();
- return Stop;
- }
-
- finishBoolCallback(retval, context);
- if (context.source)
- context.destroySource();
- return retval;
-}
-
-} // namespace WTF
-
-#endif // USE(GLIB)
</del></span></pre></div>
<a id="trunkSourceWTFwtfglibGThreadSafeMainLoopSourceh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WTF/wtf/glib/GThreadSafeMainLoopSource.h (192790 => 192791)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/glib/GThreadSafeMainLoopSource.h        2015-11-30 00:56:22 UTC (rev 192790)
+++ trunk/Source/WTF/wtf/glib/GThreadSafeMainLoopSource.h        2015-11-30 08:05:51 UTC (rev 192791)
</span><span class="lines">@@ -1,71 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 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 GThreadSafeMainLoopSource_h
-#define GThreadSafeMainLoopSource_h
-
-#if USE(GLIB)
-
-#include <wtf/glib/GMainLoopSource.h>
-
-typedef struct _GRecMutex GRecMutex;
-
-namespace WTF {
-
-class GThreadSafeMainLoopSource final : public GMainLoopSource {
- WTF_MAKE_NONCOPYABLE(GThreadSafeMainLoopSource);
- WTF_MAKE_FAST_ALLOCATED;
-public:
- WTF_EXPORT_PRIVATE GThreadSafeMainLoopSource();
- WTF_EXPORT_PRIVATE virtual ~GThreadSafeMainLoopSource();
-
- WTF_EXPORT_PRIVATE virtual void schedule(const char* name, std::function<void()>&&, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr) override;
- WTF_EXPORT_PRIVATE virtual void schedule(const char* name, std::function<bool()>&&, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr) override;
- WTF_EXPORT_PRIVATE virtual void scheduleAfterDelay(const char* name, std::function<void()>&&, std::chrono::milliseconds, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr) override;
- WTF_EXPORT_PRIVATE virtual void scheduleAfterDelay(const char* name, std::function<bool()>&&, std::chrono::milliseconds, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr) override;
- WTF_EXPORT_PRIVATE virtual void scheduleAfterDelay(const char* name, std::function<void()>&&, std::chrono::seconds, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr) override;
- WTF_EXPORT_PRIVATE virtual void scheduleAfterDelay(const char* name, std::function<bool()>&&, std::chrono::seconds, int priority = G_PRIORITY_DEFAULT, std::function<void()>&& destroyFunction = nullptr, GMainContext* = nullptr) override;
- WTF_EXPORT_PRIVATE virtual void cancel() override;
-
-private:
- virtual void voidCallback() override;
- virtual bool boolCallback() override;
-
- virtual bool prepareVoidCallback(Context&) override;
- virtual void finishVoidCallback() override;
- virtual bool prepareBoolCallback(Context&) override;
- virtual void finishBoolCallback(bool retval, Context&) override;
-
- GRecMutex m_mutex;
- GRefPtr<GCancellable> m_cancellable;
-};
-
-} // namespace WTF
-
-using WTF::GThreadSafeMainLoopSource;
-
-#endif // USE(GLIB)
-
-#endif // GThreadSafeMainLoopSource_h
</del></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (192790 => 192791)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-11-30 00:56:22 UTC (rev 192790)
+++ trunk/Tools/ChangeLog        2015-11-30 08:05:51 UTC (rev 192791)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-11-30 Carlos Garcia Campos <cgarcia@igalia.com>
+
+ [GLIB] Remove GMainLoopSource and GThreadSafeMainLoopSource
+ https://bugs.webkit.org/show_bug.cgi?id=151633
+
+ Reviewed by Csaba Osztrogonác.
+
+ * TestWebKitAPI/PlatformGTK.cmake:
+ * TestWebKitAPI/Tests/WTF/glib/GMainLoopSource.cpp: Removed.
+
</ins><span class="cx"> 2015-11-27 Carlos Garcia Campos <cgarcia@igalia.com>
</span><span class="cx">
</span><span class="cx"> [GTK] Remove the remaining uses of GMainLoopSource
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPIPlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/PlatformGTK.cmake (192790 => 192791)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/PlatformGTK.cmake        2015-11-30 00:56:22 UTC (rev 192790)
+++ trunk/Tools/TestWebKitAPI/PlatformGTK.cmake        2015-11-30 08:05:51 UTC (rev 192791)
</span><span class="lines">@@ -160,7 +160,6 @@
</span><span class="cx"> set_target_properties(TestWebCore PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${TESTWEBKITAPI_RUNTIME_OUTPUT_DIRECTORY}/WebCore)
</span><span class="cx">
</span><span class="cx"> list(APPEND TestWTF_SOURCES
</span><del>- ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/GMainLoopSource.cpp
</del><span class="cx"> ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/GUniquePtr.cpp
</span><span class="cx"> ${TESTWEBKITAPI_DIR}/Tests/WTF/glib/WorkQueueGLib.cpp
</span><span class="cx"> )
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFglibGMainLoopSourcecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Tools/TestWebKitAPI/Tests/WTF/glib/GMainLoopSource.cpp (192790 => 192791)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/glib/GMainLoopSource.cpp        2015-11-30 00:56:22 UTC (rev 192790)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/glib/GMainLoopSource.cpp        2015-11-30 08:05:51 UTC (rev 192791)
</span><span class="lines">@@ -1,497 +0,0 @@
</span><del>-/*
- * Copyright (C) 2014 Igalia S.L.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB. If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- */
-
-#include "config.h"
-
-#include <wtf/glib/GThreadSafeMainLoopSource.h>
-#include <stdio.h>
-
-namespace TestWebKitAPI {
-
-template <typename T>
-class GMainLoopSourceTest {
-public:
- GMainLoopSourceTest()
- : m_mainLoop(g_main_loop_new(nullptr, TRUE))
- {
- }
-
- ~GMainLoopSourceTest()
- {
- g_main_loop_unref(m_mainLoop);
- }
-
- void runLoop()
- {
- g_main_loop_run(m_mainLoop);
- }
-
- void delayedFinish()
- {
- g_timeout_add(250,
- [](gpointer data) {
- GMainLoopSourceTest& test = *static_cast<GMainLoopSourceTest*>(data);
- test.finish();
- return G_SOURCE_REMOVE;
- }, this);
- }
-
- void finish()
- {
- g_main_loop_quit(m_mainLoop);
- }
-
- T& source() { return m_source; }
-
-private:
- GMainLoop* m_mainLoop;
- T m_source;
-};
-
-template <typename T>
-static void basicRescheduling(T& context)
-{
- EXPECT_TRUE(!context.test.source().isActive());
-
- context.test.source().schedule("[Test] FirstTask", [&] {
- // This should never be called. That's why we assert
- // that the variable is false a few lines later.
- context.finishedFirstTask = true;
- });
- EXPECT_TRUE(context.test.source().isScheduled());
-
- context.test.source().schedule("[Test] SecondTask", [&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
- context.finishedSecondTask = true;
- context.test.finish();
- });
- EXPECT_TRUE(context.test.source().isScheduled());
-
- context.test.runLoop();
-
- EXPECT_TRUE(!context.test.source().isActive());
- EXPECT_FALSE(context.finishedFirstTask);
- EXPECT_TRUE(context.finishedSecondTask);
-}
-
-TEST(WTF_GMainLoopSource, BasicRescheduling)
-{
- struct TestingContext {
- GMainLoopSourceTest<GMainLoopSource> test;
- bool finishedFirstTask = false;
- bool finishedSecondTask = false;
- } context;
- basicRescheduling<TestingContext>(context);
-
- struct ThreadSafeTestingContext {
- GMainLoopSourceTest<GThreadSafeMainLoopSource> test;
- bool finishedFirstTask = false;
- bool finishedSecondTask = false;
- } threadSafeContext;
- basicRescheduling<ThreadSafeTestingContext>(threadSafeContext);
-}
-
-template <typename T>
-static void reentrantRescheduling(T& context)
-{
- EXPECT_TRUE(!context.test.source().isActive());
-
- context.test.source().schedule("[Test] FirstTask", [&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
-
- context.test.source().schedule("[Test] SecondTask", [&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
- EXPECT_TRUE(context.finishedFirstTask);
-
- context.finishedSecondTask = true;
- context.test.finish();
- });
- EXPECT_TRUE(context.test.source().isScheduled());
-
- context.finishedFirstTask = true;
- });
- EXPECT_TRUE(context.test.source().isScheduled());
-
- context.test.runLoop();
-
- EXPECT_TRUE(!context.test.source().isActive());
- EXPECT_TRUE(context.finishedFirstTask);
- EXPECT_TRUE(context.finishedSecondTask);
-}
-
-TEST(WTF_GMainLoopSource, ReentrantRescheduling)
-{
- struct TestingContext {
- GMainLoopSourceTest<GMainLoopSource> test;
- bool finishedFirstTask = false;
- bool finishedSecondTask = false;
- } context;
- reentrantRescheduling<TestingContext>(context);
-
- struct ThreadSafeTestingContext {
- GMainLoopSourceTest<GThreadSafeMainLoopSource> test;
- bool finishedFirstTask = false;
- bool finishedSecondTask = false;
- } threadSafeContext;
- reentrantRescheduling<ThreadSafeTestingContext>(threadSafeContext);
-}
-
-TEST(WTF_GMainLoopSource, ReschedulingFromDifferentThread)
-{
- struct TestingContext {
- GMainLoopSourceTest<GThreadSafeMainLoopSource> test;
- bool finishedFirstTask;
- bool finishedSecondTask;
- } context;
-
- EXPECT_TRUE(!context.test.source().isActive());
-
- context.test.source().schedule("[Test] FirstTask", [&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
-
- g_usleep(1 * G_USEC_PER_SEC);
- context.finishedFirstTask = true;
- });
- EXPECT_TRUE(context.test.source().isScheduled());
-
- GThread* helperThread = g_thread_new(nullptr, [](gpointer data) -> gpointer {
- g_usleep(0.25 * G_USEC_PER_SEC);
-
- TestingContext& context = *static_cast<TestingContext*>(data);
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
- EXPECT_FALSE(context.finishedFirstTask);
-
- context.test.source().schedule("[Test] SecondTask", [&] {
- EXPECT_TRUE(context.finishedFirstTask);
-
- context.finishedSecondTask = true;
- context.test.finish();
- });
- EXPECT_TRUE(context.test.source().isScheduled());
-
- g_thread_exit(nullptr);
- return nullptr;
- }, &context);
-
- context.test.runLoop();
- g_thread_unref(helperThread);
-
- EXPECT_TRUE(!context.test.source().isActive());
- EXPECT_TRUE(context.finishedFirstTask);
- EXPECT_TRUE(context.finishedSecondTask);
-}
-
-TEST(WTF_GMainLoopSource, DestructionDuringDispatch)
-{
- // This is just a raw test that ensures deleting the GMainLoopSource object during
- // dispatch does not cause problems. This test succeeds if it doesn't crash.
-
- GMainLoopSource* source;
- GMainLoop* loop = g_main_loop_new(nullptr, TRUE);
-
- source = new GMainLoopSource;
- source->schedule("[Test] DestroySourceTask", [&] {
- delete source;
- g_main_loop_quit(loop);
- });
- g_main_loop_run(loop);
-
- source = new GMainLoopSource;
- source->schedule("[Test] DestroySourceTask", std::function<bool ()>([&] {
- delete source;
- g_main_loop_quit(loop);
- return false;
- }));
- g_main_loop_run(loop);
-
- g_main_loop_unref(loop);
-}
-
-template <typename T>
-static void cancelRepeatingSourceDuringDispatch(T& context)
-{
- EXPECT_TRUE(!context.test.source().isActive());
-
- context.test.source().schedule("[Test] RepeatingTask",
- std::function<bool ()>([&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
-
- context.callCount++;
- if (context.callCount == 3)
- context.test.source().cancel();
- return true;
- }));
- EXPECT_TRUE(context.test.source().isScheduled());
-
- context.test.delayedFinish();
- context.test.runLoop();
-
- EXPECT_TRUE(!context.test.source().isActive());
- EXPECT_EQ(3, context.callCount);
-}
-
-TEST(WTF_GMainLoopSource, CancelRepeatingSourceDuringDispatch)
-{
- struct TestingContext {
- GMainLoopSourceTest<GMainLoopSource> test;
- unsigned callCount = 0;
- } context;
- cancelRepeatingSourceDuringDispatch<TestingContext>(context);
-
- struct ThreadSafeTestingContext {
- GMainLoopSourceTest<GThreadSafeMainLoopSource> test;
- unsigned callCount = 0;
- } threadSafeContext;
- cancelRepeatingSourceDuringDispatch<ThreadSafeTestingContext>(threadSafeContext);
-}
-
-template <typename T>
-static void basicDestroyCallbacks()
-{
- {
- T context;
- EXPECT_TRUE(!context.test.source().isActive());
- context.test.source().schedule("[Test] DestroyCallback",
- [&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
- context.callbackCalled = true;
- }, G_PRIORITY_DEFAULT,
- [&] {
- EXPECT_TRUE(!context.test.source().isActive());
- context.destroyCallbackCalled = true;
- context.test.finish();
- });
- EXPECT_TRUE(context.test.source().isScheduled());
-
- context.test.runLoop();
-
- EXPECT_TRUE(!context.test.source().isActive());
- EXPECT_TRUE(context.callbackCalled);
- EXPECT_TRUE(context.destroyCallbackCalled);
- }
-
- {
- T context;
- EXPECT_TRUE(!context.test.source().isActive());
- context.test.source().schedule("[Test] DestroyCallback",
- std::function<bool ()>([&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
- context.callbackCalled = true;
- return false;
- }), G_PRIORITY_DEFAULT,
- [&] {
- EXPECT_TRUE(!context.test.source().isActive());
- context.destroyCallbackCalled = true;
- context.test.finish();
- });
- EXPECT_TRUE(context.test.source().isScheduled());
-
- context.test.runLoop();
-
- EXPECT_TRUE(!context.test.source().isActive());
- EXPECT_TRUE(context.callbackCalled);
- EXPECT_TRUE(context.destroyCallbackCalled);
- }
-}
-
-TEST(WTF_GMainLoopSource, BasicDestroyCallbacks)
-{
- struct TestingContext {
- GMainLoopSourceTest<GMainLoopSource> test;
- bool callbackCalled = false;
- bool destroyCallbackCalled = false;
- };
- basicDestroyCallbacks<TestingContext>();
-
- struct ThreadSafeTestingContext {
- GMainLoopSourceTest<GThreadSafeMainLoopSource> test;
- bool callbackCalled = false;
- bool destroyCallbackCalled = false;
- };
- basicDestroyCallbacks<ThreadSafeTestingContext>();
-}
-
-template <typename T>
-static void destroyCallbacksAfterCancellingDuringDispatch()
-{
- {
- T context;
- EXPECT_TRUE(!context.test.source().isActive());
- context.test.source().schedule("[Test] DestroyCallback",
- [&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
- context.callbackCallCount++;
- context.test.source().cancel();
- }, G_PRIORITY_DEFAULT,
- [&] {
- EXPECT_TRUE(!context.test.source().isActive());
- context.destroyCallbackCalled = true;
- context.test.finish();
- });
- EXPECT_TRUE(context.test.source().isScheduled());
-
- context.test.delayedFinish();
- context.test.runLoop();
-
- EXPECT_TRUE(!context.test.source().isActive());
- EXPECT_EQ(1, context.callbackCallCount);
- EXPECT_TRUE(context.destroyCallbackCalled);
- }
-
- {
- T context;
- EXPECT_TRUE(!context.test.source().isActive());
- context.test.source().schedule("[Test] DestroyCallback",
- std::function<bool ()>([&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
- context.callbackCallCount++;
- if (context.callbackCallCount == 3)
- context.test.source().cancel();
- return true;
- }), G_PRIORITY_DEFAULT,
- [&] {
- EXPECT_TRUE(!context.test.source().isActive());
- context.destroyCallbackCalled = true;
- });
- EXPECT_TRUE(context.test.source().isScheduled());
-
- context.test.delayedFinish();
- context.test.runLoop();
-
- EXPECT_TRUE(!context.test.source().isActive());
- EXPECT_EQ(3, context.callbackCallCount);
- EXPECT_TRUE(context.destroyCallbackCalled);
- }
-}
-
-TEST(WTF_GMainLoopSource, DestroyCallbacksAfterCancellingDuringDispatch)
-{
- struct TestingContext {
- GMainLoopSourceTest<GMainLoopSource> test;
- unsigned callbackCallCount= 0;
- bool destroyCallbackCalled = false;
- };
- destroyCallbacksAfterCancellingDuringDispatch<TestingContext>();
-
- struct ThreadSafeTestingContext {
- GMainLoopSourceTest<GThreadSafeMainLoopSource> test;
- unsigned callbackCallCount= 0;
- bool destroyCallbackCalled = false;
- };
- destroyCallbacksAfterCancellingDuringDispatch<ThreadSafeTestingContext>();
-}
-
-template <typename T>
-static void destroyCallbacksAfterReschedulingDuringDispatch()
-{
- {
- T context;
- EXPECT_TRUE(!context.test.source().isActive());
- context.test.source().schedule("[Test] BaseCallback",
- [&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
- context.firstCallbackCallCount++;
- context.test.source().schedule("[Test] ReschedulingCallback",
- [&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
- context.secondCallbackCallCount++;
- }, G_PRIORITY_DEFAULT,
- [&] {
- EXPECT_TRUE(!context.test.source().isActive());
- context.secondDestroyCallbackCalled = true;
- });
- EXPECT_TRUE(context.test.source().isScheduled());
- }, G_PRIORITY_DEFAULT,
- [&] {
- // At this point the GMainLoopSource has been rescheduled, ergo the Scheduled status.
- EXPECT_TRUE(context.test.source().isScheduled());
- context.firstDestroyCallbackCalled = true;
- });
- EXPECT_TRUE(context.test.source().isScheduled());
-
- context.test.delayedFinish();
- context.test.runLoop();
-
- EXPECT_TRUE(!context.test.source().isActive());
- EXPECT_EQ(1, context.firstCallbackCallCount);
- EXPECT_TRUE(context.firstDestroyCallbackCalled);
- EXPECT_EQ(1, context.secondCallbackCallCount);
- EXPECT_TRUE(context.secondDestroyCallbackCalled);
- }
-
- {
- T context;
- EXPECT_TRUE(!context.test.source().isActive());
- context.test.source().schedule("[Test] BaseCallback",
- std::function<bool ()>([&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
- context.firstCallbackCallCount++;
- context.test.source().schedule("[Test] ReschedulingCallback",
- std::function<bool ()>([&] {
- EXPECT_TRUE(context.test.source().isActive() && !context.test.source().isScheduled());
- context.secondCallbackCallCount++;
- return context.secondCallbackCallCount != 3;
- }), G_PRIORITY_DEFAULT,
- [&] {
- EXPECT_TRUE(!context.test.source().isActive());
- context.secondDestroyCallbackCalled = true;
- });
- EXPECT_TRUE(context.test.source().isScheduled());
- return true;
- }), G_PRIORITY_DEFAULT,
- [&] {
- // At this point the GMainLoopSource has been rescheduled, ergo the Scheduled status.
- EXPECT_TRUE(context.test.source().isScheduled());
- context.firstDestroyCallbackCalled = true;
- });
- EXPECT_TRUE(context.test.source().isScheduled());
-
- context.test.delayedFinish();
- context.test.runLoop();
-
- EXPECT_TRUE(!context.test.source().isActive());
- EXPECT_EQ(1, context.firstCallbackCallCount);
- EXPECT_TRUE(context.firstDestroyCallbackCalled);
- EXPECT_EQ(3, context.secondCallbackCallCount);
- EXPECT_TRUE(context.secondDestroyCallbackCalled);
- }
-}
-
-TEST(WTF_GMainLoopSource, DestroyCallbacksAfterReschedulingDuringDispatch)
-{
- struct TestingContext {
- GMainLoopSourceTest<GMainLoopSource> test;
- unsigned firstCallbackCallCount = 0;
- bool firstDestroyCallbackCalled = false;
- unsigned secondCallbackCallCount = 0;
- bool secondDestroyCallbackCalled = false;
- };
- destroyCallbacksAfterReschedulingDuringDispatch<TestingContext>();
-
- struct ThreadSafeTestingContext {
- GMainLoopSourceTest<GThreadSafeMainLoopSource> test;
- unsigned firstCallbackCallCount = 0;
- bool firstDestroyCallbackCalled = false;
- unsigned secondCallbackCallCount = 0;
- bool secondDestroyCallbackCalled = false;
- };
- destroyCallbacksAfterReschedulingDuringDispatch<ThreadSafeTestingContext>();
-}
-
-} // namespace TestWebKitAPI
</del></span></pre>
</div>
</div>
</body>
</html>