Title: [168054] trunk/Source
Revision
168054
Author
a...@apple.com
Date
2014-04-30 15:52:30 -0700 (Wed, 30 Apr 2014)

Log Message

Move Blob.slice() implementation into BlobRegistryImpl
https://bugs.webkit.org/show_bug.cgi?id=132402

Reviewed by Anders Carlsson.


Source/WebCore: 
Part or centralizing the responsibility for file size tracking.

* fileapi/Blob.cpp:
(WebCore::Blob::Blob):
(WebCore::Blob::slice): Deleted.
* fileapi/Blob.h:
(WebCore::Blob::slice):
* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::registerBlobURL):
(WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
(WebCore::registerBlobURLTask): Deleted.
(WebCore::registerBlobURLFromTask): Deleted.
* fileapi/ThreadableBlobRegistry.h:
* platform/network/BlobRegistry.h:
* platform/network/BlobRegistryImpl.cpp:
(WebCore::BlobRegistryImpl::appendStorageItems):
(WebCore::BlobRegistryImpl::registerBlobURLForSlice):
(WebCore::BlobRegistryImpl::blobSize):
* platform/network/BlobRegistryImpl.h:

Source/WebKit2: 
* NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
(WebKit::NetworkBlobRegistry::registerBlobURLForSlice):
* NetworkProcess/FileAPI/NetworkBlobRegistry.h:
* NetworkProcess/NetworkConnectionToWebProcess.cpp:
(WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
* NetworkProcess/NetworkConnectionToWebProcess.h:
* NetworkProcess/NetworkConnectionToWebProcess.messages.in:
* WebProcess/FileAPI/BlobRegistryProxy.cpp:
(WebKit::BlobRegistryProxy::registerBlobURLForSlice):
* WebProcess/FileAPI/BlobRegistryProxy.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (168053 => 168054)


--- trunk/Source/WebCore/ChangeLog	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebCore/ChangeLog	2014-04-30 22:52:30 UTC (rev 168054)
@@ -1,3 +1,30 @@
+2014-04-30  Alexey Proskuryakov  <a...@apple.com>
+
+        Move Blob.slice() implementation into BlobRegistryImpl
+        https://bugs.webkit.org/show_bug.cgi?id=132402
+
+        Reviewed by Anders Carlsson.
+
+        Part or centralizing the responsibility for file size tracking.
+
+        * fileapi/Blob.cpp:
+        (WebCore::Blob::Blob):
+        (WebCore::Blob::slice): Deleted.
+        * fileapi/Blob.h:
+        (WebCore::Blob::slice):
+        * fileapi/ThreadableBlobRegistry.cpp:
+        (WebCore::ThreadableBlobRegistry::registerBlobURL):
+        (WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
+        (WebCore::registerBlobURLTask): Deleted.
+        (WebCore::registerBlobURLFromTask): Deleted.
+        * fileapi/ThreadableBlobRegistry.h:
+        * platform/network/BlobRegistry.h:
+        * platform/network/BlobRegistryImpl.cpp:
+        (WebCore::BlobRegistryImpl::appendStorageItems):
+        (WebCore::BlobRegistryImpl::registerBlobURLForSlice):
+        (WebCore::BlobRegistryImpl::blobSize):
+        * platform/network/BlobRegistryImpl.h:
+
 2014-04-30  Brent Fulgham  <bfulg...@apple.com>
 
         Unreviewed build fix after r168041.

Modified: trunk/Source/WebCore/fileapi/Blob.cpp (168053 => 168054)


--- trunk/Source/WebCore/fileapi/Blob.cpp	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebCore/fileapi/Blob.cpp	2014-04-30 22:52:30 UTC (rev 168054)
@@ -97,6 +97,16 @@
     ThreadableBlobRegistry::registerBlobURL(0, m_internalURL, srcURL);
 }
 
+#if ENABLE(BLOB)
+Blob::Blob(const URL& srcURL, long long start, long long end, const String& type)
+    : m_type(Blob::normalizedContentType(type))
+{
+    // Create a new internal URL and register it with the same blob data as the source URL.
+    m_internalURL = BlobURL::createInternalURL();
+    m_size = ThreadableBlobRegistry::registerBlobURLForSlice(m_internalURL, srcURL, start, end);
+}
+#endif
+
 Blob::~Blob()
 {
     ThreadableBlobRegistry::unregisterBlobURL(m_internalURL);
@@ -170,52 +180,6 @@
     return true;
 }
 
-#if ENABLE(BLOB)
-PassRefPtr<Blob> Blob::slice(long long start, long long end, const String& contentType) const
-{
-    // When we slice a file for the first time, we obtain a snapshot of the file by capturing its current size and modification time.
-    // The modification time will be used to verify if the file has been changed or not, when the underlying data are accessed.
-    long long size;
-    double modificationTime;
-    if (isFile()) {
-        // FIXME: This involves synchronous file operation. We need to figure out how to make it asynchronous.
-        toFile(this)->captureSnapshot(size, modificationTime);
-    } else {
-        ASSERT(m_size != -1);
-        size = m_size;
-    }
-
-    // Convert the negative value that is used to select from the end.
-    if (start < 0)
-        start = start + size;
-    if (end < 0)
-        end = end + size;
-
-    // Clamp the range if it exceeds the size limit.
-    if (start < 0)
-        start = 0;
-    if (end < 0)
-        end = 0;
-    if (start >= size) {
-        start = 0;
-        end = 0;
-    } else if (end < start)
-        end = start;
-    else if (end > size)
-        end = size;
-
-    long long length = end - start;
-    auto blobData = std::make_unique<BlobData>();
-    blobData->setContentType(Blob::normalizedContentType(contentType));
-    if (isFile())
-        blobData->appendFile(toFile(this)->path(), start, length, modificationTime);
-    else
-        blobData->appendBlob(m_internalURL, start, length);
-
-    return Blob::create(std::move(blobData), length);
-}
-#endif
-
 URLRegistry& Blob::registry() const
 {
     return BlobURLRegistry::registry();

Modified: trunk/Source/WebCore/fileapi/Blob.h (168053 => 168054)


--- trunk/Source/WebCore/fileapi/Blob.h	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebCore/fileapi/Blob.h	2014-04-30 22:52:30 UTC (rev 168054)
@@ -82,7 +82,10 @@
     virtual URLRegistry& registry() const override;
 
 #if ENABLE(BLOB)
-    PassRefPtr<Blob> slice(long long start = 0, long long end = std::numeric_limits<long long>::max(), const String& contentType = String()) const;
+    PassRefPtr<Blob> slice(long long start = 0, long long end = std::numeric_limits<long long>::max(), const String& contentType = String()) const
+    {
+        return adoptRef(new Blob(m_internalURL, start, end, contentType));
+    }
 #endif
 
 protected:
@@ -92,6 +95,11 @@
     // For deserialization.
     Blob(const URL& srcURL, const String& type, long long size);
 
+#if ENABLE(BLOB)
+    // For slicing.
+    Blob(const URL& srcURL, long long start, long long end, const String& contentType);
+#endif
+
     // This is an internal URL referring to the blob data associated with this object. It serves
     // as an identifier for this blob. The internal URL is never used to source the blob's content
     // into an HTML or for FileRead'ing, public blob URLs must be used for those purposes.

Modified: trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp (168053 => 168054)


--- trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp	2014-04-30 22:52:30 UTC (rev 168054)
@@ -41,6 +41,7 @@
 #include <wtf/RefPtr.h>
 #include <wtf/ThreadSpecific.h>
 #include <wtf/text/StringHash.h>
+#include <wtf/threads/BinarySemaphore.h>
 
 using WTF::ThreadSpecific;
 
@@ -87,26 +88,20 @@
     return *map;
 }
 
-static void registerBlobURLTask(void* context)
-{
-    std::unique_ptr<BlobRegistryContext> blobRegistryContext(static_cast<BlobRegistryContext*>(context));
-    blobRegistry().registerBlobURL(blobRegistryContext->url, std::move(blobRegistryContext->blobData));
-}
-
 void ThreadableBlobRegistry::registerBlobURL(const URL& url, std::unique_ptr<BlobData> blobData)
 {
     if (isMainThread())
         blobRegistry().registerBlobURL(url, std::move(blobData));
-    else
-        callOnMainThread(&registerBlobURLTask, new BlobRegistryContext(url, std::move(blobData)));
+    else {
+        // BlobRegistryContext performs an isolated copy of data.
+        BlobRegistryContext* context = new BlobRegistryContext(url, std::move(blobData));
+        callOnMainThread([context] {
+            std::unique_ptr<BlobRegistryContext> blobRegistryContext(context);
+            blobRegistry().registerBlobURL(blobRegistryContext->url, std::move(blobRegistryContext->blobData));
+        });
+    }
 }
 
-static void registerBlobURLFromTask(void* context)
-{
-    std::unique_ptr<BlobRegistryContext> blobRegistryContext(static_cast<BlobRegistryContext*>(context));
-    blobRegistry().registerBlobURL(blobRegistryContext->url, blobRegistryContext->srcURL);
-}
-
 void ThreadableBlobRegistry::registerBlobURL(SecurityOrigin* origin, const URL& url, const URL& srcURL)
 {
     // If the blob URL contains null origin, as in the context with unique security origin or file URL, save the mapping between url and origin so that the origin can be retrived when doing security origin check.
@@ -115,10 +110,35 @@
 
     if (isMainThread())
         blobRegistry().registerBlobURL(url, srcURL);
-    else
-        callOnMainThread(&registerBlobURLFromTask, new BlobRegistryContext(url, srcURL));
+    else {
+        // BlobRegistryContext performs an isolated copy of data.
+        BlobRegistryContext* context = new BlobRegistryContext(url, srcURL);
+        callOnMainThread([context] {
+            std::unique_ptr<BlobRegistryContext> blobRegistryContext(context);
+            blobRegistry().registerBlobURL(blobRegistryContext->url, blobRegistryContext->srcURL);
+        });
+    }
 }
 
+unsigned long long ThreadableBlobRegistry::registerBlobURLForSlice(const URL& newURL, const URL& srcURL, long long start, long long end)
+{
+    unsigned long long resultSize;
+    if (isMainThread())
+        resultSize = blobRegistry().registerBlobURLForSlice(newURL, srcURL, start, end);
+    else {
+        // BlobRegistryContext performs an isolated copy of data.
+        BlobRegistryContext* context = new BlobRegistryContext(newURL, srcURL);
+        BinarySemaphore semaphore;
+        callOnMainThread([context, start, end, &semaphore, &resultSize] {
+            std::unique_ptr<BlobRegistryContext> blobRegistryContext(context);
+            resultSize = blobRegistry().registerBlobURLForSlice(blobRegistryContext->url, blobRegistryContext->srcURL, start, end);
+            semaphore.signal();
+        });
+        semaphore.wait(std::numeric_limits<double>::max());
+    }
+    return resultSize;
+}
+
 static void unregisterBlobURLTask(void* context)
 {
     std::unique_ptr<BlobRegistryContext> blobRegistryContext(static_cast<BlobRegistryContext*>(context));

Modified: trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h (168053 => 168054)


--- trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.h	2014-04-30 22:52:30 UTC (rev 168054)
@@ -45,6 +45,8 @@
     static void registerBlobURL(SecurityOrigin*, const URL&, const URL& srcURL);
     static void unregisterBlobURL(const URL&);
 
+    static unsigned long long registerBlobURLForSlice(const URL& newURL, const URL& srcURL, long long start, long long end);
+
     // Returns the origin for the given blob URL. This is because we are not able to embed the unique security origin or the origin of file URL
     // in the blob URL.
     static PassRefPtr<SecurityOrigin> getCachedOrigin(const URL&);

Modified: trunk/Source/WebCore/platform/network/BlobRegistry.h (168053 => 168054)


--- trunk/Source/WebCore/platform/network/BlobRegistry.h	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebCore/platform/network/BlobRegistry.h	2014-04-30 22:52:30 UTC (rev 168054)
@@ -51,6 +51,9 @@
     // Registers a new blob URL referring to the blob data identified by the specified srcURL.
     virtual void registerBlobURL(const URL&, const URL& srcURL) = 0;
 
+    // Negative start and end values select from the end.
+    virtual unsigned long long registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end) = 0;
+
     virtual void unregisterBlobURL(const URL&) = 0;
 
     virtual bool isBlobRegistryImpl() const { return false; }

Modified: trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp (168053 => 168054)


--- trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebCore/platform/network/BlobRegistryImpl.cpp	2014-04-30 22:52:30 UTC (rev 168054)
@@ -36,6 +36,8 @@
 
 #include "BlobResourceHandle.h"
 #include "BlobStorageData.h"
+#include "FileMetadata.h"
+#include "FileSystem.h"
 #include "ResourceError.h"
 #include "ResourceHandle.h"
 #include "ResourceRequest.h"
@@ -99,6 +101,7 @@
     }
 
     for (; iter != items.end() && length > 0; ++iter) {
+        ASSERT(iter->length != BlobDataItem::toEndOfFile);
         long long currentLength = iter->length - offset;
         long long newLength = currentLength > length ? length : currentLength;
         if (iter->type == BlobDataItem::Data)
@@ -156,6 +159,43 @@
     m_blobs.set(url.string(), src);
 }
 
+unsigned long long BlobRegistryImpl::registerBlobURLForSlice(const URL& url, const URL& srcURL, long long start, long long end)
+{
+    ASSERT(isMainThread());
+    BlobStorageData* originalStorageData = m_blobs.get(srcURL.string());
+    if (!originalStorageData)
+        return 0;
+
+    unsigned long long originalSize = blobSize(srcURL);
+
+    // Convert the negative value that is used to select from the end.
+    if (start < 0)
+        start = start + originalSize;
+    if (end < 0)
+        end = end + originalSize;
+
+    // Clamp the range if it exceeds the size limit.
+    if (start < 0)
+        start = 0;
+    if (end < 0)
+        end = 0;
+    if (static_cast<unsigned long long>(start) >= originalSize) {
+        start = 0;
+        end = 0;
+    } else if (end < start)
+        end = start;
+    else if (static_cast<unsigned long long>(end) > originalSize)
+        end = originalSize;
+
+    unsigned long long newLength = end - start;
+    RefPtr<BlobStorageData> newStorageData = BlobStorageData::create(originalStorageData->contentType(), originalStorageData->contentDisposition());
+
+    appendStorageItems(newStorageData.get(), originalStorageData->items(), start, newLength);
+
+    m_blobs.set(url.string(), newStorageData.release());
+    return newLength;
+}
+
 void BlobRegistryImpl::unregisterBlobURL(const URL& url)
 {
     ASSERT(isMainThread());
@@ -168,6 +208,29 @@
     return m_blobs.get(url.string());
 }
 
+unsigned long long BlobRegistryImpl::blobSize(const URL& url)
+{
+    ASSERT(isMainThread());
+    BlobStorageData* storageData = m_blobs.get(url.string());
+    if (!storageData)
+        return 0;
+
+    unsigned long long result = 0;
+    for (const BlobDataItem& item : storageData->items()) {
+        if (item.length == BlobDataItem::toEndOfFile) {
+            FileMetadata metadata;
+            if (!getFileMetadata(item.path, metadata))
+                return 0;
+
+            // FIXME: Factor out size and modification tracking for a cleaner implementation.
+            const_cast<BlobDataItem&>(item).length = metadata.length;
+            const_cast<BlobDataItem&>(item).expectedModificationTime = metadata.modificationTime;
+        }
+        result += item.length;
+    }
+    return result;
+}
+
 } // namespace WebCore
 
 #endif

