<!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>[168610] 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/168610">168610</a></dd>
<dt>Author</dt> <dd>zandobersek@gmail.com</dd>
<dt>Date</dt> <dd>2014-05-12 00:01:24 -0700 (Mon, 12 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Simplify FileThread::Task usage
https://bugs.webkit.org/show_bug.cgi?id=132798

Reviewed by Darin Adler.

Remove the createFileThreadTask functions and the related FileThreadTask helper classes.

Instead, the FileThread::Task class now has a templated constructor that takes in a pointer
to the object instance, a method, and a variadic pack of parameters. The pointer and the
cross-thread copies of all the parameters are then bound to the given method through std::bind().

Instead of createFileThreadTask, std::make_unique&lt;&gt;() should be used to construct unique pointers
that wrap FileThread::Task objects.

* WebCore.vcxproj/WebCore.vcxproj:
* WebCore.vcxproj/WebCore.vcxproj.filters:
* WebCore.xcodeproj/project.pbxproj:
* fileapi/AsyncFileStream.cpp:
(WebCore::AsyncFileStream::create):
(WebCore::AsyncFileStream::stop):
(WebCore::AsyncFileStream::getSize):
(WebCore::AsyncFileStream::openForRead):
(WebCore::AsyncFileStream::openForWrite):
(WebCore::AsyncFileStream::close):
(WebCore::AsyncFileStream::read):
(WebCore::AsyncFileStream::write):
(WebCore::AsyncFileStream::truncate):
* fileapi/FileThread.h:
(WebCore::FileThread::Task::Task):
(WebCore::FileThread::Task::performTask):
(WebCore::FileThread::Task::~Task): Deleted.
* fileapi/FileThreadTask.h: Removed.</pre>

<h3>Modified Paths</h3>
<ul>
<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="#trunkSourceWebCorefileapiAsyncFileStreamcpp">trunk/Source/WebCore/fileapi/AsyncFileStream.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiFileThreadh">trunk/Source/WebCore/fileapi/FileThread.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebCorefileapiFileThreadTaskh">trunk/Source/WebCore/fileapi/FileThreadTask.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (168609 => 168610)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-12 06:30:37 UTC (rev 168609)
+++ trunk/Source/WebCore/ChangeLog        2014-05-12 07:01:24 UTC (rev 168610)
</span><span class="lines">@@ -1,3 +1,38 @@
</span><ins>+2014-05-11  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
+
+        Simplify FileThread::Task usage
+        https://bugs.webkit.org/show_bug.cgi?id=132798
+
+        Reviewed by Darin Adler.
+
+        Remove the createFileThreadTask functions and the related FileThreadTask helper classes.
+
+        Instead, the FileThread::Task class now has a templated constructor that takes in a pointer
+        to the object instance, a method, and a variadic pack of parameters. The pointer and the
+        cross-thread copies of all the parameters are then bound to the given method through std::bind().
+
+        Instead of createFileThreadTask, std::make_unique&lt;&gt;() should be used to construct unique pointers
+        that wrap FileThread::Task objects.
+
+        * WebCore.vcxproj/WebCore.vcxproj:
+        * WebCore.vcxproj/WebCore.vcxproj.filters:
+        * WebCore.xcodeproj/project.pbxproj:
+        * fileapi/AsyncFileStream.cpp:
+        (WebCore::AsyncFileStream::create):
+        (WebCore::AsyncFileStream::stop):
+        (WebCore::AsyncFileStream::getSize):
+        (WebCore::AsyncFileStream::openForRead):
+        (WebCore::AsyncFileStream::openForWrite):
+        (WebCore::AsyncFileStream::close):
+        (WebCore::AsyncFileStream::read):
+        (WebCore::AsyncFileStream::write):
+        (WebCore::AsyncFileStream::truncate):
+        * fileapi/FileThread.h:
+        (WebCore::FileThread::Task::Task):
+        (WebCore::FileThread::Task::performTask):
+        (WebCore::FileThread::Task::~Task): Deleted.
+        * fileapi/FileThreadTask.h: Removed.
+
</ins><span class="cx"> 2014-05-11  Benjamin Poulain  &lt;benjamin@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Do not create a temporary string to append the SVGLength's unit
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj (168609 => 168610)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-05-12 06:30:37 UTC (rev 168609)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj        2014-05-12 07:01:24 UTC (rev 168610)
</span><span class="lines">@@ -20514,7 +20514,6 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\fileapi\FileReaderLoaderClient.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\fileapi\FileReaderSync.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\fileapi\FileThread.h&quot; /&gt;
</span><del>-    &lt;ClInclude Include=&quot;..\fileapi\FileThreadTask.h&quot; /&gt;
</del><span class="cx">     &lt;ClInclude Include=&quot;..\html\FormAssociatedElement.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\html\FormController.h&quot; /&gt;
</span><span class="cx">     &lt;ClInclude Include=&quot;..\html\FormDataList.h&quot; /&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorevcxprojWebCorevcxprojfilters"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters (168609 => 168610)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-05-12 06:30:37 UTC (rev 168609)
+++ trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters        2014-05-12 07:01:24 UTC (rev 168610)
</span><span class="lines">@@ -10765,9 +10765,6 @@
</span><span class="cx">     &lt;ClInclude Include=&quot;..\fileapi\FileThread.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;html&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span><del>-    &lt;ClInclude Include=&quot;..\fileapi\FileThreadTask.h&quot;&gt;
-      &lt;Filter&gt;html&lt;/Filter&gt;
-    &lt;/ClInclude&gt;
</del><span class="cx">     &lt;ClInclude Include=&quot;..\html\FormAssociatedElement.h&quot;&gt;
</span><span class="cx">       &lt;Filter&gt;html&lt;/Filter&gt;
</span><span class="cx">     &lt;/ClInclude&gt;
</span></span></pre></div>
<a id="trunkSourceWebCoreWebCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (168609 => 168610)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-05-12 06:30:37 UTC (rev 168609)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj        2014-05-12 07:01:24 UTC (rev 168610)
</span><span class="lines">@@ -3393,7 +3393,6 @@
</span><span class="cx">                 976D6C89122B8A3D001FD1F7 /* FileReader.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C6A122B8A3D001FD1F7 /* FileReader.h */; };
</span><span class="cx">                 976D6C8D122B8A3D001FD1F7 /* FileThread.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976D6C6E122B8A3D001FD1F7 /* FileThread.cpp */; };
</span><span class="cx">                 976D6C8E122B8A3D001FD1F7 /* FileThread.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C6F122B8A3D001FD1F7 /* FileThread.h */; };
</span><del>-                976D6C8F122B8A3D001FD1F7 /* FileThreadTask.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C70122B8A3D001FD1F7 /* FileThreadTask.h */; };
</del><span class="cx">                 976D6C94122B8A3D001FD1F7 /* ThreadableBlobRegistry.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976D6C75122B8A3D001FD1F7 /* ThreadableBlobRegistry.cpp */; };
</span><span class="cx">                 976D6C95122B8A3D001FD1F7 /* ThreadableBlobRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 976D6C76122B8A3D001FD1F7 /* ThreadableBlobRegistry.h */; };
</span><span class="cx">                 976F36EA14686225005E93B4 /* SecurityContext.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 976F36E814686225005E93B4 /* SecurityContext.cpp */; };
</span><span class="lines">@@ -10440,7 +10439,6 @@
</span><span class="cx">                 976D6C6A122B8A3D001FD1F7 /* FileReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileReader.h; path = fileapi/FileReader.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 976D6C6E122B8A3D001FD1F7 /* FileThread.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FileThread.cpp; path = fileapi/FileThread.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 976D6C6F122B8A3D001FD1F7 /* FileThread.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileThread.h; path = fileapi/FileThread.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><del>-                976D6C70122B8A3D001FD1F7 /* FileThreadTask.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FileThreadTask.h; path = fileapi/FileThreadTask.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</del><span class="cx">                 976D6C75122B8A3D001FD1F7 /* ThreadableBlobRegistry.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ThreadableBlobRegistry.cpp; path = fileapi/ThreadableBlobRegistry.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 976D6C76122B8A3D001FD1F7 /* ThreadableBlobRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ThreadableBlobRegistry.h; path = fileapi/ThreadableBlobRegistry.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 976F36E814686225005E93B4 /* SecurityContext.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityContext.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -17896,7 +17894,6 @@
</span><span class="cx">                                 E1AB1EBD14E9E3A800449E13 /* FileReaderSync.idl */,
</span><span class="cx">                                 976D6C6E122B8A3D001FD1F7 /* FileThread.cpp */,
</span><span class="cx">                                 976D6C6F122B8A3D001FD1F7 /* FileThread.h */,
</span><del>-                                976D6C70122B8A3D001FD1F7 /* FileThreadTask.h */,
</del><span class="cx">                                 976D6C75122B8A3D001FD1F7 /* ThreadableBlobRegistry.cpp */,
</span><span class="cx">                                 976D6C76122B8A3D001FD1F7 /* ThreadableBlobRegistry.h */,
</span><span class="cx">                                 976D6C5C122B8A3D001FD1F7 /* WebKitBlobBuilder.cpp */,
</span><span class="lines">@@ -23916,7 +23913,6 @@
</span><span class="cx">                                 26C17A3E1491D2D400D12BA2 /* FileSystemIOS.h in Headers */,
</span><span class="cx">                                 976D6C8E122B8A3D001FD1F7 /* FileThread.h in Headers */,
</span><span class="cx">                                 1CC6B06D18F8526B0007ECCD /* WebProfilerAgent.h in Headers */,
</span><del>-                                976D6C8F122B8A3D001FD1F7 /* FileThreadTask.h in Headers */,
</del><span class="cx">                                 BC5EB69F0E81DAEB00B25965 /* FillLayer.h in Headers */,
</span><span class="cx">                                 845E72F80FD261EE00A87D79 /* Filter.h in Headers */,
</span><span class="cx">                                 08C9251A0FCC7C4A00480DEC /* FilterEffect.h in Headers */,
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiAsyncFileStreamcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/AsyncFileStream.cpp (168609 => 168610)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/AsyncFileStream.cpp        2014-05-12 06:30:37 UTC (rev 168609)
+++ trunk/Source/WebCore/fileapi/AsyncFileStream.cpp        2014-05-12 07:01:24 UTC (rev 168610)
</span><span class="lines">@@ -39,7 +39,6 @@
</span><span class="cx"> #include &quot;FileStream.h&quot;
</span><span class="cx"> #include &quot;FileStreamClient.h&quot;
</span><span class="cx"> #include &quot;FileThread.h&quot;
</span><del>-#include &quot;FileThreadTask.h&quot;
</del><span class="cx"> #include &quot;MainThreadTask.h&quot;
</span><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -80,7 +79,7 @@
</span><span class="cx">     // This is balanced by the deref in derefProxyOnContext below.
</span><span class="cx">     proxy-&gt;ref();
</span><span class="cx"> 
</span><del>-    fileThread()-&gt;postTask(createFileThreadTask(proxy.get(), &amp;AsyncFileStream::startOnFileThread));
</del><ins>+    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(proxy.get(), &amp;AsyncFileStream::startOnFileThread));
</ins><span class="cx"> 
</span><span class="cx">     return proxy.release();
</span><span class="cx"> }
</span><span class="lines">@@ -110,7 +109,7 @@
</span><span class="cx">     setClient(0);
</span><span class="cx"> 
</span><span class="cx">     fileThread()-&gt;unscheduleTasks(m_stream.get());
</span><del>-    fileThread()-&gt;postTask(createFileThreadTask(this, &amp;AsyncFileStream::stopOnFileThread));
</del><ins>+    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::stopOnFileThread));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static void derefProxyOnMainThread(AsyncFileStream* proxy)
</span><span class="lines">@@ -133,7 +132,7 @@
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::getSize(const String&amp; path, double expectedModificationTime)
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(createFileThreadTask(this, &amp;AsyncFileStream::getSizeOnFileThread, path, expectedModificationTime));
</del><ins>+    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::getSizeOnFileThread, path, expectedModificationTime));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::getSizeOnFileThread(const String&amp; path, double expectedModificationTime)
</span><span class="lines">@@ -150,7 +149,7 @@
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::openForRead(const String&amp; path, long long offset, long long length)
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(createFileThreadTask(this, &amp;AsyncFileStream::openForReadOnFileThread, path, offset, length));
</del><ins>+    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::openForReadOnFileThread, path, offset, length));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::openForReadOnFileThread(const String&amp; path, long long offset, long long length)
</span><span class="lines">@@ -161,9 +160,7 @@
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::openForWrite(const String&amp; path)
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(
-        createFileThreadTask(this,
-                             &amp;AsyncFileStream::openForWriteOnFileThread, path));
</del><ins>+    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::openForWriteOnFileThread, path));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::openForWriteOnFileThread(const String&amp; path)
</span><span class="lines">@@ -174,7 +171,7 @@
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::close()
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(createFileThreadTask(this, &amp;AsyncFileStream::closeOnFileThread));
</del><ins>+    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::closeOnFileThread));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::closeOnFileThread()
</span><span class="lines">@@ -190,9 +187,7 @@
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::read(char* buffer, int length)
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(
-        createFileThreadTask(this, &amp;AsyncFileStream::readOnFileThread,
-                             AllowCrossThreadAccess(buffer), length));
</del><ins>+    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::readOnFileThread, AllowCrossThreadAccess(buffer), length));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::readOnFileThread(char* buffer, int length)
</span><span class="lines">@@ -209,7 +204,7 @@
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::write(const URL&amp; blobURL, long long position, int length)
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(createFileThreadTask(this, &amp;AsyncFileStream::writeOnFileThread, blobURL, position, length));
</del><ins>+    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::writeOnFileThread, blobURL, position, length));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::writeOnFileThread(const URL&amp; blobURL, long long position, int length)
</span><span class="lines">@@ -226,7 +221,7 @@
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::truncate(long long position)
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(createFileThreadTask(this, &amp;AsyncFileStream::truncateOnFileThread, position));
</del><ins>+    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::truncateOnFileThread, position));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void AsyncFileStream::truncateOnFileThread(long long position)
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiFileThreadh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/FileThread.h (168609 => 168610)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/FileThread.h        2014-05-12 06:30:37 UTC (rev 168609)
+++ trunk/Source/WebCore/fileapi/FileThread.h        2014-05-12 07:01:24 UTC (rev 168610)
</span><span class="lines">@@ -33,6 +33,8 @@
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(BLOB)
</span><span class="cx"> 
</span><ins>+#include &quot;CrossThreadCopier.h&quot;
+#include &lt;functional&gt;
</ins><span class="cx"> #include &lt;wtf/MessageQueue.h&gt;
</span><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/Threading.h&gt;
</span><span class="lines">@@ -56,11 +58,21 @@
</span><span class="cx">     class Task {
</span><span class="cx">         WTF_MAKE_NONCOPYABLE(Task);
</span><span class="cx">     public:
</span><del>-        virtual ~Task() { }
-        virtual void performTask() = 0;
</del><ins>+        template&lt;typename T, typename Method, typename... Parameters&gt;
+        Task(T* instance, Method method, const Parameters&amp;... parameters)
+            : m_task(std::bind(method, instance, typename CrossThreadCopier&lt;Parameters&gt;::Type(CrossThreadCopier&lt;Parameters&gt;::copy(parameters))...))
+            , m_instance(instance)
+        {
+        }
+
+        void performTask()
+        {
+            m_task();
+        }
</ins><span class="cx">         void* instance() const { return m_instance; }
</span><del>-    protected:
-        Task(void* instance) : m_instance(instance) { }
</del><ins>+
+    private:
+        std::function&lt;void ()&gt; m_task;
</ins><span class="cx">         void* m_instance;
</span><span class="cx">     };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiFileThreadTaskh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebCore/fileapi/FileThreadTask.h (168609 => 168610)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/FileThreadTask.h        2014-05-12 06:30:37 UTC (rev 168609)
+++ trunk/Source/WebCore/fileapi/FileThreadTask.h        2014-05-12 07:01:24 UTC (rev 168610)
</span><span class="lines">@@ -1,206 +0,0 @@
</span><del>-/*
- * Copyright (C) 2010 Google 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:
- *
- *     * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *     * 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.
- *     * Neither the name of Google Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * &quot;AS IS&quot; 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 THE COPYRIGHT
- * OWNER 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 FileThreadTask_h
-#define FileThreadTask_h
-
-#include &quot;CrossThreadCopier.h&quot;
-#include &quot;CrossThreadTask.h&quot;
-#include &quot;FileThread.h&quot;
-#include &lt;wtf/PassRefPtr.h&gt;
-
-namespace WebCore {
-
-template&lt;typename T&gt;
-class FileThreadTask0 : public FileThread::Task {
-public:
-    typedef void (T::*Method)();
-    typedef FileThreadTask0&lt;T&gt; FileThreadTaskImpl;
-
-    FileThreadTask0(T* instance, Method method)
-        : FileThread::Task(instance)
-        , m_method(method)
-    {
-    }
-
-private:
-    virtual void performTask() override
-    {
-        (*static_cast&lt;T*&gt;(instance()).*m_method)();
-    }
-
-private:
-    Method m_method;
-};
-
-template&lt;typename T, typename P1, typename MP1&gt;
-class FileThreadTask1 : public FileThread::Task {
-public:
-    typedef void (T::*Method)(MP1);
-    typedef FileThreadTask1&lt;T, P1, MP1&gt; FileThreadTaskImpl;
-    typedef typename CrossThreadTaskTraits&lt;P1&gt;::ParamType Param1;
-
-    FileThreadTask1(T* instance, Method method, Param1 parameter1)
-        : FileThread::Task(instance)
-        , m_method(method)
-        , m_parameter1(parameter1)
-    {
-    }
-
-private:
-    virtual void performTask() override
-    {
-        (*static_cast&lt;T*&gt;(instance()).*m_method)(m_parameter1);
-    }
-
-private:
-    Method m_method;
-    P1 m_parameter1;
-};
-
-template&lt;typename T, typename P1, typename MP1, typename P2, typename MP2&gt;
-class FileThreadTask2 : public FileThread::Task {
-public:
-    typedef void (T::*Method)(MP1, MP2);
-    typedef FileThreadTask2&lt;T, P1, MP1, P2, MP2&gt; FileThreadTaskImpl;
-    typedef typename CrossThreadTaskTraits&lt;P1&gt;::ParamType Param1;
-    typedef typename CrossThreadTaskTraits&lt;P2&gt;::ParamType Param2;
-
-    FileThreadTask2(T* instance, Method method, Param1 parameter1, Param2 parameter2)
-        : FileThread::Task(instance)
-        , m_method(method)
-        , m_parameter1(parameter1)
-        , m_parameter2(parameter2)
-    {
-    }
-
-private:
-    virtual void performTask() override
-    {
-        (*static_cast&lt;T*&gt;(instance()).*m_method)(m_parameter1, m_parameter2);
-    }
-
-private:
-    Method m_method;
-    P1 m_parameter1;
-    P2 m_parameter2;
-};
-
-template&lt;typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3&gt;
-class FileThreadTask3 : public FileThread::Task {
-public:
-    typedef void (T::*Method)(MP1, MP2, MP3);
-    typedef FileThreadTask3&lt;T, P1, MP1, P2, MP2, P3, MP3&gt; FileThreadTaskImpl;
-    typedef typename CrossThreadTaskTraits&lt;P1&gt;::ParamType Param1;
-    typedef typename CrossThreadTaskTraits&lt;P2&gt;::ParamType Param2;
-    typedef typename CrossThreadTaskTraits&lt;P3&gt;::ParamType Param3;
-
-    FileThreadTask3(T* instance, Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3)
-        : FileThread::Task(instance)
-        , m_method(method)
-        , m_parameter1(parameter1)
-        , m_parameter2(parameter2)
-        , m_parameter3(parameter3)
-    {
-    }
-
-private:
-    virtual void performTask() override
-    {
-        (*static_cast&lt;T*&gt;(instance()).*m_method)(m_parameter1, m_parameter2, m_parameter3);
-    }
-
-private:
-    Method m_method;
-    P1 m_parameter1;
-    P2 m_parameter2;
-    P3 m_parameter3;
-};
-
-template&lt;typename T&gt;
-std::unique_ptr&lt;FileThread::Task&gt; createFileThreadTask(
-    T* const callee,
-    void (T::*method)());
-
-template&lt;typename T&gt;
-std::unique_ptr&lt;FileThread::Task&gt; createFileThreadTask(
-    T* const callee,
-    void (T::*method)())
-{
-    return std::make_unique&lt;FileThreadTask0&lt;T&gt;&gt;(
-        callee,
-        method);
-}
-
-template&lt;typename T, typename P1, typename MP1&gt;
-std::unique_ptr&lt;FileThread::Task&gt; createFileThreadTask(
-    T* const callee,
-    void (T::*method)(MP1),
-    const P1&amp; parameter1)
-{
-    return std::make_unique&lt;FileThreadTask1&lt;T, typename CrossThreadCopier&lt;P1&gt;::Type, MP1&gt;&gt;(
-        callee,
-        method,
-        CrossThreadCopier&lt;P1&gt;::copy(parameter1));
-}
-
-template&lt;typename T, typename P1, typename MP1, typename P2, typename MP2&gt;
-std::unique_ptr&lt;FileThread::Task&gt; createFileThreadTask(
-    T* const callee,
-    void (T::*method)(MP1, MP2),
-    const P1&amp; parameter1,
-    const P2&amp; parameter2)
-{
-    return std::make_unique&lt;FileThreadTask2&lt;T, typename CrossThreadCopier&lt;P1&gt;::Type, MP1, typename CrossThreadCopier&lt;P2&gt;::Type, MP2&gt;&gt;(
-        callee,
-        method,
-        CrossThreadCopier&lt;P1&gt;::copy(parameter1),
-        CrossThreadCopier&lt;P2&gt;::copy(parameter2));
-}
-
-template&lt;typename T, typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3&gt;
-std::unique_ptr&lt;FileThread::Task&gt; createFileThreadTask(
-    T* const callee,
-    void (T::*method)(MP1, MP2, MP3),
-    const P1&amp; parameter1,
-    const P2&amp; parameter2,
-    const P3&amp; parameter3)
-{
-    return std::make_unique&lt;FileThreadTask3&lt;T, typename CrossThreadCopier&lt;P1&gt;::Type, MP1, typename CrossThreadCopier&lt;P2&gt;::Type, MP2, typename CrossThreadCopier&lt;P3&gt;::Type, MP3&gt;&gt;(
-        callee,
-        method,
-        CrossThreadCopier&lt;P1&gt;::copy(parameter1),
-        CrossThreadCopier&lt;P2&gt;::copy(parameter2),
-        CrossThreadCopier&lt;P3&gt;::copy(parameter3));
-}
-
-} // namespace WebCore
-
-#endif // FileThreadTask_h
</del></span></pre>
</div>
</div>

</body>
</html>