diff options
| author | Konstantin Tokarev <annulen@yandex.ru> | 2016-08-25 19:20:41 +0300 |
|---|---|---|
| committer | Konstantin Tokarev <annulen@yandex.ru> | 2017-02-02 12:30:55 +0000 |
| commit | 6882a04fb36642862b11efe514251d32070c3d65 (patch) | |
| tree | b7959826000b061fd5ccc7512035c7478742f7b0 /Source/WebKit2/WebProcess/FileAPI | |
| parent | ab6df191029eeeb0b0f16f127d553265659f739e (diff) | |
| download | qtwebkit-6882a04fb36642862b11efe514251d32070c3d65.tar.gz | |
Imported QtWebKit TP3 (git b57bc6801f1876c3220d5a4bfea33d620d477443)
Change-Id: I3b1d8a2808782c9f34d50240000e20cb38d3680f
Reviewed-by: Konstantin Tokarev <annulen@yandex.ru>
Diffstat (limited to 'Source/WebKit2/WebProcess/FileAPI')
| -rw-r--r-- | Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp | 41 | ||||
| -rw-r--r-- | Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h | 15 |
2 files changed, 34 insertions, 22 deletions
diff --git a/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp b/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp index d5f8cf5bb..f78c990d1 100644 --- a/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp +++ b/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp @@ -26,40 +26,53 @@ #include "config.h" #include "BlobRegistryProxy.h" -#if ENABLE(BLOB) && ENABLE(NETWORK_PROCESS) - -#include "BlobRegistrationData.h" #include "NetworkConnectionToWebProcessMessages.h" #include "NetworkProcessConnection.h" #include "WebCoreArgumentCoders.h" #include "WebProcess.h" -#include <WebCore/BlobData.h> +#include <WebCore/BlobDataFileReference.h> using namespace WebCore; namespace WebKit { -void BlobRegistryProxy::registerBlobURL(const KURL& url, PassOwnPtr<BlobData> blobData) +void BlobRegistryProxy::registerFileBlobURL(const WebCore::URL& url, RefPtr<BlobDataFileReference>&& file, const String& contentType) { - ASSERT(WebProcess::shared().usesNetworkProcess()); + SandboxExtension::Handle extensionHandle; + + // File path can be empty when submitting a form file input without a file, see bug 111778. + if (!file->path().isEmpty()) + SandboxExtension::createHandle(file->path(), SandboxExtension::ReadOnly, extensionHandle); - WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURL(url, BlobRegistrationData(blobData)), 0); + WebProcess::singleton().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterFileBlobURL(url, file->path(), extensionHandle, contentType), 0); } -void BlobRegistryProxy::registerBlobURL(const KURL& url, const KURL& srcURL) +void BlobRegistryProxy::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType) { - ASSERT(WebProcess::shared().usesNetworkProcess()); + WebProcess::singleton().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURL(url, blobParts, contentType), 0); +} - WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLFromURL(url, srcURL), 0); +void BlobRegistryProxy::registerBlobURL(const URL& url, const URL& srcURL) +{ + WebProcess::singleton().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLFromURL(url, srcURL), 0); } -void BlobRegistryProxy::unregisterBlobURL(const KURL& url) +void BlobRegistryProxy::unregisterBlobURL(const URL& url) { - ASSERT(WebProcess::shared().usesNetworkProcess()); + WebProcess::singleton().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::UnregisterBlobURL(url), 0); +} - WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::UnregisterBlobURL(url), 0); +void BlobRegistryProxy::registerBlobURLForSlice(const URL& url, const URL& srcURL, long long start, long long end) +{ + WebProcess::singleton().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLForSlice(url, srcURL, start, end), 0); } +unsigned long long BlobRegistryProxy::blobSize(const URL& url) +{ + uint64_t resultSize; + if (!WebProcess::singleton().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::BlobSize(url), Messages::NetworkConnectionToWebProcess::BlobSize::Reply(resultSize), 0)) + return 0; + return resultSize; } -#endif // ENABLE(BLOB) && ENABLE(NETWORK_PROCESS) +} diff --git a/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h b/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h index 63d0da400..1f7736003 100644 --- a/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h +++ b/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.h @@ -26,21 +26,20 @@ #ifndef BlobRegistryProxy_h #define BlobRegistryProxy_h -#if ENABLE(BLOB) && ENABLE(NETWORK_PROCESS) - #include <WebCore/BlobRegistry.h> namespace WebKit { -class BlobRegistryProxy : public WebCore::BlobRegistry { +class BlobRegistryProxy final : public WebCore::BlobRegistry { public: - virtual void registerBlobURL(const WebCore::KURL&, PassOwnPtr<WebCore::BlobData>); - virtual void registerBlobURL(const WebCore::KURL&, const WebCore::KURL& srcURL); - virtual void unregisterBlobURL(const WebCore::KURL&); + virtual void registerFileBlobURL(const WebCore::URL&, RefPtr<WebCore::BlobDataFileReference>&&, const String& contentType) override; + virtual void registerBlobURL(const WebCore::URL&, Vector<WebCore::BlobPart>, const String& contentType) override; + virtual void registerBlobURL(const WebCore::URL&, const WebCore::URL& srcURL) override; + virtual void unregisterBlobURL(const WebCore::URL&) override; + virtual void registerBlobURLForSlice(const WebCore::URL&, const WebCore::URL& srcURL, long long start, long long end) override; + virtual unsigned long long blobSize(const WebCore::URL&) override; }; } -#endif // ENABLE(BLOB) && ENABLE(NETWORK_PROCESS) - #endif // BlobRegistryProxy_h |