Modified: trunk/Source/WebCore/platform/network/BlobRegistryImpl.h (168053 => 168054)


--- trunk/Source/WebCore/platform/network/BlobRegistryImpl.h	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebCore/platform/network/BlobRegistryImpl.h	2014-04-30 22:52:30 UTC (rev 168054)
@@ -59,9 +59,12 @@
 
     virtual void registerBlobURL(const URL&, std::unique_ptr<BlobData>) override;
     virtual void registerBlobURL(const URL&, const URL& srcURL) override;
+    virtual unsigned long long registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end) override;
     virtual void unregisterBlobURL(const URL&) override;
     virtual bool isBlobRegistryImpl() const override { return true; }
 
+    unsigned long long blobSize(const URL&);
+
     HashMap<String, RefPtr<BlobStorageData>> m_blobs;
 };
 

Modified: trunk/Source/WebKit2/ChangeLog (168053 => 168054)


--- trunk/Source/WebKit2/ChangeLog	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebKit2/ChangeLog	2014-04-30 22:52:30 UTC (rev 168054)
@@ -1,3 +1,21 @@
+2014-04-30  Alexey Proskuryakov  <a...@apple.com>
+
+        Move Blob.slice() implementation into BlobRegistryImpl
+        https://bugs.webkit.org/show_bug.cgi?id=132402
+
+        Reviewed by Anders Carlsson.
+
+        * NetworkProcess/FileAPI/NetworkBlobRegistry.cpp:
+        (WebKit::NetworkBlobRegistry::registerBlobURLForSlice):
+        * NetworkProcess/FileAPI/NetworkBlobRegistry.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+        (WebKit::NetworkConnectionToWebProcess::registerBlobURLForSlice):
+        * NetworkProcess/NetworkConnectionToWebProcess.h:
+        * NetworkProcess/NetworkConnectionToWebProcess.messages.in:
+        * WebProcess/FileAPI/BlobRegistryProxy.cpp:
+        (WebKit::BlobRegistryProxy::registerBlobURLForSlice):
+        * WebProcess/FileAPI/BlobRegistryProxy.h:
+
 2014-04-30  Beth Dakin  <bda...@apple.com>
 
         Phone number data detection UI is offset for iframes, pages with topContentInset

