diff options
Diffstat (limited to 'Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp')
-rw-r--r-- | Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp | 50 |
1 files changed, 37 insertions, 13 deletions
diff --git a/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp b/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp index ab0ea4d67..346d24947 100644 --- a/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp +++ b/Source/WebKit2/WebProcess/FileAPI/BlobRegistryProxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2013 Apple Inc. All rights reserved. + * Copyright (C) 2013-2016 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -26,40 +26,64 @@ #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 URL& url, std::unique_ptr<BlobData> blobData) +void BlobRegistryProxy::registerFileBlobURL(const WebCore::URL& url, Ref<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(std::move(blobData))), 0); + WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterFileBlobURL(url, file->path(), extensionHandle, contentType), 0); +} + +void BlobRegistryProxy::registerBlobURL(const URL& url, Vector<BlobPart>&& blobParts, const String& contentType) +{ + WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterBlobURL(url, blobParts, contentType), 0); } void BlobRegistryProxy::registerBlobURL(const URL& url, const URL& srcURL) { - ASSERT(WebProcess::shared().usesNetworkProcess()); + WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLFromURL(url, srcURL), 0); +} - WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLFromURL(url, srcURL), 0); +void BlobRegistryProxy::registerBlobURLOptionallyFileBacked(const URL& url, const URL& srcURL, RefPtr<WebCore::BlobDataFileReference>&& file, const String& contentType) +{ + ASSERT(file); + WebProcess::singleton().networkConnection().connection().send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLOptionallyFileBacked(url, srcURL, file->path(), contentType), 0); } 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) +void BlobRegistryProxy::writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, Function<void (const Vector<String>& filePaths)>&& completionHandler) +{ + WebProcess::singleton().networkConnection().writeBlobsToTemporaryFiles(blobURLs, WTFMove(completionHandler)); +} + +} |