<!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>[173749] 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/173749">173749</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2014-09-18 23:51:24 -0700 (Thu, 18 Sep 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Dot not allow to create delete-on-destroy GMainLoopSources
https://bugs.webkit.org/show_bug.cgi?id=136923

Reviewed by Gustavo Noronha Silva.

Source/WebCore:

* platform/gtk/GtkDragAndDropHelper.cpp:
(WebCore::GtkDragAndDropHelper::handleDragLeave): Use GMainLoopSource::scheduleAndDeleteOnDestroy().

Source/WebKit2:

* Platform/gtk/WorkQueueGtk.cpp:
(WorkQueue::dispatch): Use GMainLoopSource::scheduleAndDeleteOnDestroy().
(WorkQueue::dispatchAfter): Use GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy().

Source/WTF:

We have several asserts to ensure that delete-on-destroy sources
are not misused, like not scheduling socket sources on a
delete-on-destroy GMainLoopSource or not allowing to cancel them
before they have been dispatched. It's better to ensure all those
things at compile time, using static methods to schedule sources
creating a delete-on-destroy GMainLoopSource that is not returned
to the user.

* wtf/gobject/GMainLoopSource.cpp:
(WTF::GMainLoopSource::create): Private static method to create a
delete-on-destroy GMainLoopSource.
(WTF::GMainLoopSource::cancelWithoutLocking): Return early in case
of delete-on-destroy source, since they can't be cancelled.
(WTF::GMainLoopSource::schedule): Remove assertion to ensure
socket sources are not scheduled on a delete-on-destroy GMainLoopSource.
(WTF::GMainLoopSource::scheduleAndDeleteOnDestroy):
(WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy):
(WTF::GMainLoopSource::createAndDeleteOnDestroy): Deleted.
* wtf/gobject/GMainLoopSource.h:
* wtf/gtk/MainThreadGtk.cpp:
(WTF::scheduleDispatchFunctionsOnMainThread): Use GMainLoopSource::scheduleAndDeleteOnDestroy()
* wtf/gtk/RunLoopGtk.cpp:
(WTF::RunLoop::wakeUp): Ditto.

Tools:

