<!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>[169675] 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/169675">169675</a></dd>
<dt>Author</dt> <dd>zandobersek@gmail.com</dd>
<dt>Date</dt> <dd>2014-06-07 06:29:31 -0700 (Sat, 07 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Use C++11 lambdas to construct FileThread::Task objects
https://bugs.webkit.org/show_bug.cgi?id=133079

Reviewed by Darin Adler.

Have FileThread::Task constructor take in a std::function&lt;void ()&gt;-like object
as the second parameter. Much like with ScriptExecutionContext::Task, the idea here
is to use inlined C++11 lambdas in FileThread::postTask() calls. Because FileThread::Task
also requires an instance pointer, a brace-init list is passed to these calls, passing
in the instance pointer as the first parameter and the C++11 lambda as the second.

FileThread::postTask() now takes in a FileThread::Task rvalue and moves it onto the heap
and into the queue.

In AsyncFileStream.cpp, calls to FileThread::postTask() are updated to use C++11 lambdas.
Uses of MainThreadTask are also replaced by C++11 lambdas. This modernizes the code and
removes a lot of helper functions.

FileThread::Task doesn't use CrossThreadCopier anymore. Instead, we manually produce
thread-safe copies as necessary. At the moment this approach produces another copy when
passing the freshly-copied object into the lambda, but this will be avoidable once we
make C++14 and the lambda capture expression support mandatory.

* 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):
(WebCore::didStart): Deleted.
(WebCore::AsyncFileStream::startOnFileThread): Deleted.
(WebCore::derefProxyOnMainThread): Deleted.
(WebCore::AsyncFileStream::stopOnFileThread): Deleted.
(WebCore::didGetSize): Deleted.
(WebCore::AsyncFileStream::getSizeOnFileThread): Deleted.
(WebCore::didOpen): Deleted.
(WebCore::AsyncFileStream::openForReadOnFileThread): Deleted.
(WebCore::AsyncFileStream::openForWriteOnFileThread): Deleted.
(WebCore::AsyncFileStream::closeOnFileThread): Deleted.
(WebCore::didRead): Deleted.
(WebCore::AsyncFileStream::readOnFileThread): Deleted.
(WebCore::didWrite): Deleted.
(WebCore::AsyncFileStream::writeOnFileThread): Deleted.
(WebCore::didTruncate): Deleted.
(WebCore::AsyncFileStream::truncateOnFileThread): Deleted.
* fileapi/AsyncFileStream.h:
* fileapi/FileThread.cpp:
(WebCore::FileThread::postTask):
* fileapi/FileThread.h:
(WebCore::FileThread::Task::Task):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorefileapiAsyncFileStreamcpp">trunk/Source/WebCore/fileapi/AsyncFileStream.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiAsyncFileStreamh">trunk/Source/WebCore/fileapi/AsyncFileStream.h</a></li>
<li><a href="#trunkSourceWebCorefileapiFileThreadcpp">trunk/Source/WebCore/fileapi/FileThread.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiFileThreadh">trunk/Source/WebCore/fileapi/FileThread.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (169674 => 169675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-06-07 13:10:23 UTC (rev 169674)
+++ trunk/Source/WebCore/ChangeLog        2014-06-07 13:29:31 UTC (rev 169675)
</span><span class="lines">@@ -1,5 +1,62 @@
</span><span class="cx"> 2014-06-07  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
</span><span class="cx"> 
</span><ins>+        Use C++11 lambdas to construct FileThread::Task objects
+        https://bugs.webkit.org/show_bug.cgi?id=133079
+
+        Reviewed by Darin Adler.
+
+        Have FileThread::Task constructor take in a std::function&lt;void ()&gt;-like object
+        as the second parameter. Much like with ScriptExecutionContext::Task, the idea here
+        is to use inlined C++11 lambdas in FileThread::postTask() calls. Because FileThread::Task
+        also requires an instance pointer, a brace-init list is passed to these calls, passing
+        in the instance pointer as the first parameter and the C++11 lambda as the second.
+
+        FileThread::postTask() now takes in a FileThread::Task rvalue and moves it onto the heap
+        and into the queue.
+
+        In AsyncFileStream.cpp, calls to FileThread::postTask() are updated to use C++11 lambdas.
+        Uses of MainThreadTask are also replaced by C++11 lambdas. This modernizes the code and
+        removes a lot of helper functions.
+
+        FileThread::Task doesn't use CrossThreadCopier anymore. Instead, we manually produce
+        thread-safe copies as necessary. At the moment this approach produces another copy when
+        passing the freshly-copied object into the lambda, but this will be avoidable once we
+        make C++14 and the lambda capture expression support mandatory.
+
+        * 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):
+        (WebCore::didStart): Deleted.
+        (WebCore::AsyncFileStream::startOnFileThread): Deleted.
+        (WebCore::derefProxyOnMainThread): Deleted.
+        (WebCore::AsyncFileStream::stopOnFileThread): Deleted.
+        (WebCore::didGetSize): Deleted.
+        (WebCore::AsyncFileStream::getSizeOnFileThread): Deleted.
+        (WebCore::didOpen): Deleted.
+        (WebCore::AsyncFileStream::openForReadOnFileThread): Deleted.
+        (WebCore::AsyncFileStream::openForWriteOnFileThread): Deleted.
+        (WebCore::AsyncFileStream::closeOnFileThread): Deleted.
+        (WebCore::didRead): Deleted.
+        (WebCore::AsyncFileStream::readOnFileThread): Deleted.
+        (WebCore::didWrite): Deleted.
+        (WebCore::AsyncFileStream::writeOnFileThread): Deleted.
+        (WebCore::didTruncate): Deleted.
+        (WebCore::AsyncFileStream::truncateOnFileThread): Deleted.
+        * fileapi/AsyncFileStream.h:
+        * fileapi/FileThread.cpp:
+        (WebCore::FileThread::postTask):
+        * fileapi/FileThread.h:
+        (WebCore::FileThread::Task::Task):
+
+2014-06-07  Zan Dobersek  &lt;zdobersek@igalia.com&gt;
+
</ins><span class="cx">         Pass C++11 lambdas to callOnMainThread() calls in IconDatabase
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=133374
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiAsyncFileStreamcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/AsyncFileStream.cpp (169674 => 169675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/AsyncFileStream.cpp        2014-06-07 13:10:23 UTC (rev 169674)
+++ trunk/Source/WebCore/fileapi/AsyncFileStream.cpp        2014-06-07 13:29:31 UTC (rev 169675)
</span><span class="lines">@@ -37,7 +37,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;MainThreadTask.h&quot;
</del><span class="cx"> #include &lt;wtf/MainThread.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -77,8 +76,19 @@
</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(std::make_unique&lt;FileThread::Task&gt;(proxy.get(), &amp;AsyncFileStream::startOnFileThread));
</del><ins>+    AsyncFileStream* proxyPtr = proxy.get();
+    fileThread()-&gt;postTask({ proxyPtr, [=] {
+        // FIXME: It is not correct to check m_client from a secondary thread - stop() could be racing with this check.
+        if (!proxyPtr-&gt;client())
+            return;
</ins><span class="cx"> 
</span><ins>+        proxyPtr-&gt;m_stream-&gt;start();
+        callOnMainThread([proxyPtr] {
+            if (proxyPtr-&gt;client())
+                proxyPtr-&gt;client()-&gt;didStart();
+        });
+    } });
+
</ins><span class="cx">     return proxy.release();
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -86,146 +96,96 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void didStart(AsyncFileStream* proxy)
-{
-    if (proxy-&gt;client())
-        proxy-&gt;client()-&gt;didStart();
-}
-
-void AsyncFileStream::startOnFileThread()
-{
-    // FIXME: It is not correct to check m_client from a secondary thread - stop() could be racing with this check.
-    if (!m_client)
-        return;
-    m_stream-&gt;start();
-    callOnMainThread(MainThreadTask(didStart, AllowCrossThreadAccess(this)));
-}
-
</del><span class="cx"> void AsyncFileStream::stop()
</span><span class="cx"> {
</span><span class="cx">     // Clear the client so that we won't be invoking callbacks on the client.
</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(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::stopOnFileThread));
</del><ins>+    fileThread()-&gt;postTask({ this, [this] {
+        m_stream-&gt;stop();
+        callOnMainThread([this] {
+            ASSERT(hasOneRef());
+            deref();
+        });
+    } });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-static void derefProxyOnMainThread(AsyncFileStream* proxy)
-{
-    ASSERT(proxy-&gt;hasOneRef());
-    proxy-&gt;deref();
-}
-
-void AsyncFileStream::stopOnFileThread()
-{
-    m_stream-&gt;stop();
-    callOnMainThread(MainThreadTask(derefProxyOnMainThread, AllowCrossThreadAccess(this)));
-}
-
-static void didGetSize(AsyncFileStream* proxy, long long size)
-{
-    if (proxy-&gt;client())
-        proxy-&gt;client()-&gt;didGetSize(size);
-}
-
</del><span class="cx"> void AsyncFileStream::getSize(const String&amp; path, double expectedModificationTime)
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::getSizeOnFileThread, path, expectedModificationTime));
</del><ins>+    String pathCopy = path.isolatedCopy();
+    fileThread()-&gt;postTask({ this, [this, pathCopy, expectedModificationTime] {
+        long long size = m_stream-&gt;getSize(pathCopy, expectedModificationTime);
+        callOnMainThread([this, size] {
+            if (client())
+                client()-&gt;didGetSize(size);
+        });
+    } });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AsyncFileStream::getSizeOnFileThread(const String&amp; path, double expectedModificationTime)
-{
-    long long size = m_stream-&gt;getSize(path, expectedModificationTime);
-    callOnMainThread(MainThreadTask(didGetSize, AllowCrossThreadAccess(this), size));
-}
-
-static void didOpen(AsyncFileStream* proxy, bool success)
-{
-    if (proxy-&gt;client())
-        proxy-&gt;client()-&gt;didOpen(success);
-}
-
</del><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(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::openForReadOnFileThread, path, offset, length));
</del><ins>+    String pathCopy = path.isolatedCopy();
+    fileThread()-&gt;postTask({ this, [this, pathCopy, offset, length] {
+        bool success = m_stream-&gt;openForRead(pathCopy, offset, length);
+        callOnMainThread([this, success] {
+            if (client())
+                client()-&gt;didOpen(success);
+        });
+    } });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AsyncFileStream::openForReadOnFileThread(const String&amp; path, long long offset, long long length)
-{
-    bool success = m_stream-&gt;openForRead(path, offset, length);
-    callOnMainThread(MainThreadTask(didOpen, AllowCrossThreadAccess(this), success));
-}
-
</del><span class="cx"> void AsyncFileStream::openForWrite(const String&amp; path)
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::openForWriteOnFileThread, path));
</del><ins>+    String pathCopy = path.isolatedCopy();
+    fileThread()-&gt;postTask({ this, [this, pathCopy] {
+        bool success = m_stream-&gt;openForWrite(pathCopy);
+        callOnMainThread([this, success] {
+            if (client())
+                client()-&gt;didOpen(success);
+        });
+    } });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AsyncFileStream::openForWriteOnFileThread(const String&amp; path)
-{
-    bool success = m_stream-&gt;openForWrite(path);
-    callOnMainThread(MainThreadTask(didOpen, AllowCrossThreadAccess(this), success));
-}
-
</del><span class="cx"> void AsyncFileStream::close()
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::closeOnFileThread));
</del><ins>+    fileThread()-&gt;postTask({this, [this] {
+        m_stream-&gt;close();
+    } });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AsyncFileStream::closeOnFileThread()
-{
-    m_stream-&gt;close();
-}
-
-static void didRead(AsyncFileStream* proxy, int bytesRead)
-{
-    if (proxy-&gt;client())
-        proxy-&gt;client()-&gt;didRead(bytesRead);
-}
-
</del><span class="cx"> void AsyncFileStream::read(char* buffer, int length)
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::readOnFileThread, AllowCrossThreadAccess(buffer), length));
</del><ins>+    fileThread()-&gt;postTask({ this, [this, buffer, length] {
+        int bytesRead = m_stream-&gt;read(buffer, length);
+        callOnMainThread([this, bytesRead] {
+            if (client())
+                client()-&gt;didRead(bytesRead);
+        });
+    } });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AsyncFileStream::readOnFileThread(char* buffer, int length)
-{
-    int bytesRead = m_stream-&gt;read(buffer, length);
-    callOnMainThread(MainThreadTask(didRead, AllowCrossThreadAccess(this), bytesRead));
-}
-
-static void didWrite(AsyncFileStream* proxy, int bytesWritten)
-{
-    if (proxy-&gt;client())
-        proxy-&gt;client()-&gt;didWrite(bytesWritten);
-}
-
</del><span class="cx"> void AsyncFileStream::write(const URL&amp; blobURL, long long position, int length)
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::writeOnFileThread, blobURL, position, length));
</del><ins>+    URL blobURLCopy = blobURL.copy();
+    fileThread()-&gt;postTask({ this, [this, blobURLCopy, position, length] {
+        int bytesWritten = m_stream-&gt;write(blobURLCopy, position, length);
+        callOnMainThread([this, bytesWritten] {
+            if (client())
+                client()-&gt;didWrite(bytesWritten);
+        });
+    } });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AsyncFileStream::writeOnFileThread(const URL&amp; blobURL, long long position, int length)
-{
-    int bytesWritten = m_stream-&gt;write(blobURL, position, length);
-    callOnMainThread(MainThreadTask(didWrite, AllowCrossThreadAccess(this), bytesWritten));
-}
-
-static void didTruncate(AsyncFileStream* proxy, bool success)
-{
-    if (proxy-&gt;client())
-        proxy-&gt;client()-&gt;didTruncate(success);
-}
-
</del><span class="cx"> void AsyncFileStream::truncate(long long position)
</span><span class="cx"> {
</span><del>-    fileThread()-&gt;postTask(std::make_unique&lt;FileThread::Task&gt;(this, &amp;AsyncFileStream::truncateOnFileThread, position));
</del><ins>+    fileThread()-&gt;postTask({ this, [this, position] {
+        bool success = m_stream-&gt;truncate(position);
+        callOnMainThread([this, success] {
+            if (client())
+                client()-&gt;didTruncate(success);
+        });
+    } });
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void AsyncFileStream::truncateOnFileThread(long long position)
-{
-    bool success = m_stream-&gt;truncate(position);
-    callOnMainThread(MainThreadTask(didTruncate, AllowCrossThreadAccess(this), success));
-}
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiAsyncFileStreamh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/AsyncFileStream.h (169674 => 169675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/AsyncFileStream.h        2014-06-07 13:10:23 UTC (rev 169674)
+++ trunk/Source/WebCore/fileapi/AsyncFileStream.h        2014-06-07 13:29:31 UTC (rev 169675)
</span><span class="lines">@@ -65,19 +65,7 @@
</span><span class="cx"> private:
</span><span class="cx">     AsyncFileStream(FileStreamClient*);
</span><span class="cx"> 
</span><del>-    // Called on File thread.
-    void startOnFileThread();
-    void stopOnFileThread();
-    void getSizeOnFileThread(const String&amp; path, double expectedModificationTime);
-    void openForReadOnFileThread(const String&amp; path, long long offset, long long length);
-    void openForWriteOnFileThread(const String&amp; path);
-    void closeOnFileThread();
-    void readOnFileThread(char* buffer, int length);
-    void writeOnFileThread(const URL&amp; blobURL, long long position, int length);
-    void truncateOnFileThread(long long position);
-
</del><span class="cx">     RefPtr&lt;FileStream&gt; m_stream;
</span><del>-
</del><span class="cx">     FileStreamClient* m_client;
</span><span class="cx"> };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiFileThreadcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/FileThread.cpp (169674 => 169675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/FileThread.cpp        2014-06-07 13:10:23 UTC (rev 169674)
+++ trunk/Source/WebCore/fileapi/FileThread.cpp        2014-06-07 13:29:31 UTC (rev 169675)
</span><span class="lines">@@ -62,9 +62,9 @@
</span><span class="cx">     m_queue.kill();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void FileThread::postTask(std::unique_ptr&lt;Task&gt; task)
</del><ins>+void FileThread::postTask(Task&amp;&amp; task)
</ins><span class="cx"> {
</span><del>-    m_queue.append(std::move(task));
</del><ins>+    m_queue.append(std::make_unique&lt;FileThread::Task&gt;(std::move(task)));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> class SameInstancePredicate {
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiFileThreadh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/FileThread.h (169674 => 169675)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/FileThread.h        2014-06-07 13:10:23 UTC (rev 169674)
+++ trunk/Source/WebCore/fileapi/FileThread.h        2014-06-07 13:29:31 UTC (rev 169675)
</span><span class="lines">@@ -31,7 +31,6 @@
</span><span class="cx"> #ifndef FileThread_h
</span><span class="cx"> #define FileThread_h
</span><span class="cx"> 
</span><del>-#include &quot;CrossThreadCopier.h&quot;
</del><span class="cx"> #include &lt;functional&gt;
</span><span class="cx"> #include &lt;wtf/MessageQueue.h&gt;
</span><span class="cx"> #include &lt;wtf/PassRefPtr.h&gt;
</span><span class="lines">@@ -56,13 +55,19 @@
</span><span class="cx">     class Task {
</span><span class="cx">         WTF_MAKE_NONCOPYABLE(Task);
</span><span class="cx">     public:
</span><del>-        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))...))
</del><ins>+        template&lt;typename T, typename U, typename = typename std::enable_if&lt;!std::is_base_of&lt;Task, U&gt;::value &amp;&amp; std::is_convertible&lt;U, std::function&lt;void ()&gt;&gt;::value&gt;::type&gt;
+        Task(T* instance, U method)
+            : m_task(std::move(method))
</ins><span class="cx">             , m_instance(instance)
</span><span class="cx">         {
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        Task(Task&amp;&amp; other)
+            : m_task(std::move(other.m_task))
+            , m_instance(other.m_instance)
+        {
+        }
+
</ins><span class="cx">         void performTask()
</span><span class="cx">         {
</span><span class="cx">             m_task();
</span><span class="lines">@@ -74,7 +79,7 @@
</span><span class="cx">         void* m_instance;
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    void postTask(std::unique_ptr&lt;Task&gt;);
</del><ins>+    void postTask(Task&amp;&amp;);
</ins><span class="cx"> 
</span><span class="cx">     void unscheduleTasks(const void* instance);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>