<!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>[183618] trunk/Source/WebCore</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/183618">183618</a></dd>
<dt>Author</dt> <dd>jer.noble@apple.com</dd>
<dt>Date</dt> <dd>2015-04-29 23:29:36 -0700 (Wed, 29 Apr 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>Make GenericTaskQueue even more generic (and usable inside platform/)
https://bugs.webkit.org/show_bug.cgi?id=144414
Reviewed by Eric Carlson.
Templatize GenericTaskQueue so that it can be used from within platform/.
* CMakeLists.txt:
* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* dom/GenericTaskQueue.cpp: Removed.
* html/HTMLMediaElement.h:
* platform/GenericTaskQueue.h: Renamed from Source/WebCore/dom/GenericTaskQueue.h.
(WebCore::TaskDispatcher::TaskDispatcher): Added default templatized class which just calls the parameter's postTask().
(WebCore::TaskDispatcher::postTask): Call context's postTask().
(WebCore::TaskDispatcher<Timer>::TaskDispatcher): Add a timer version which does not require a context.
(WebCore::TaskDispatcher<Timer>::postTask): Set the timer.
(WebCore::TaskDispatcher<Timer>::timerFired): Call the task.
(WebCore::GenericTaskQueue::GenericTaskQueue): Moved from .cpp.
(WebCore::GenericTaskQueue::enqueueTask): Ditto.
(WebCore::GenericTaskQueue::close): Ditto.
(WebCore::GenericTaskQueue::cancelAllTasks): Ditto.
(WebCore::GenericTaskQueue::hasPendingTasks): Ditto.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreCMakeListstxt">trunk/Source/WebCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxproj">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj</a></li>
<li><a href="#trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters">trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters</a></li>
<li><a href="#trunkSourceWebCoreWebCorexcodeprojprojectpbxproj">trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceWebCorehtmlHTMLMediaElementh">trunk/Source/WebCore/html/HTMLMediaElement.h</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreplatformGenericTaskQueueh">trunk/Source/WebCore/platform/GenericTaskQueue.h</a></li>
</ul>
<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoredomGenericTaskQueuecpp">trunk/Source/WebCore/dom/GenericTaskQueue.cpp</a></li>
<li><a href="#trunkSourceWebCoredomGenericTaskQueueh">trunk/Source/WebCore/dom/GenericTaskQueue.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/CMakeLists.txt (183617 => 183618)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/CMakeLists.txt        2015-04-30 05:53:01 UTC (rev 183617)
+++ trunk/Source/WebCore/CMakeLists.txt        2015-04-30 06:29:36 UTC (rev 183618)
</span><span class="lines">@@ -1398,7 +1398,6 @@
</span><span class="cx"> dom/ExceptionCodePlaceholder.cpp
</span><span class="cx"> dom/FocusEvent.cpp
</span><span class="cx"> dom/GenericEventQueue.cpp
</span><del>- dom/GenericTaskQueue.cpp
</del><span class="cx"> dom/IdTargetObserver.cpp
</span><span class="cx"> dom/IdTargetObserverRegistry.cpp
</span><span class="cx"> dom/InlineStyleSheetOwner.cpp
</span></span></pre></div>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183617 => 183618)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-30 05:53:01 UTC (rev 183617)
+++ trunk/Source/WebCore/ChangeLog        2015-04-30 06:29:36 UTC (rev 183618)
</span><span class="lines">@@ -1,3 +1,30 @@
</span><ins>+2015-04-29 Jer Noble <jer.noble@apple.com>
+
+ Make GenericTaskQueue even more generic (and usable inside platform/)
+ https://bugs.webkit.org/show_bug.cgi?id=144414
+
+ Reviewed by Eric Carlson.
+
+ Templatize GenericTaskQueue so that it can be used from within platform/.
+
+ * CMakeLists.txt:
+ * WebCore.vcxproj/WebCore.vcxproj:
+ * WebCore.vcxproj/WebCore.vcxproj.filters:
+ * WebCore.xcodeproj/project.pbxproj:
+ * dom/GenericTaskQueue.cpp: Removed.
+ * html/HTMLMediaElement.h:
+ * platform/GenericTaskQueue.h: Renamed from Source/WebCore/dom/GenericTaskQueue.h.
+ (WebCore::TaskDispatcher::TaskDispatcher): Added default templatized class which just calls the parameter's postTask().
+ (WebCore::TaskDispatcher::postTask): Call context's postTask().
+ (WebCore::TaskDispatcher<Timer>::TaskDispatcher): Add a timer version which does not require a context.
+ (WebCore::TaskDispatcher<Timer>::postTask): Set the timer.
+ (WebCore::TaskDispatcher<Timer>::timerFired): Call the task.
+ (WebCore::GenericTaskQueue::GenericTaskQueue): Moved from .cpp.
+ (WebCore::GenericTaskQueue::enqueueTask): Ditto.
+ (WebCore::GenericTaskQueue::close): Ditto.
+ (WebCore::GenericTaskQueue::cancelAllTasks): Ditto.
+ (WebCore::GenericTaskQueue::hasPendingTasks): Ditto.
+
</ins><span class="cx"> 2015-04-29 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed build fix. WebCore has a weak symbol.
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (183617 => 183618)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-04-30 05:53:01 UTC (rev 183617)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2015-04-30 06:29:36 UTC (rev 183618)
</span><span class="lines">@@ -13399,7 +13399,6 @@
</span><span class="cx"> <ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Production|x64'">true</ExcludedFromBuild>
</span><span class="cx"> </ClCompile>
</span><span class="cx"> <ClCompile Include="..\dom\GenericEventQueue.cpp" />
</span><del>- <ClCompile Include="..\dom\GenericTaskQueue.cpp" />
</del><span class="cx"> <ClCompile Include="..\dom\IdTargetObserver.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">@@ -19789,6 +19788,7 @@
</span><span class="cx"> <ClInclude Include="..\platform\FileStreamClient.h" />
</span><span class="cx"> <ClInclude Include="..\platform\FileSystem.h" />
</span><span class="cx"> <ClInclude Include="..\platform\FloatConversion.h" />
</span><ins>+ <ClInclude Include="..\platform\GenericTaskQueue.h" />
</ins><span class="cx"> <ClInclude Include="..\platform\audio\AudioSession.h" />
</span><span class="cx"> <ClInclude Include="..\platform\audio\MediaSession.h" />
</span><span class="cx"> <ClInclude Include="..\platform\audio\MediaSessionManager.h" />
</span><span class="lines">@@ -20979,7 +20979,6 @@
</span><span class="cx"> <ClInclude Include="..\dom\ExceptionCode.h" />
</span><span class="cx"> <ClInclude Include="..\dom\ExceptionCodePlaceholder.h" />
</span><span class="cx"> <ClInclude Include="..\dom\GenericEventQueue.h" />
</span><del>- <ClInclude Include="..\dom\GenericTaskQueue.h" />
</del><span class="cx"> <ClInclude Include="..\dom\HashChangeEvent.h" />
</span><span class="cx"> <ClInclude Include="..\dom\IconURL.h" />
</span><span class="cx"> <ClInclude Include="..\dom\IdTargetObserver.h" />
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (183617 => 183618)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2015-04-30 05:53:01 UTC (rev 183617)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2015-04-30 06:29:36 UTC (rev 183618)
</span><span class="lines">@@ -3180,9 +3180,6 @@
</span><span class="cx"> <ClCompile Include="..\dom\GenericEventQueue.cpp">
</span><span class="cx"> <Filter>dom</Filter>
</span><span class="cx"> </ClCompile>
</span><del>- <ClCompile Include="..\dom\GenericTaskQueue.cpp">
- <Filter>dom</Filter>
- </ClCompile>
</del><span class="cx"> <ClCompile Include="..\dom\IdTargetObserver.cpp">
</span><span class="cx"> <Filter>dom</Filter>
</span><span class="cx"> </ClCompile>
</span><span class="lines">@@ -8181,6 +8178,9 @@
</span><span class="cx"> <ClInclude Include="..\platform\FloatConversion.h">
</span><span class="cx"> <Filter>platform</Filter>
</span><span class="cx"> </ClInclude>
</span><ins>+ <ClInclude Include="..\platform\GenericTaskQueue.h">
+ <Filter>platform</Filter>
+ </ClInclude>
</ins><span class="cx"> <ClInclude Include="..\platform\HostWindow.h">
</span><span class="cx"> <Filter>platform</Filter>
</span><span class="cx"> </ClInclude>
</span><span class="lines">@@ -10290,9 +10290,6 @@
</span><span class="cx"> <ClInclude Include="..\dom\GenericEventQueue.h">
</span><span class="cx"> <Filter>dom</Filter>
</span><span class="cx"> </ClInclude>
</span><del>- <ClInclude Include="..\dom\GenericTaskQueue.h">
- <Filter>dom</Filter>
- </ClInclude>
</del><span class="cx"> <ClInclude Include="..\dom\HashChangeEvent.h">
</span><span class="cx"> <Filter>dom</Filter>
</span><span class="cx"> </ClInclude>
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (183617 => 183618)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-04-30 05:53:01 UTC (rev 183617)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2015-04-30 06:29:36 UTC (rev 183618)
</span><span class="lines">@@ -5740,7 +5740,6 @@
</span><span class="cx">                 CD60C0C7193E87C7003C656B /* MediaTimeQTKit.h in Headers */ = {isa = PBXBuildFile; fileRef = CD60C0C5193E87C7003C656B /* MediaTimeQTKit.h */; };
</span><span class="cx">                 CD61FE671794AADB004101EB /* MediaSourceRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B1A942E115B5CE2200D525D1 /* MediaSourceRegistry.cpp */; };
</span><span class="cx">                 CD61FE681794AADB004101EB /* MediaSourceRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = B1A942E215B5CE2200D525D1 /* MediaSourceRegistry.h */; };
</span><del>-                CD62FB951AF018E70012ED7D /* GenericTaskQueue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD62FB931AF018E70012ED7D /* GenericTaskQueue.cpp */; };
</del><span class="cx">                 CD62FB961AF018E70012ED7D /* GenericTaskQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = CD62FB941AF018E70012ED7D /* GenericTaskQueue.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 CD641EB31818F5ED00EE4C41 /* MediaSourcePrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = CD641EB11818F5ED00EE4C41 /* MediaSourcePrivate.h */; };
</span><span class="cx">                 CD641EB41818F5ED00EE4C41 /* SourceBufferPrivate.h in Headers */ = {isa = PBXBuildFile; fileRef = CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */; };
</span><span class="lines">@@ -13295,7 +13294,6 @@
</span><span class="cx">                 CD5E5B601A15F156000C609E /* PageConfiguration.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PageConfiguration.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 CD60C0C4193E87C7003C656B /* MediaTimeQTKit.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MediaTimeQTKit.mm; sourceTree = "<group>"; };
</span><span class="cx">                 CD60C0C5193E87C7003C656B /* MediaTimeQTKit.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTimeQTKit.h; sourceTree = "<group>"; };
</span><del>-                CD62FB931AF018E70012ED7D /* GenericTaskQueue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GenericTaskQueue.cpp; sourceTree = "<group>"; };
</del><span class="cx">                 CD62FB941AF018E70012ED7D /* GenericTaskQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GenericTaskQueue.h; sourceTree = "<group>"; };
</span><span class="cx">                 CD641EB11818F5ED00EE4C41 /* MediaSourcePrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaSourcePrivate.h; sourceTree = "<group>"; };
</span><span class="cx">                 CD641EB21818F5ED00EE4C41 /* SourceBufferPrivate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SourceBufferPrivate.h; sourceTree = "<group>"; };
</span><span class="lines">@@ -21731,6 +21729,7 @@
</span><span class="cx">                                 C57FEDE01212EE9C0097BE65 /* FileSystem.cpp */,
</span><span class="cx">                                 514B3F720C722047000530DF /* FileSystem.h */,
</span><span class="cx">                                 BC073BA90C399B1F000F5979 /* FloatConversion.h */,
</span><ins>+                                CD62FB941AF018E70012ED7D /* GenericTaskQueue.h */,
</ins><span class="cx">                                 5179CE25195C821D0019C198 /* GamepadProvider.cpp */,
</span><span class="cx">                                 5179CE23195C81420019C198 /* GamepadProvider.h */,
</span><span class="cx">                                 5179CE29195C91860019C198 /* GamepadProviderClient.h */,
</span><span class="lines">@@ -23080,8 +23079,6 @@
</span><span class="cx">                                 A853123C11D0471B00D4D077 /* FragmentScriptingPermission.h */,
</span><span class="cx">                                 0720B09E14D3323500642955 /* GenericEventQueue.cpp */,
</span><span class="cx">                                 0720B09F14D3323500642955 /* GenericEventQueue.h */,
</span><del>-                                CD62FB931AF018E70012ED7D /* GenericTaskQueue.cpp */,
-                                CD62FB941AF018E70012ED7D /* GenericTaskQueue.h */,
</del><span class="cx">                                 2442BBF81194C9D300D49469 /* HashChangeEvent.h */,
</span><span class="cx">                                 8482B7441198C32E00BFB005 /* HashChangeEvent.idl */,
</span><span class="cx">                                 45BAC2AF1360BBAB005DA258 /* IconURL.h */,
</span><span class="lines">@@ -30461,7 +30458,6 @@
</span><span class="cx">                                 A833C7CC0A2CF07400D57664 /* XLinkNames.cpp in Sources */,
</span><span class="cx">                                 00B9318713BA8DB30035A948 /* XMLDocumentParser.cpp in Sources */,
</span><span class="cx">                                 00B9318913BA8DBC0035A948 /* XMLDocumentParserLibxml2.cpp in Sources */,
</span><del>-                                CD62FB951AF018E70012ED7D /* GenericTaskQueue.cpp in Sources */,
</del><span class="cx">                                 26A517FD1AB92238006335DF /* DFAMinimizer.cpp in Sources */,
</span><span class="cx">                                 00B9318B13BA8DC90035A948 /* XMLDocumentParserScope.cpp in Sources */,
</span><span class="cx">                                 59C28045138DC2410079B7E2 /* XMLErrors.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceWebCoredomGenericTaskQueuecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/GenericTaskQueue.cpp (183617 => 183618)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/GenericTaskQueue.cpp        2015-04-30 05:53:01 UTC (rev 183617)
+++ trunk/Source/WebCore/dom/GenericTaskQueue.cpp        2015-04-30 06:29:36 UTC (rev 183618)
</span><span class="lines">@@ -1,64 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * 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. ``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
- * 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 "GenericTaskQueue.h"
-
-#include "ScriptExecutionContext.h"
-
-namespace WebCore {
-
-GenericTaskQueue::GenericTaskQueue(ScriptExecutionContext& context)
- : m_context(context)
- , m_weakPtrFactory(this)
-{
-}
-
-void GenericTaskQueue::enqueueTask(std::function<void()> task)
-{
- ASSERT(!m_isClosed);
- ++m_pendingTasks;
- auto weakThis = m_weakPtrFactory.createWeakPtr();
- m_context.postTask([weakThis, task] (ScriptExecutionContext&) {
- if (!weakThis)
- return;
- --weakThis->m_pendingTasks;
- task();
- });
-}
-
-void GenericTaskQueue::close()
-{
- cancelAllTasks();
- m_isClosed = true;
-}
-
-void GenericTaskQueue::cancelAllTasks()
-{
- m_weakPtrFactory.revokeAll();
- m_pendingTasks = 0;
-}
-
-}
</del></span></pre></div>
<a id="trunkSourceWebCoredomGenericTaskQueueh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/dom/GenericTaskQueue.h (183617 => 183618)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/dom/GenericTaskQueue.h        2015-04-30 05:53:01 UTC (rev 183617)
+++ trunk/Source/WebCore/dom/GenericTaskQueue.h        2015-04-30 06:29:36 UTC (rev 183618)
</span><span class="lines">@@ -1,55 +0,0 @@
</span><del>-/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
- *
- * 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. ``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
- * 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 GenericTaskQueue_h
-#define GenericTaskQueue_h
-
-#include <wtf/Deque.h>
-#include <wtf/WeakPtr.h>
-
-namespace WebCore {
-
-class ScriptExecutionContext;
-
-class GenericTaskQueue {
-public:
- GenericTaskQueue(ScriptExecutionContext&);
-
- void enqueueTask(std::function<void()>);
- void close();
-
- void cancelAllTasks();
- bool hasPendingTasks() const { return m_pendingTasks; }
-
-private:
- ScriptExecutionContext& m_context;
- WeakPtrFactory<GenericTaskQueue> m_weakPtrFactory;
- unsigned m_pendingTasks { 0 };
- bool m_isClosed { false };
-};
-
-}
-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebCorehtmlHTMLMediaElementh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/HTMLMediaElement.h (183617 => 183618)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/HTMLMediaElement.h        2015-04-30 05:53:01 UTC (rev 183617)
+++ trunk/Source/WebCore/html/HTMLMediaElement.h        2015-04-30 06:29:36 UTC (rev 183618)
</span><span class="lines">@@ -741,7 +741,7 @@
</span><span class="cx"> Timer m_progressEventTimer;
</span><span class="cx"> Timer m_playbackProgressTimer;
</span><span class="cx"> Timer m_scanTimer;
</span><del>- GenericTaskQueue m_seekTaskQueue;
</del><ins>+ GenericTaskQueue<ScriptExecutionContext> m_seekTaskQueue;
</ins><span class="cx"> RefPtr<TimeRanges> m_playedTimeRanges;
</span><span class="cx"> GenericEventQueue m_asyncEventQueue;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformGenericTaskQueuehfromrev183617trunkSourceWebCoredomGenericTaskQueueh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebCore/platform/GenericTaskQueue.h (from rev 183617, trunk/Source/WebCore/dom/GenericTaskQueue.h) (0 => 183618)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/GenericTaskQueue.h         (rev 0)
+++ trunk/Source/WebCore/platform/GenericTaskQueue.h        2015-04-30 06:29:36 UTC (rev 183618)
</span><span class="lines">@@ -0,0 +1,129 @@
</span><ins>+/*
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
+ *
+ * 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. ``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
+ * 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 GenericTaskQueue_h
+#define GenericTaskQueue_h
+
+#include "Timer.h"
+#include <wtf/Deque.h>
+#include <wtf/WeakPtr.h>
+
+namespace WebCore {
+
+template <typename T>
+class TaskDispatcher {
+public:
+ TaskDispatcher(T& context)
+ : m_context(context)
+ {
+ }
+
+ void postTask(std::function<void()> f)
+ {
+ m_context.postTask(f);
+ }
+
+private:
+ T& m_context;
+};
+
+template<>
+class TaskDispatcher<Timer> {
+public:
+ TaskDispatcher()
+ : m_timer(*this, &TaskDispatcher<Timer>::timerFired)
+ {
+ }
+
+ void postTask(std::function<void()> function)
+ {
+ m_queue.append(function);
+ m_timer.startOneShot(0);
+ }
+
+ void timerFired()
+ {
+ Deque<std::function<void()>> queue;
+ queue.swap(m_queue);
+ for (std::function<void()>& function : queue)
+ function();
+ }
+
+ Timer m_timer;
+ Deque<std::function<void()>> m_queue;
+};
+
+template <typename T>
+class GenericTaskQueue {
+public:
+ GenericTaskQueue()
+ : m_weakPtrFactory(this)
+ , m_dispatcher()
+ {
+ }
+
+ GenericTaskQueue(T& t)
+ : m_weakPtrFactory(this)
+ , m_dispatcher(t)
+ {
+ }
+
+ typedef std::function<void()> TaskFunction;
+
+ void enqueueTask(TaskFunction task)
+ {
+ ASSERT(!m_isClosed);
+ ++m_pendingTasks;
+ auto weakThis = m_weakPtrFactory.createWeakPtr();
+ m_dispatcher.postTask([weakThis, task] {
+ if (!weakThis)
+ return;
+ task();
+ });
+ }
+
+ void close()
+ {
+ cancelAllTasks();
+ m_isClosed = true;
+ }
+
+ void cancelAllTasks()
+ {
+ m_weakPtrFactory.revokeAll();
+ m_pendingTasks = 0;
+ }
+ bool hasPendingTasks() const { return m_pendingTasks; }
+
+private:
+ WeakPtrFactory<GenericTaskQueue> m_weakPtrFactory;
+ TaskDispatcher<T> m_dispatcher;
+ unsigned m_pendingTasks { 0 };
+ bool m_isClosed { false };
+};
+
+}
+
+#endif
</ins></span></pre>
</div>
</div>
</body>
</html>