Modified: trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp (168053 => 168054)


--- trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.cpp	2014-04-30 22:52:30 UTC (rev 168054)
@@ -84,6 +84,22 @@
     m_blobsForConnection.find(connection)->value.add(url);
 }
 
+uint64_t NetworkBlobRegistry::registerBlobURLForSlice(NetworkConnectionToWebProcess* connection, const WebCore::URL& url, const WebCore::URL& srcURL, int64_t start, int64_t end)
+{
+    uint64_t resultSize = blobRegistry().registerBlobURLForSlice(url, srcURL, start, end);
+
+    // FIXME: Only store extensions for files that the slice actually contains, not for all the files in original blob.
+    SandboxExtensionMap::iterator iter = m_sandboxExtensions.find(srcURL.string());
+    if (iter != m_sandboxExtensions.end())
+        m_sandboxExtensions.add(url.string(), iter->value);
+
+    ASSERT(m_blobsForConnection.contains(connection));
+    ASSERT(m_blobsForConnection.find(connection)->value.contains(srcURL));
+    m_blobsForConnection.find(connection)->value.add(url);
+
+    return resultSize;
+}
+
 void NetworkBlobRegistry::unregisterBlobURL(NetworkConnectionToWebProcess* connection, const WebCore::URL& url)
 {
     blobRegistry().unregisterBlobURL(url);

Modified: trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h (168053 => 168054)


--- trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebKit2/NetworkProcess/FileAPI/NetworkBlobRegistry.h	2014-04-30 22:52:30 UTC (rev 168054)
@@ -49,6 +49,7 @@
 
     void registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, std::unique_ptr<WebCore::BlobData>, const Vector<RefPtr<SandboxExtension>>&);
     void registerBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&, const WebCore::URL& srcURL);
