<!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>[168126] trunk/Source</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/168126">168126</a></dd>
<dt>Author</dt> <dd>ap@apple.com</dd>
<dt>Date</dt> <dd>2014-05-01 16:09:27 -0700 (Thu, 01 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Move size computation for Blob constructor into BlobRegistryImpl
https://bugs.webkit.org/show_bug.cgi?id=132439

Reviewed by Sam Weinig.

Source/WebCore:
* Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::didReceiveBinaryData):
Don't pass the size, anyone who cares can get it from BlobData.

* bindings/js/JSBlobCustom.cpp: (WebCore::JSBlobConstructor::constructJSBlob):
Updated for BlobBuilder changes.

* fileapi/Blob.cpp: (WebCore::Blob::Blob):
* fileapi/Blob.h: (WebCore::Blob::create):
No longer take a precomputed size with BlobData, BlobRegistry will compute it as
part of registration.

* fileapi/File.h:
* fileapi/File.cpp:
(WebCore::File::File): Don't pass a size (that's unknown anyway).
(WebCore::File::captureSnapshot): Deleted. Finally, only the registry is responsible
for snapshot tracking now (I doubt that either new or old code is particularly compliant).

* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::registerBlobURL):
* fileapi/ThreadableBlobRegistry.h:
Plumbing to make this version of registerBlobURL return a size. I may make size
calculation lazy and the function async later, but this is needed to move the behavior
to the right place first.

* fileapi/WebKitBlobBuilder.h:
* fileapi/WebKitBlobBuilder.cpp:
(WebCore::BlobBuilder::BlobBuilder):
(WebCore::BlobBuilder::append):
(WebCore::BlobBuilder::appendBytesData):
(WebCore::BlobBuilder::finalize):
(WebCore::BlobBuilder::getBlob): Deleted.
Don't track sizes or modification times, registry will do that with appropriate laziness.
Cleaned up the API - now that BlobBuilder is not exposed to JS as an object, it
does not need to be reusable.

* platform/network/BlobRegistry.h: Made this version of registerBlobURL return a size.
* platform/network/BlobRegistryImpl.h:
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::appendStorageItems): Assert that length computations are accurate.
(WebCore::BlobRegistryImpl::registerBlobURL): Compute a size to return, and record
modification time as necessary.

* xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::responseBlob): Don't pass the
size, which can be computed from data. Soon, I want to add a constructor that doesn't
require wrapping a single Vector as BlobData to construct a Blob.

Source/WebKit2:
Plumbing to make this version of registerBlobURL synchronous for now.
I expect to make it async again when data structures on client side are simplified.

* NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
(WebKit::NetworkBlobRegistry::registerBlobURL):
* NetworkProcess/FileAPI/NetworkBlobRegistry.h:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::registerBlobURL):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerBlobURL):
* WebProcess/FileAPI/BlobRegistryProxy.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreModuleswebsocketsWebSocketcpp">trunk/Source/WebCore/Modules/websockets/WebSocket.cpp</a></li>
<li><a href="#trunkSourceWebCorebindingsjsJSBlobCustomcpp">trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiBlobcpp">trunk/Source/WebCore/fileapi/Blob.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiBlobh">trunk/Source/WebCore/fileapi/Blob.h</a></li>
<li><a href="#trunkSourceWebCorefileapiFilecpp">trunk/Source/WebCore/fileapi/File.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiFileh">trunk/Source/WebCore/fileapi/File.h</a></li>
<li><a href="#trunkSourceWebCorefileapiThreadableBlobRegistrycpp">trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiThreadableBlobRegistryh">trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h</a></li>
<li><a href="#trunkSourceWebCorefileapiWebKitBlobBuildercpp">trunk/Source/WebCore/fileapi/WebKitBlobBuilder.cpp</a></li>
<li><a href="#trunkSourceWebCorefileapiWebKitBlobBuilderh">trunk/Source/WebCore/fileapi/WebKitBlobBuilder.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkBlobRegistryh">trunk/Source/WebCore/platform/network/BlobRegistry.h</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkBlobRegistryImplcpp">trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkBlobRegistryImplh">trunk/Source/WebCore/platform/network/BlobRegistryImpl.h</a></li>
<li><a href="#trunkSourceWebCorexmlXMLHttpRequestcpp">trunk/Source/WebCore/xml/XMLHttpRequest.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessFileAPINetworkBlobRegistrycpp">trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessFileAPINetworkBlobRegistryh">trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcesscpp">trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessh">trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessmessagesin">trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessFileAPIBlobRegistryProxycpp">trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessFileAPIBlobRegistryProxyh">trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/ChangeLog        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -1,3 +1,56 @@
</span><ins>+2014-05-01  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        Move size computation for Blob constructor into BlobRegistryImpl
+        https://bugs.webkit.org/show_bug.cgi?id=132439
+
+        Reviewed by Sam Weinig.
+
+        * Modules/websockets/WebSocket.cpp: (WebCore::WebSocket::didReceiveBinaryData):
+        Don't pass the size, anyone who cares can get it from BlobData.
+
+        * bindings/js/JSBlobCustom.cpp: (WebCore::JSBlobConstructor::constructJSBlob):
+        Updated for BlobBuilder changes.
+
+        * fileapi/Blob.cpp: (WebCore::Blob::Blob):
+        * fileapi/Blob.h: (WebCore::Blob::create):
+        No longer take a precomputed size with BlobData, BlobRegistry will compute it as
+        part of registration.
+
+        * fileapi/File.h:
+        * fileapi/File.cpp:
+        (WebCore::File::File): Don't pass a size (that's unknown anyway).
+        (WebCore::File::captureSnapshot): Deleted. Finally, only the registry is responsible
+        for snapshot tracking now (I doubt that either new or old code is particularly compliant).
+
+        * fileapi/ThreadableBlobRegistry.cpp:
+        (WebCore::ThreadableBlobRegistry::registerBlobURL):
+        * fileapi/ThreadableBlobRegistry.h:
+        Plumbing to make this version of registerBlobURL return a size. I may make size
+        calculation lazy and the function async later, but this is needed to move the behavior
+        to the right place first.
+
+        * fileapi/WebKitBlobBuilder.h:
+        * fileapi/WebKitBlobBuilder.cpp:
+        (WebCore::BlobBuilder::BlobBuilder):
+        (WebCore::BlobBuilder::append):
+        (WebCore::BlobBuilder::appendBytesData):
+        (WebCore::BlobBuilder::finalize):
+        (WebCore::BlobBuilder::getBlob): Deleted.
+        Don't track sizes or modification times, registry will do that with appropriate laziness.
+        Cleaned up the API - now that BlobBuilder is not exposed to JS as an object, it
+        does not need to be reusable.
+
+        * platform/network/BlobRegistry.h: Made this version of registerBlobURL return a size.
+        * platform/network/BlobRegistryImpl.h:
+        * platform/network/BlobRegistryImpl.cpp:
+        (WebCore::BlobRegistryImpl::appendStorageItems): Assert that length computations are accurate.
+        (WebCore::BlobRegistryImpl::registerBlobURL): Compute a size to return, and record
+        modification time as necessary.
+
+        * xml/XMLHttpRequest.cpp: (WebCore::XMLHttpRequest::responseBlob): Don't pass the
+        size, which can be computed from data. Soon, I want to add a constructor that doesn't
+        require wrapping a single Vector as BlobData to construct a Blob.
+
</ins><span class="cx"> 2014-05-01  Eric Carlson  &lt;eric.carlson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [iOS] audio and video should automatically play to active external device
</span></span></pre></div>
<a id="trunkSourceWebCoreModuleswebsocketsWebSocketcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/Modules/websockets/WebSocket.cpp (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/Modules/websockets/WebSocket.cpp        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/Modules/websockets/WebSocket.cpp        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -521,10 +521,10 @@
</span><span class="cx">     LOG(Network, &quot;WebSocket %p didReceiveBinaryData() %lu byte binary message&quot;, this, static_cast&lt;unsigned long&gt;(binaryData-&gt;size()));
</span><span class="cx">     switch (m_binaryType) {
</span><span class="cx">     case BinaryTypeBlob: {
</span><del>-        size_t size = binaryData-&gt;size();
</del><ins>+        // FIXME: We just received the data from NetworkProcess, and are sending it back. This is inefficient.
</ins><span class="cx">         auto blobData = std::make_unique&lt;BlobData&gt;();
</span><span class="cx">         blobData-&gt;appendData(RawData::create(std::move(*binaryData)), 0, BlobDataItem::toEndOfFile);
</span><del>-        RefPtr&lt;Blob&gt; blob = Blob::create(std::move(blobData), size);
</del><ins>+        RefPtr&lt;Blob&gt; blob = Blob::create(std::move(blobData));
</ins><span class="cx">         dispatchEvent(MessageEvent::create(blob.release(), SecurityOrigin::create(m_url)-&gt;toString()));
</span><span class="cx">         break;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsJSBlobCustomcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/bindings/js/JSBlobCustom.cpp        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -134,7 +134,13 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    RefPtr&lt;Blob&gt; blob = blobBuilder.getBlob(type);
</del><ins>+    BlobDataItemList items = blobBuilder.finalize();
+    auto blobData = std::make_unique&lt;BlobData&gt;();
+    blobData-&gt;setContentType(Blob::normalizedContentType(type));
+    blobData-&gt;swapItems(items);
+
+    RefPtr&lt;Blob&gt; blob = Blob::create(std::move(blobData));
+
</ins><span class="cx">     return JSValue::encode(CREATE_DOM_WRAPPER(jsConstructor-&gt;globalObject(), Blob, blob.get()));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiBlobcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/Blob.cpp (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/Blob.cpp        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/fileapi/Blob.cpp        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -77,15 +77,14 @@
</span><span class="cx">     ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blobData));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-Blob::Blob(std::unique_ptr&lt;BlobData&gt; blobData, long long size)
</del><ins>+Blob::Blob(std::unique_ptr&lt;BlobData&gt; blobData)
</ins><span class="cx">     : m_type(blobData-&gt;contentType())
</span><del>-    , m_size(size)
</del><span class="cx"> {
</span><span class="cx">     ASSERT(blobData);
</span><span class="cx"> 
</span><span class="cx">     // Create a new internal URL and register it with the provided blob data.
</span><span class="cx">     m_internalURL = BlobURL::createInternalURL();
</span><del>-    ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blobData));
</del><ins>+    m_size = ThreadableBlobRegistry::registerBlobURL(m_internalURL, std::move(blobData));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> Blob::Blob(const URL&amp; srcURL, const String&amp; type, long long size)
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiBlobh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/Blob.h (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/Blob.h        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/fileapi/Blob.h        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -50,9 +50,9 @@
</span><span class="cx">         return adoptRef(new Blob);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static PassRefPtr&lt;Blob&gt; create(std::unique_ptr&lt;BlobData&gt; blobData, long long size)
</del><ins>+    static PassRefPtr&lt;Blob&gt; create(std::unique_ptr&lt;BlobData&gt; blobData)
</ins><span class="cx">     {
</span><del>-        return adoptRef(new Blob(std::move(blobData), size));
</del><ins>+        return adoptRef(new Blob(std::move(blobData)));
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     // For deserialization.
</span><span class="lines">@@ -90,7 +90,7 @@
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     Blob();
</span><del>-    Blob(std::unique_ptr&lt;BlobData&gt;, long long size);
</del><ins>+    Blob(std::unique_ptr&lt;BlobData&gt;);
</ins><span class="cx"> 
</span><span class="cx">     // For deserialization.
</span><span class="cx">     Blob(const URL&amp; srcURL, const String&amp; type, long long size);
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiFilecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/File.cpp (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/File.cpp        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/fileapi/File.cpp        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> File::File(const String&amp; path, ContentTypeLookupPolicy policy)
</span><del>-    : Blob(createBlobDataForFile(path, policy), -1)
</del><ins>+    : Blob(createBlobDataForFile(path, policy))
</ins><span class="cx">     , m_path(path)
</span><span class="cx">     , m_name(pathGetFileName(path))
</span><span class="cx"> {
</span><span class="lines">@@ -72,7 +72,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> File::File(const String&amp; path, const String&amp; name, ContentTypeLookupPolicy policy)
</span><del>-    : Blob(createBlobDataForFileWithName(path, name, policy), -1)
</del><ins>+    : Blob(createBlobDataForFileWithName(path, name, policy))
</ins><span class="cx">     , m_path(path)
</span><span class="cx">     , m_name(name)
</span><span class="cx"> {
</span><span class="lines">@@ -97,21 +97,6 @@
</span><span class="cx">     return static_cast&lt;unsigned long long&gt;(size);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void File::captureSnapshot(long long&amp; snapshotSize, double&amp; snapshotModificationTime) const
-{
-    // Obtains a snapshot of the file by capturing its current size and modification time. This is used when we slice a file for the first time.
-    // If we fail to retrieve the size or modification time, probably due to that the file has been deleted, 0 size is returned.
-    FileMetadata metadata;
-    if (!getFileMetadata(m_path, metadata)) {
-        snapshotSize = 0;
-        snapshotModificationTime = invalidFileTime();
-        return;
-    }
-
-    snapshotSize = metadata.length;
-    snapshotModificationTime = metadata.modificationTime;
-}
-
</del><span class="cx"> String File::contentTypeFromFilePath(const String&amp; name, File::ContentTypeLookupPolicy policy)
</span><span class="cx"> {
</span><span class="cx">     String type;
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiFileh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/File.h (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/File.h        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/fileapi/File.h        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -72,9 +72,6 @@
</span><span class="cx">     // This returns the current date and time if the file's last modifiecation date is not known (per spec: http://www.w3.org/TR/FileAPI/#dfn-lastModifiedDate).
</span><span class="cx">     double lastModifiedDate() const;
</span><span class="cx"> 
</span><del>-    // Note that this involves synchronous file operation. Think twice before calling this function.
-    void captureSnapshot(long long&amp; snapshotSize, double&amp; snapshotModificationTime) const;
-
</del><span class="cx">     static String contentTypeFromFilePath(const String&amp;, ContentTypeLookupPolicy);
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiThreadableBlobRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -88,18 +88,23 @@
</span><span class="cx">     return *map;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void ThreadableBlobRegistry::registerBlobURL(const URL&amp; url, std::unique_ptr&lt;BlobData&gt; blobData)
</del><ins>+unsigned long long ThreadableBlobRegistry::registerBlobURL(const URL&amp; url, std::unique_ptr&lt;BlobData&gt; blobData)
</ins><span class="cx"> {
</span><ins>+    unsigned long long resultSize;
</ins><span class="cx">     if (isMainThread())
</span><del>-        blobRegistry().registerBlobURL(url, std::move(blobData));
</del><ins>+        resultSize = blobRegistry().registerBlobURL(url, std::move(blobData));
</ins><span class="cx">     else {
</span><span class="cx">         // BlobRegistryContext performs an isolated copy of data.
</span><span class="cx">         BlobRegistryContext* context = new BlobRegistryContext(url, std::move(blobData));
</span><del>-        callOnMainThread([context] {
</del><ins>+        BinarySemaphore semaphore;
+        callOnMainThread([context, &amp;semaphore, &amp;resultSize] {
</ins><span class="cx">             std::unique_ptr&lt;BlobRegistryContext&gt; blobRegistryContext(context);
</span><del>-            blobRegistry().registerBlobURL(blobRegistryContext-&gt;url, std::move(blobRegistryContext-&gt;blobData));
</del><ins>+            resultSize = blobRegistry().registerBlobURL(blobRegistryContext-&gt;url, std::move(blobRegistryContext-&gt;blobData));
+            semaphore.signal();
</ins><span class="cx">         });
</span><ins>+        semaphore.wait(std::numeric_limits&lt;double&gt;::max());
</ins><span class="cx">     }
</span><ins>+    return resultSize;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ThreadableBlobRegistry::registerBlobURL(SecurityOrigin* origin, const URL&amp; url, const URL&amp; srcURL)
</span><span class="lines">@@ -163,7 +168,7 @@
</span><span class="cx"> 
</span><span class="cx"> #else
</span><span class="cx"> 
</span><del>-void ThreadableBlobRegistry::registerBlobURL(const URL&amp;, std::unique_ptr&lt;BlobData&gt;)
</del><ins>+unsigned long long ThreadableBlobRegistry::registerBlobURL(const URL&amp;, std::unique_ptr&lt;BlobData&gt;)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -171,6 +176,10 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+unsigned long long ThreadableBlobRegistry::registerBlobURLForSlice(const URL&amp;, const URL&amp;, long long, long long)
+{
+}
+
</ins><span class="cx"> void ThreadableBlobRegistry::unregisterBlobURL(const URL&amp;)
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiThreadableBlobRegistryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -41,7 +41,7 @@
</span><span class="cx"> 
</span><span class="cx"> class ThreadableBlobRegistry {
</span><span class="cx"> public:
</span><del>-    static void registerBlobURL(const URL&amp;, std::unique_ptr&lt;BlobData&gt;);
</del><ins>+    static unsigned long long registerBlobURL(const URL&amp;, std::unique_ptr&lt;BlobData&gt;);
</ins><span class="cx">     static void registerBlobURL(SecurityOrigin*, const URL&amp;, const URL&amp; srcURL);
</span><span class="cx">     static void unregisterBlobURL(const URL&amp;);
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiWebKitBlobBuildercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/WebKitBlobBuilder.cpp (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/WebKitBlobBuilder.cpp        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/fileapi/WebKitBlobBuilder.cpp        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -55,7 +55,6 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> BlobBuilder::BlobBuilder()
</span><del>-    : m_size(0)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -63,15 +62,12 @@
</span><span class="cx"> {
</span><span class="cx">     CString utf8Text = UTF8Encoding().encode(text, EntitiesForUnencodables);
</span><span class="cx"> 
</span><del>-    size_t oldSize = m_appendableData.size();
-
</del><span class="cx">     if (endingType == &quot;native&quot;)
</span><span class="cx">         normalizeLineEndingsToNative(utf8Text, m_appendableData);
</span><span class="cx">     else {
</span><span class="cx">         ASSERT(endingType == &quot;transparent&quot;);
</span><span class="cx">         m_appendableData.append(utf8Text.data(), utf8Text.length());
</span><span class="cx">     }
</span><del>-    m_size += m_appendableData.size() - oldSize;
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(BLOB)
</span><span class="lines">@@ -104,44 +100,23 @@
</span><span class="cx">         m_items.append(BlobDataItem(RawData::create(std::move(m_appendableData))));
</span><span class="cx">     if (blob-&gt;isFile()) {
</span><span class="cx">         File* file = toFile(blob);
</span><del>-        // If the blob is file that is not snapshoted, capture the snapshot now.
-        // FIXME: This involves synchronous file operation. We need to figure out how to make it asynchronous.
-        long long snapshotSize;
-        double snapshotModificationTime;
-        file-&gt;captureSnapshot(snapshotSize, snapshotModificationTime);
-
-        m_size += snapshotSize;
-        m_items.append(BlobDataItem(file-&gt;path(), 0, snapshotSize, snapshotModificationTime));
</del><ins>+        m_items.append(BlobDataItem(file-&gt;path(), 0, BlobDataItem::toEndOfFile, invalidFileTime()));
</ins><span class="cx">     } else {
</span><span class="cx">         long long blobSize = static_cast&lt;long long&gt;(blob-&gt;size());
</span><del>-        m_size += blobSize;
</del><span class="cx">         m_items.append(BlobDataItem(blob-&gt;url(), 0, blobSize));
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void BlobBuilder::appendBytesData(const void* data, size_t length)
</span><span class="cx"> {
</span><del>-    size_t oldSize = m_appendableData.size();
</del><span class="cx">     m_appendableData.append(static_cast&lt;const char*&gt;(data), length);
</span><del>-    m_size += m_appendableData.size() - oldSize;
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-PassRefPtr&lt;Blob&gt; BlobBuilder::getBlob(const String&amp; contentType)
</del><ins>+BlobDataItemList BlobBuilder::finalize()
</ins><span class="cx"> {
</span><span class="cx">     if (!m_appendableData.isEmpty())
</span><span class="cx">         m_items.append(BlobDataItem(RawData::create(std::move(m_appendableData))));
</span><del>-
-    auto blobData = std::make_unique&lt;BlobData&gt;();
-    blobData-&gt;setContentType(Blob::normalizedContentType(contentType));
-    blobData-&gt;swapItems(m_items);
-
-    RefPtr&lt;Blob&gt; blob = Blob::create(std::move(blobData), m_size);
-
-    // After creating a blob from the current blob data, we do not need to keep the data around any more. Instead, we only
-    // need to keep a reference to the URL of the blob just created.
-    m_items.append(BlobDataItem(blob-&gt;url(), 0, m_size));
-
-    return blob;
</del><ins>+    return std::move(m_items);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebCorefileapiWebKitBlobBuilderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/fileapi/WebKitBlobBuilder.h (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/fileapi/WebKitBlobBuilder.h        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/fileapi/WebKitBlobBuilder.h        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -42,10 +42,7 @@
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><span class="cx"> class Blob;
</span><del>-class TextEncoding;
</del><span class="cx"> 
</span><del>-typedef int ExceptionCode;
-
</del><span class="cx"> class BlobBuilder {
</span><span class="cx"> public:
</span><span class="cx">     BlobBuilder();
</span><span class="lines">@@ -57,12 +54,11 @@
</span><span class="cx">     void append(PassRefPtr&lt;JSC::ArrayBufferView&gt;);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    PassRefPtr&lt;Blob&gt; getBlob(const String&amp; contentType);
</del><ins>+    BlobDataItemList finalize();
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     void appendBytesData(const void*, size_t);
</span><span class="cx"> 
</span><del>-    long long m_size;
</del><span class="cx">     BlobDataItemList m_items;
</span><span class="cx">     Vector&lt;char&gt; m_appendableData;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobRegistryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobRegistry.h (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobRegistry.h        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/platform/network/BlobRegistry.h        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -46,7 +46,7 @@
</span><span class="cx"> class BlobRegistry {
</span><span class="cx"> public:
</span><span class="cx">     // Registers a blob URL referring to the specified blob data.
</span><del>-    virtual void registerBlobURL(const URL&amp;, std::unique_ptr&lt;BlobData&gt;) = 0;
</del><ins>+    virtual unsigned long long registerBlobURL(const URL&amp;, std::unique_ptr&lt;BlobData&gt;) = 0;
</ins><span class="cx">     
</span><span class="cx">     // Registers a new blob URL referring to the blob data identified by the specified srcURL.
</span><span class="cx">     virtual void registerBlobURL(const URL&amp;, const URL&amp; srcURL) = 0;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobRegistryImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -113,9 +113,10 @@
</span><span class="cx">         length -= newLength;
</span><span class="cx">         offset = 0;
</span><span class="cx">     }
</span><ins>+    ASSERT(!length);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void BlobRegistryImpl::registerBlobURL(const URL&amp; url, std::unique_ptr&lt;BlobData&gt; blobData)
</del><ins>+unsigned long long BlobRegistryImpl::registerBlobURL(const URL&amp; url, std::unique_ptr&lt;BlobData&gt; blobData)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(isMainThread());
</span><span class="cx">     registerBlobResourceHandleConstructor();
</span><span class="lines">@@ -128,22 +129,42 @@
</span><span class="cx">     // 3) The URL item is denoted by the URL, the range and the expected modification time.
</span><span class="cx">     // All the Blob items in the passing blob data are resolved and expanded into a set of Data and File items.
</span><span class="cx"> 
</span><del>-    for (BlobDataItemList::const_iterator iter = blobData-&gt;items().begin(); iter != blobData-&gt;items().end(); ++iter) {
-        switch (iter-&gt;type) {
</del><ins>+    // FIXME: BlobDataItems contain a lot of information that we do not expect to be present when registering a new blob,
+    // these data members are only used inside the registry. Use a more appropriate type than BlobData.
+
+    unsigned long long size = 0;
+    for (const BlobDataItem&amp; item : blobData-&gt;items()) {
+        switch (item.type) {
</ins><span class="cx">         case BlobDataItem::Data:
</span><del>-            blobStorageData-&gt;m_data.appendData(iter-&gt;data, 0, iter-&gt;data-&gt;length());
</del><ins>+            blobStorageData-&gt;m_data.appendData(item.data, 0, item.data-&gt;length());
+            size += item.data-&gt;length();
</ins><span class="cx">             break;
</span><del>-        case BlobDataItem::File:
-            blobStorageData-&gt;m_data.appendFile(iter-&gt;path, iter-&gt;offset, iter-&gt;length, iter-&gt;expectedModificationTime);
</del><ins>+        case BlobDataItem::File: {
+            ASSERT(!item.offset);
+            ASSERT(item.length == BlobDataItem::toEndOfFile);
+            ASSERT(!isValidFileTime(item.expectedModificationTime));
+
+            // FIXME: Factor out size and modification tracking for a cleaner implementation.
+            FileMetadata metadata;
+            if (!getFileMetadata(item.path, metadata))
+                return 0;
+
+            blobStorageData-&gt;m_data.appendFile(item.path, 0, metadata.length, metadata.modificationTime);
+            size += metadata.length;
</ins><span class="cx">             break;
</span><ins>+        }
</ins><span class="cx">         case BlobDataItem::Blob:
</span><del>-            if (m_blobs.contains(iter-&gt;url.string()))
-                appendStorageItems(blobStorageData.get(), m_blobs.get(iter-&gt;url.string())-&gt;items(), iter-&gt;offset, iter-&gt;length);
</del><ins>+            if (!m_blobs.contains(item.url.string()))
+                return 0;
+            size += blobSize(item.url); // As a side effect, this calculates sizes of all files in the blob.
+            ASSERT(blobSize(item.url) == static_cast&lt;unsigned long long&gt;(item.length));
+            appendStorageItems(blobStorageData.get(), m_blobs.get(item.url.string())-&gt;items(), item.offset, item.length);
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     m_blobs.set(url.string(), blobStorageData);
</span><ins>+    return size;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void BlobRegistryImpl::registerBlobURL(const URL&amp; url, const URL&amp; srcURL)
</span><span class="lines">@@ -152,7 +173,6 @@
</span><span class="cx">     registerBlobResourceHandleConstructor();
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;BlobStorageData&gt; src = m_blobs.get(srcURL.string());
</span><del>-    ASSERT(src);
</del><span class="cx">     if (!src)
</span><span class="cx">         return;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkBlobRegistryImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/BlobRegistryImpl.h (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/BlobRegistryImpl.h        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/platform/network/BlobRegistryImpl.h        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> private:
</span><span class="cx">     void appendStorageItems(BlobStorageData*, const BlobDataItemList&amp;, long long offset, long long length);
</span><span class="cx"> 
</span><del>-    virtual void registerBlobURL(const URL&amp;, std::unique_ptr&lt;BlobData&gt;) override;
</del><ins>+    virtual unsigned long long registerBlobURL(const URL&amp;, std::unique_ptr&lt;BlobData&gt;) override;
</ins><span class="cx">     virtual void registerBlobURL(const URL&amp;, const URL&amp; srcURL) override;
</span><span class="cx">     virtual unsigned long long registerBlobURLForSlice(const URL&amp;, const URL&amp; srcURL, long long start, long long end) override;
</span><span class="cx">     virtual void unregisterBlobURL(const URL&amp;) override;
</span></span></pre></div>
<a id="trunkSourceWebCorexmlXMLHttpRequestcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/xml/XMLHttpRequest.cpp (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebCore/xml/XMLHttpRequest.cpp        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -296,7 +296,7 @@
</span><span class="cx">             String normalizedContentType = Blob::normalizedContentType(responseMIMEType());
</span><span class="cx">             blobData-&gt;setContentType(normalizedContentType); // responseMIMEType defaults to text/xml which may be incorrect.
</span><span class="cx">             m_binaryResponseBuilder.clear();
</span><del>-            m_responseBlob = Blob::create(std::move(blobData), size);
</del><ins>+            m_responseBlob = Blob::create(std::move(blobData));
</ins><span class="cx">         } else {
</span><span class="cx">             // If we errored out or got no data, we still return a blob, just an empty one.
</span><span class="cx">             m_responseBlob = Blob::create();
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebKit2/ChangeLog        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -1,3 +1,24 @@
</span><ins>+2014-05-01  Alexey Proskuryakov  &lt;ap@apple.com&gt;
+
+        Move size computation for Blob constructor into BlobRegistryImpl
+        https://bugs.webkit.org/show_bug.cgi?id=132439
+
+        Reviewed by Sam Weinig.
+
+        Plumbing to make this version of registerBlobURL synchronous for now.
+        I expect to make it async again when data structures on client side are simplified.
+
+        * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
+        (WebKit::NetworkBlobRegistry::registerBlobURL):
+        * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::registerBlobURL):
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        * WebProcess/FileAPI/BlobRegistryProxy.cpp:
+        (WebKit::BlobRegistryProxy::registerBlobURL):
+        * WebProcess/FileAPI/BlobRegistryProxy.h:
+
</ins><span class="cx"> 2014-05-01  Beth Dakin  &lt;bdakin@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(168053): Repro crash navigating to another page after selecting phone 
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessFileAPINetworkBlobRegistrycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -48,7 +48,7 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connection, const URL&amp; url, std::unique_ptr&lt;BlobData&gt; data, const Vector&lt;RefPtr&lt;SandboxExtension&gt;&gt;&amp; newSandboxExtensions)
</del><ins>+uint64_t NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connection, const URL&amp; url, std::unique_ptr&lt;BlobData&gt; data, const Vector&lt;RefPtr&lt;SandboxExtension&gt;&gt;&amp; newSandboxExtensions)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(!m_sandboxExtensions.contains(url.string()));
</span><span class="cx"> 
</span><span class="lines">@@ -60,7 +60,7 @@
</span><span class="cx">             sandboxExtensions.appendVector(m_sandboxExtensions.get(items[i].url.string()));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    blobRegistry().registerBlobURL(url, std::move(data));
</del><ins>+    uint64_t resultSize = blobRegistry().registerBlobURL(url, std::move(data));
</ins><span class="cx"> 
</span><span class="cx">     if (!sandboxExtensions.isEmpty())
</span><span class="cx">         m_sandboxExtensions.add(url.string(), sandboxExtensions);
</span><span class="lines">@@ -70,6 +70,8 @@
</span><span class="cx">     if (mapIterator == m_blobsForConnection.end())
</span><span class="cx">         mapIterator = m_blobsForConnection.add(connection, HashSet&lt;URL&gt;()).iterator;
</span><span class="cx">     mapIterator-&gt;value.add(url);
</span><ins>+
+    return resultSize;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkBlobRegistry::registerBlobURL(NetworkConnectionToWebProcess* connection, const WebCore::URL&amp; url, const WebCore::URL&amp; srcURL)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessFileAPINetworkBlobRegistryh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx">     NetworkBlobRegistry();
</span><span class="cx">     static NetworkBlobRegistry&amp; shared();
</span><span class="cx"> 
</span><del>-    void registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&amp;, std::unique_ptr&lt;WebCore::BlobData&gt;, const Vector&lt;RefPtr&lt;SandboxExtension&gt;&gt;&amp;);
</del><ins>+    uint64_t registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&amp;, std::unique_ptr&lt;WebCore::BlobData&gt;, const Vector&lt;RefPtr&lt;SandboxExtension&gt;&gt;&amp;);
</ins><span class="cx">     void registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&amp;, const WebCore::URL&amp; srcURL);
</span><span class="cx">     uint64_t registerBlobURLForSlice(NetworkConnectionToWebProcess*, const WebCore::URL&amp;, const WebCore::URL&amp; srcURL, int64_t start, int64_t end);
</span><span class="cx">     void unregisterBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&amp;);
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -225,7 +225,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(BLOB)
</span><del>-void NetworkConnectionToWebProcess::registerBlobURL(const URL&amp; url, const BlobRegistrationData&amp; data)
</del><ins>+void NetworkConnectionToWebProcess::registerBlobURL(const URL&amp; url, const BlobRegistrationData&amp; data, uint64_t&amp; resultSize)
</ins><span class="cx"> {
</span><span class="cx">     Vector&lt;RefPtr&lt;SandboxExtension&gt;&gt; extensions;
</span><span class="cx">     for (size_t i = 0, count = data.sandboxExtensions().size(); i &lt; count; ++i) {
</span><span class="lines">@@ -233,7 +233,7 @@
</span><span class="cx">             extensions.append(extension);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    NetworkBlobRegistry::shared().registerBlobURL(this, url, data.releaseData(), extensions);
</del><ins>+    resultSize = NetworkBlobRegistry::shared().registerBlobURL(this, url, data.releaseData(), extensions);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkConnectionToWebProcess::registerBlobURLFromURL(const URL&amp; url, const URL&amp; srcURL)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -88,7 +88,7 @@
</span><span class="cx">     void deleteCookie(WebCore::SessionID, const WebCore::URL&amp;, const String&amp; cookieName);
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(BLOB)
</span><del>-    void registerBlobURL(const WebCore::URL&amp;, const BlobRegistrationData&amp;);
</del><ins>+    void registerBlobURL(const WebCore::URL&amp;, const BlobRegistrationData&amp;, uint64_t&amp; resultSize);
</ins><span class="cx">     void registerBlobURLFromURL(const WebCore::URL&amp;, const WebCore::URL&amp; srcURL);
</span><span class="cx">     void registerBlobURLForSlice(const WebCore::URL&amp;, const WebCore::URL&amp; srcURL, int64_t start, int64_t end, uint64_t&amp; resultSize);
</span><span class="cx">     void unregisterBlobURL(const WebCore::URL&amp;);
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkConnectionToWebProcessmessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -44,7 +44,7 @@
</span><span class="cx">     DeleteCookie(WebCore::SessionID sessionID, WebCore::URL url, String cookieName)
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(BLOB)
</span><del>-    RegisterBlobURL(WebCore::URL url, WebKit::BlobRegistrationData data)
</del><ins>+    RegisterBlobURL(WebCore::URL url, WebKit::BlobRegistrationData data) -&gt; (uint64_t resultSize)
</ins><span class="cx">     RegisterBlobURLFromURL(WebCore::URL url, WebCore::URL srcURL)
</span><span class="cx">     RegisterBlobURLForSlice(WebCore::URL url, WebCore::URL srcURL, int64_t start, int64_t end) -&gt; (uint64_t resultSize)
</span><span class="cx">     UnregisterBlobURL(WebCore::URL url)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessFileAPIBlobRegistryProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -39,11 +39,14 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-void BlobRegistryProxy::registerBlobURL(const URL&amp; url, std::unique_ptr&lt;BlobData&gt; blobData)
</del><ins>+unsigned long long BlobRegistryProxy::registerBlobURL(const URL&amp; url, std::unique_ptr&lt;BlobData&gt; blobData)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(WebProcess::shared().usesNetworkProcess());
</span><span class="cx"> 
</span><del>-    WebProcess::shared().networkConnection()-&gt;connection()-&gt;send(Messages::NetworkConnectionToWebProcess::RegisterBlobURL(url, BlobRegistrationData(std::move(blobData))), 0);
</del><ins>+    uint64_t resultSize;
+    if (!WebProcess::shared().networkConnection()-&gt;connection()-&gt;sendSync(Messages::NetworkConnectionToWebProcess::RegisterBlobURL(url, BlobRegistrationData(std::move(blobData))), Messages::NetworkConnectionToWebProcess::RegisterBlobURL::Reply(resultSize), 0))
+        return 0;
+    return resultSize;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void BlobRegistryProxy::registerBlobURL(const URL&amp; url, const URL&amp; srcURL)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessFileAPIBlobRegistryProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h (168125 => 168126)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h        2014-05-01 22:54:40 UTC (rev 168125)
+++ trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h        2014-05-01 23:09:27 UTC (rev 168126)
</span><span class="lines">@@ -34,7 +34,7 @@
</span><span class="cx"> 
</span><span class="cx"> class BlobRegistryProxy : public WebCore::BlobRegistry {
</span><span class="cx"> public:
</span><del>-    virtual void registerBlobURL(const WebCore::URL&amp;, std::unique_ptr&lt;WebCore::BlobData&gt;) override;
</del><ins>+    virtual unsigned long long registerBlobURL(const WebCore::URL&amp;, std::unique_ptr&lt;WebCore::BlobData&gt;) override;
</ins><span class="cx">     virtual void registerBlobURL(const WebCore::URL&amp;, const WebCore::URL&amp; srcURL) override;
</span><span class="cx">     virtual void unregisterBlobURL(const WebCore::URL&amp;) override;
</span><span class="cx">     virtual unsigned long long registerBlobURLForSlice(const WebCore::URL&amp;, const WebCore::URL&amp; srcURL, long long start, long long end) override;
</span></span></pre>
</div>
</div>

</body>
</html>