* TestWebKitAPI/Tests/WTF/gobject/GMainLoopSource.cpp:
(TestWebKitAPI::TEST): Use the new API that doesn't allow to use
the source.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfgobjectGMainLoopSourcecpp">trunk/Source/WTF/wtf/gobject/GMainLoopSource.cpp</a></li>
<li><a href="#trunkSourceWTFwtfgobjectGMainLoopSourceh">trunk/Source/WTF/wtf/gobject/GMainLoopSource.h</a></li>
<li><a href="#trunkSourceWTFwtfgtkMainThreadGtkcpp">trunk/Source/WTF/wtf/gtk/MainThreadGtk.cpp</a></li>
<li><a href="#trunkSourceWTFwtfgtkRunLoopGtkcpp">trunk/Source/WTF/wtf/gtk/RunLoopGtk.cpp</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgtkGtkDragAndDropHelpercpp">trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformgtkWorkQueueGtkcpp">trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWTFgobjectGMainLoopSourcecpp">trunk/Tools/TestWebKitAPI/Tests/WTF/gobject/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 (173748 => 173749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2014-09-19 04:41:49 UTC (rev 173748)
+++ trunk/Source/WTF/ChangeLog        2014-09-19 06:51:24 UTC (rev 173749)
</span><span class="lines">@@ -1,3 +1,34 @@
</span><ins>+2014-09-18  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Dot not allow to create delete-on-destroy GMainLoopSources
+        https://bugs.webkit.org/show_bug.cgi?id=136923
+
+        Reviewed by Gustavo Noronha Silva.
+
+        We have several asserts to ensure that delete-on-destroy sources
+        are not misused, like not scheduling socket sources on a
+        delete-on-destroy GMainLoopSource or not allowing to cancel them
+        before they have been dispatched. It's better to ensure all those
+        things at compile time, using static methods to schedule sources
+        creating a delete-on-destroy GMainLoopSource that is not returned
+        to the user.
+
+        * wtf/gobject/GMainLoopSource.cpp:
+        (WTF::GMainLoopSource::create): Private static method to create a
+        delete-on-destroy GMainLoopSource.
+        (WTF::GMainLoopSource::cancelWithoutLocking): Return early in case
+        of delete-on-destroy source, since they can't be cancelled.
+        (WTF::GMainLoopSource::schedule): Remove assertion to ensure
+        socket sources are not scheduled on a delete-on-destroy GMainLoopSource.
+        (WTF::GMainLoopSource::scheduleAndDeleteOnDestroy):
+        (WTF::GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy):
+        (WTF::GMainLoopSource::createAndDeleteOnDestroy): Deleted.
+        * wtf/gobject/GMainLoopSource.h:
+        * wtf/gtk/MainThreadGtk.cpp:
+        (WTF::scheduleDispatchFunctionsOnMainThread): Use GMainLoopSource::scheduleAndDeleteOnDestroy()
+        * wtf/gtk/RunLoopGtk.cpp:
+        (WTF::RunLoop::wakeUp): Ditto.
+
</ins><span class="cx"> 2014-09-18  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed rollout r173731. Broke multiple builds.
</span></span></pre></div>
<a id="trunkSourceWTFwtfgobjectGMainLoopSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/gobject/GMainLoopSource.cpp (173748 => 173749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/gobject/GMainLoopSource.cpp        2014-09-19 04:41:49 UTC (rev 173748)
+++ trunk/Source/WTF/wtf/gobject/GMainLoopSource.cpp        2014-09-19 06:51:24 UTC (rev 173749)
</span><span class="lines">@@ -33,7 +33,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><del>-GMainLoopSource&amp; GMainLoopSource::createAndDeleteOnDestroy()
</del><ins>+GMainLoopSource&amp; GMainLoopSource::create()
</ins><span class="cx"> {
</span><span class="cx">     return *new GMainLoopSource(DeleteOnDestroy);
</span><span class="cx"> }
</span><span class="lines">@@ -76,13 +76,14 @@
</span><span class="cx"> 
</span><span class="cx"> void GMainLoopSource::cancelWithoutLocking()
</span><span class="cx"> {
</span><ins>+    // Delete-on-destroy GMainLoopSource objects can't be cancelled.
+    if (m_deleteOnDestroy == DeleteOnDestroy)
+        return;
+
</ins><span class="cx">     // A valid context should only be present if GMainLoopSource is in the Scheduled or Dispatching state.
</span><span class="cx">     ASSERT(!m_context.source || m_status == Scheduled || m_status == Dispatching);
</span><span class="cx">     // The general cancellable object should only be present if we're currently dispatching this GMainLoopSource.
</span><span class="cx">     ASSERT(!m_cancellable || m_status == Dispatching);
</span><del>-    // Delete-on-destroy GMainLoopSource objects can only be cancelled when there's callback either scheduled
-    // or in the middle of dispatch. At that point cancellation will have no effect.
-    ASSERT(m_deleteOnDestroy != DeleteOnDestroy || (m_status == Ready &amp;&amp; !m_context.source));
</del><span class="cx"> 
</span><span class="cx">     m_status = Ready;
</span><span class="cx"> 
</span><span class="lines">@@ -153,9 +154,6 @@
</span><span class="cx">     GMutexLocker locker(m_mutex);
</span><span class="cx">     cancelWithoutLocking();
</span><span class="cx"> 
</span><del>-    // Don't allow scheduling GIOCondition callbacks on delete-on-destroy GMainLoopSources.
-    ASSERT(m_deleteOnDestroy == DoNotDeleteOnDestroy);
-
</del><span class="cx">     ASSERT(!m_context.source);
</span><span class="cx">     GCancellable* socketCancellable = g_cancellable_new();
</span><span class="cx">     m_context = {
</span><span class="lines">@@ -259,6 +257,36 @@
</span><span class="cx">     scheduleTimeoutSource(name, reinterpret_cast&lt;GSourceFunc&gt;(boolSourceCallback), priority, context);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void GMainLoopSource::scheduleAndDeleteOnDestroy(const char* name, std::function&lt;void()&gt; function, int priority, std::function&lt;void()&gt; destroyFunction, GMainContext* context)
+{
+    create().schedule(name, function, priority, destroyFunction, context);
+}
+
+void GMainLoopSource::scheduleAndDeleteOnDestroy(const char* name, std::function&lt;bool()&gt; function, int priority, std::function&lt;void()&gt; destroyFunction, GMainContext* context)
+{
+    create().schedule(name, function, priority, destroyFunction, context);
+}
+
+void GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy(const char* name, std::function&lt;void()&gt; function, std::chrono::milliseconds delay, int priority, std::function&lt;void()&gt; destroyFunction, GMainContext* context)
+{
+    create().scheduleAfterDelay(name, function, delay, priority, destroyFunction, context);
+}
+
+void GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy(const char* name, std::function&lt;bool()&gt; function, std::chrono::milliseconds delay, int priority, std::function&lt;void()&gt; destroyFunction, GMainContext* context)
+{
+    create().scheduleAfterDelay(name, function, delay, priority, destroyFunction, context);
+}
+
+void GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy(const char* name, std::function&lt;void()&gt; function, std::chrono::seconds delay, int priority, std::function&lt;void()&gt; destroyFunction, GMainContext* context)
+{
+    create().scheduleAfterDelay(name, function, delay, priority, destroyFunction, context);
+}
+
+void GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy(const char* name, std::function&lt;bool()&gt; function, std::chrono::seconds delay, int priority, std::function&lt;void()&gt; destroyFunction, GMainContext* context)
+{
+    create().scheduleAfterDelay(name, function, delay, priority, destroyFunction, context);
+}
+
</ins><span class="cx"> void GMainLoopSource::voidCallback()
</span><span class="cx"> {
</span><span class="cx">     Context context;
</span></span></pre></div>
<a id="trunkSourceWTFwtfgobjectGMainLoopSourceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/gobject/GMainLoopSource.h (173748 => 173749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/gobject/GMainLoopSource.h        2014-09-19 04:41:49 UTC (rev 173748)
+++ trunk/Source/WTF/wtf/gobject/GMainLoopSource.h        2014-09-19 06:51:24 UTC (rev 173749)
</span><span class="lines">@@ -40,8 +40,6 @@
</span><span class="cx">     WTF_MAKE_NONCOPYABLE(GMainLoopSource);
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    static GMainLoopSource&amp; createAndDeleteOnDestroy();
-
</del><span class="cx">     WTF_EXPORT_PRIVATE GMainLoopSource();
</span><span class="cx">     WTF_EXPORT_PRIVATE ~GMainLoopSource();
</span><span class="cx"> 
</span><span class="lines">@@ -60,7 +58,16 @@
</span><span class="cx">     WTF_EXPORT_PRIVATE void scheduleAfterDelay(const char* name, std::function&lt;bool()&gt;, std::chrono::seconds, int priority = G_PRIORITY_DEFAULT, std::function&lt;void()&gt; destroyFunction = nullptr, GMainContext* = nullptr);
</span><span class="cx">     WTF_EXPORT_PRIVATE void cancel();
</span><span class="cx"> 
</span><ins>+    static void scheduleAndDeleteOnDestroy(const char* name, std::function&lt;void()&gt;, int priority = G_PRIORITY_DEFAULT, std::function&lt;void()&gt; destroyFunction = nullptr, GMainContext* = nullptr);
+    static void scheduleAndDeleteOnDestroy(const char* name, std::function&lt;bool()&gt;, int priority = G_PRIORITY_DEFAULT, std::function&lt;void()&gt; destroyFunction = nullptr, GMainContext* = nullptr);
+    static void scheduleAfterDelayAndDeleteOnDestroy(const char* name, std::function&lt;void()&gt;, std::chrono::milliseconds, int priority = G_PRIORITY_DEFAULT, std::function&lt;void()&gt; destroyFunction = nullptr, GMainContext* = nullptr);
+    static void scheduleAfterDelayAndDeleteOnDestroy(const char* name, std::function&lt;bool()&gt;, std::chrono::milliseconds, int priority = G_PRIORITY_DEFAULT, std::function&lt;void()&gt; destroyFunction = nullptr, GMainContext* = nullptr);
+    static void scheduleAfterDelayAndDeleteOnDestroy(const char* name, std::function&lt;void()&gt;, std::chrono::seconds, int priority = G_PRIORITY_DEFAULT, std::function&lt;void()&gt; destroyFunction = nullptr, GMainContext* = nullptr);
+    static void scheduleAfterDelayAndDeleteOnDestroy(const char* name, std::function&lt;bool()&gt;, std::chrono::seconds, int priority = G_PRIORITY_DEFAULT, std::function&lt;void()&gt; destroyFunction = nullptr, GMainContext* = nullptr);
+
</ins><span class="cx"> private:
</span><ins>+    static GMainLoopSource&amp; create();
+
</ins><span class="cx">     enum DeleteOnDestroyType { DeleteOnDestroy, DoNotDeleteOnDestroy };
</span><span class="cx">     GMainLoopSource(DeleteOnDestroyType);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWTFwtfgtkMainThreadGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/gtk/MainThreadGtk.cpp (173748 => 173749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/gtk/MainThreadGtk.cpp        2014-09-19 04:41:49 UTC (rev 173748)
+++ trunk/Source/WTF/wtf/gtk/MainThreadGtk.cpp        2014-09-19 06:51:24 UTC (rev 173749)
</span><span class="lines">@@ -40,7 +40,7 @@
</span><span class="cx"> 
</span><span class="cx"> void scheduleDispatchFunctionsOnMainThread()
</span><span class="cx"> {
</span><del>-    GMainLoopSource::createAndDeleteOnDestroy().schedule(&quot;[WebKit] dispatchFunctionsFromMainThread&quot;, std::function&lt;void()&gt;(dispatchFunctionsFromMainThread));
</del><ins>+    GMainLoopSource::scheduleAndDeleteOnDestroy(&quot;[WebKit] dispatchFunctionsFromMainThread&quot;, std::function&lt;void()&gt;(dispatchFunctionsFromMainThread));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WTF
</span></span></pre></div>
<a id="trunkSourceWTFwtfgtkRunLoopGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/gtk/RunLoopGtk.cpp (173748 => 173749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/gtk/RunLoopGtk.cpp        2014-09-19 04:41:49 UTC (rev 173748)
+++ trunk/Source/WTF/wtf/gtk/RunLoopGtk.cpp        2014-09-19 06:51:24 UTC (rev 173749)
</span><span class="lines">@@ -100,7 +100,7 @@
</span><span class="cx"> void RunLoop::wakeUp()
</span><span class="cx"> {
</span><span class="cx">     RefPtr&lt;RunLoop&gt; runLoop(this);
</span><del>-    GMainLoopSource::createAndDeleteOnDestroy().schedule(&quot;[WebKit] RunLoop work&quot;, std::function&lt;void()&gt;([runLoop] {
</del><ins>+    GMainLoopSource::scheduleAndDeleteOnDestroy(&quot;[WebKit] RunLoop work&quot;, std::function&lt;void()&gt;([runLoop] {
</ins><span class="cx">         runLoop-&gt;performWork();
</span><span class="cx">     }), G_PRIORITY_DEFAULT, nullptr, m_runLoopContext.get());
</span><span class="cx">     g_main_context_wakeup(m_runLoopContext.get());
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (173748 => 173749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-09-19 04:41:49 UTC (rev 173748)
+++ trunk/Source/WebCore/ChangeLog        2014-09-19 06:51:24 UTC (rev 173749)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2014-09-18  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Dot not allow to create delete-on-destroy GMainLoopSources
+        https://bugs.webkit.org/show_bug.cgi?id=136923
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * platform/gtk/GtkDragAndDropHelper.cpp:
+        (WebCore::GtkDragAndDropHelper::handleDragLeave): Use GMainLoopSource::scheduleAndDeleteOnDestroy().
+
</ins><span class="cx"> 2014-09-18  Roger Fong  &lt;roger_fong@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Windows] Media tests all fail because they cannot find localized strings.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgtkGtkDragAndDropHelpercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp (173748 => 173749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp        2014-09-19 04:41:49 UTC (rev 173748)
+++ trunk/Source/WebCore/platform/gtk/GtkDragAndDropHelper.cpp        2014-09-19 06:51:24 UTC (rev 173749)
</span><span class="lines">@@ -99,7 +99,7 @@
</span><span class="cx">     // the drag-drop signal. We want the actions for drag-leave to happen after
</span><span class="cx">     // those for drag-drop, so schedule them to happen asynchronously here.
</span><span class="cx">     context-&gt;exitedCallback = exitedCallback;
</span><del>-    GMainLoopSource::createAndDeleteOnDestroy().schedule(&quot;[WebKit] handleDragLeaveLater&quot;, std::function&lt;void()&gt;(std::bind(&amp;GtkDragAndDropHelper::handleDragLeaveLater, this, context)));
</del><ins>+    GMainLoopSource::scheduleAndDeleteOnDestroy(&quot;[WebKit] handleDragLeaveLater&quot;, std::function&lt;void()&gt;(std::bind(&amp;GtkDragAndDropHelper::handleDragLeaveLater, this, context)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void queryNewDropContextData(DroppingContext* dropContext, GtkWidget* widget, guint time)
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (173748 => 173749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-09-19 04:41:49 UTC (rev 173748)
+++ trunk/Source/WebKit2/ChangeLog        2014-09-19 06:51:24 UTC (rev 173749)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-09-18  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Dot not allow to create delete-on-destroy GMainLoopSources
+        https://bugs.webkit.org/show_bug.cgi?id=136923
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * Platform/gtk/WorkQueueGtk.cpp:
+        (WorkQueue::dispatch): Use GMainLoopSource::scheduleAndDeleteOnDestroy().
+        (WorkQueue::dispatchAfter): Use GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy().
+
</ins><span class="cx"> 2014-09-18  Ryuan Choi  &lt;ryuan.choi@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [EFL][CoordinatedGraphics] Remove setBackgroundColor message
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformgtkWorkQueueGtkcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp (173748 => 173749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp        2014-09-19 04:41:49 UTC (rev 173748)
+++ trunk/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp        2014-09-19 06:51:24 UTC (rev 173749)
</span><span class="lines">@@ -108,13 +108,13 @@
</span><span class="cx"> void WorkQueue::dispatch(std::function&lt;void ()&gt; function)
</span><span class="cx"> {
</span><span class="cx">     ref();
</span><del>-    GMainLoopSource::createAndDeleteOnDestroy().schedule(&quot;[WebKit] WorkQueue::dispatch&quot;, WTF::move(function), G_PRIORITY_DEFAULT,
</del><ins>+    GMainLoopSource::scheduleAndDeleteOnDestroy(&quot;[WebKit] WorkQueue::dispatch&quot;, WTF::move(function), G_PRIORITY_DEFAULT,
</ins><span class="cx">         [this] { deref(); }, m_eventContext.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WorkQueue::dispatchAfter(std::chrono::nanoseconds duration, std::function&lt;void ()&gt; function)
</span><span class="cx"> {
</span><span class="cx">     ref();
</span><del>-    GMainLoopSource::createAndDeleteOnDestroy().scheduleAfterDelay(&quot;[WebKit] WorkQueue::dispatchAfter&quot;, WTF::move(function),
</del><ins>+    GMainLoopSource::scheduleAfterDelayAndDeleteOnDestroy(&quot;[WebKit] WorkQueue::dispatchAfter&quot;, WTF::move(function),
</ins><span class="cx">         std::chrono::duration_cast&lt;std::chrono::milliseconds&gt;(duration), G_PRIORITY_DEFAULT, [this] { deref(); }, m_eventContext.get());
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (173748 => 173749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-09-19 04:41:49 UTC (rev 173748)
+++ trunk/Tools/ChangeLog        2014-09-19 06:51:24 UTC (rev 173749)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-09-18  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Dot not allow to create delete-on-destroy GMainLoopSources
+        https://bugs.webkit.org/show_bug.cgi?id=136923
+
+        Reviewed by Gustavo Noronha Silva.
+
+        * TestWebKitAPI/Tests/WTF/gobject/GMainLoopSource.cpp:
+        (TestWebKitAPI::TEST): Use the new API that doesn't allow to use
+        the source.
+
</ins><span class="cx"> 2014-09-18  Csaba Osztrogonác  &lt;ossy@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix countFailures of RunLLINTCLoopTests and Run32bitJSCTests (II)
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWTFgobjectGMainLoopSourcecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/gobject/GMainLoopSource.cpp (173748 => 173749)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WTF/gobject/GMainLoopSource.cpp        2014-09-19 04:41:49 UTC (rev 173748)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/gobject/GMainLoopSource.cpp        2014-09-19 06:51:24 UTC (rev 173749)
</span><span class="lines">@@ -424,8 +424,7 @@
</span><span class="cx"> {
</span><span class="cx">     // Testing the delete-on-destroy sources is very limited. There's no good way
</span><span class="cx">     // of testing that the GMainLoopSource objects are deleted when their GSource
</span><del>-    // is destroyed, and the socket callbacks shouldn't be scheduled on these types
-    // of GMainLoopSources (as we aggressively assert to prevent that).
</del><ins>+    // is destroyed.
</ins><span class="cx"> 
</span><span class="cx">     struct TestingContext {
</span><span class="cx">         GMainLoopSourceTest test;
</span><span class="lines">@@ -436,23 +435,14 @@
</span><span class="cx">     {
</span><span class="cx">         TestingContext context;
</span><span class="cx"> 
</span><del>-        // We take a reference to the GMainLoopSource just to perform additional
-        // tests on its status. We shouldn't use the reference after the main loop
-        // exists since at that point the GMainLoopSource will be destroyed and
-        // the reference pointing to an invalid piece of memory.
-        GMainLoopSource&amp; source = GMainLoopSource::createAndDeleteOnDestroy();
-        EXPECT_TRUE(!source.isActive());
-        source.schedule(&quot;[Test] DeleteOnDestroy&quot;,
</del><ins>+        GMainLoopSource::scheduleAndDeleteOnDestroy(&quot;[Test] DeleteOnDestroy&quot;,
</ins><span class="cx">             [&amp;] {
</span><del>-                EXPECT_TRUE(source.isActive() &amp;&amp; !source.isScheduled());
</del><span class="cx">                 context.callbackCallCount++;
</span><span class="cx">             }, G_PRIORITY_DEFAULT,
</span><span class="cx">             [&amp;] {
</span><del>-                EXPECT_TRUE(!source.isActive());
</del><span class="cx">                 EXPECT_FALSE(context.destroyCallbackCalled);
</span><span class="cx">                 context.destroyCallbackCalled = true;
</span><span class="cx">             });
</span><del>-        EXPECT_TRUE(source.isScheduled());
</del><span class="cx"> 
</span><span class="cx">         context.test.delayedFinish();
</span><span class="cx">         context.test.runLoop();
</span><span class="lines">@@ -463,21 +453,15 @@
</span><span class="cx">     {
</span><span class="cx">         TestingContext context;
</span><span class="cx"> 
</span><del>-        // As in the previous scope, we need a reference to the GMainLoopSource.
-        GMainLoopSource&amp; source = GMainLoopSource::createAndDeleteOnDestroy();
-        EXPECT_TRUE(!source.isActive());
-        source.schedule(&quot;[Test] DeleteOnDestroy&quot;,
</del><ins>+        GMainLoopSource::scheduleAndDeleteOnDestroy(&quot;[Test] DeleteOnDestroy&quot;,
</ins><span class="cx">             std::function&lt;bool ()&gt;([&amp;] {
</span><del>-                EXPECT_TRUE(source.isActive() &amp;&amp; !source.isScheduled());
</del><span class="cx">                 context.callbackCallCount++;
</span><span class="cx">                 return context.callbackCallCount != 3;
</span><span class="cx">             }), G_PRIORITY_DEFAULT,
</span><span class="cx">             [&amp;] {
</span><del>-                EXPECT_TRUE(!source.isActive());
</del><span class="cx">                 EXPECT_FALSE(context.destroyCallbackCalled);
</span><span class="cx">                 context.destroyCallbackCalled = true;
</span><span class="cx">             });
</span><del>-        EXPECT_TRUE(source.isScheduled());
</del><span class="cx"> 
</span><span class="cx">         context.test.delayedFinish();
</span><span class="cx">         context.test.runLoop();
</span></span></pre>
</div>
</div>

</body>
</html>