+    uint64_t registerBlobURLForSlice(NetworkConnectionToWebProcess*, const WebCore::URL&, const WebCore::URL& srcURL, int64_t start, int64_t end);
     void unregisterBlobURL(NetworkConnectionToWebProcess*, const WebCore::URL&);
 
     void connectionToWebProcessDidClose(NetworkConnectionToWebProcess*);

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp (168053 => 168054)


--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp	2014-04-30 22:52:30 UTC (rev 168054)
@@ -241,6 +241,11 @@
     NetworkBlobRegistry::shared().registerBlobURL(this, url, srcURL);
 }
 
+void NetworkConnectionToWebProcess::registerBlobURLForSlice(const URL& url, const URL& srcURL, int64_t start, int64_t end, uint64_t& resultSize)
+{
+    resultSize = NetworkBlobRegistry::shared().registerBlobURLForSlice(this, url, srcURL, start, end);
+}
+
 void NetworkConnectionToWebProcess::unregisterBlobURL(const URL& url)
 {
     NetworkBlobRegistry::shared().unregisterBlobURL(this, url);

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h (168053 => 168054)


--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h	2014-04-30 22:52:30 UTC (rev 168054)
@@ -90,6 +90,7 @@
 #if ENABLE(BLOB)
     void registerBlobURL(const WebCore::URL&, const BlobRegistrationData&);
     void registerBlobURLFromURL(const WebCore::URL&, const WebCore::URL& srcURL);
+    void registerBlobURLForSlice(const WebCore::URL&, const WebCore::URL& srcURL, int64_t start, int64_t end, uint64_t& resultSize);
     void unregisterBlobURL(const WebCore::URL&);
 #endif
 

Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in (168053 => 168054)


--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in	2014-04-30 22:52:30 UTC (rev 168054)
@@ -46,6 +46,7 @@
 #if ENABLE(BLOB)
     RegisterBlobURL(WebCore::URL url, WebKit::BlobRegistrationData data)
     RegisterBlobURLFromURL(WebCore::URL url, WebCore::URL srcURL)
+    RegisterBlobURLForSlice(WebCore::URL url, WebCore::URL srcURL, int64_t start, int64_t end) -> (uint64_t resultSize)
     UnregisterBlobURL(WebCore::URL url)
 #endif
 }

Modified: trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp (168053 => 168054)


--- trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp	2014-04-30 22:52:30 UTC (rev 168054)
@@ -60,6 +60,16 @@
     WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::UnregisterBlobURL(url), 0);
 }
 
+unsigned long long BlobRegistryProxy::registerBlobURLForSlice(const URL& url, const URL& srcURL, long long start, long long end)
+{
+    ASSERT(WebProcess::shared().usesNetworkProcess());
+
+    uint64_t resultSize;
+    if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::RegisterBlobURLForSlice(url, srcURL, start, end), Messages::NetworkConnectionToWebProcess::RegisterBlobURLForSlice::Reply(resultSize), 0))
+        return 0;
+    return resultSize;
 }
 
+}
+
 #endif // ENABLE(BLOB) && ENABLE(NETWORK_PROCESS)

Modified: trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h (168053 => 168054)


--- trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h	2014-04-30 22:45:36 UTC (rev 168053)
+++ trunk/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h	2014-04-30 22:52:30 UTC (rev 168054)
@@ -37,6 +37,7 @@
     virtual void registerBlobURL(const WebCore::URL&, std::unique_ptr<WebCore::BlobData>) override;
     virtual void registerBlobURL(const WebCore::URL&, const WebCore::URL& srcURL) override;
     virtual void unregisterBlobURL(const WebCore::URL&) override;
+    virtual unsigned long long registerBlobURLForSlice(const WebCore::URL&, const WebCore::URL& srcURL, long long start, long long end) override;
 };
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to