BlobRegistryProxy.cpp [plain text]
#include "config.h"
#include "BlobRegistryProxy.h"
#if ENABLE(NETWORK_PROCESS)
#include "NetworkConnectionToWebProcessMessages.h"
#include "NetworkProcessConnection.h"
#include "WebCoreArgumentCoders.h"
#include "WebProcess.h"
#include <WebCore/BlobDataFileReference.h>
using namespace WebCore;
namespace WebKit {
void BlobRegistryProxy::registerFileBlobURL(const WebCore::URL& url, PassRefPtr<BlobDataFileReference> file, const String& contentType)
{
ASSERT(WebProcess::shared().usesNetworkProcess());
SandboxExtension::Handle extensionHandle;
if (!file->path().isEmpty())
SandboxExtension::createHandle(file->path(), SandboxExtension::ReadOnly, extensionHandle);
WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterFileBlobURL(url, file->path(), extensionHandle, contentType), 0);
}
void BlobRegistryProxy::registerBlobURL(const URL& url, Vector<BlobPart> blobParts, const String& contentType)
{
ASSERT(WebProcess::shared().usesNetworkProcess());
WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURL(url, blobParts, contentType), 0);
}
void BlobRegistryProxy::registerBlobURL(const URL& url, const URL& srcURL)
{
ASSERT(WebProcess::shared().usesNetworkProcess());
WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLFromURL(url, srcURL), 0);
}
void BlobRegistryProxy::unregisterBlobURL(const URL& url)
{
ASSERT(WebProcess::shared().usesNetworkProcess());
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)
{
ASSERT(WebProcess::shared().usesNetworkProcess());
WebProcess::shared().networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::RegisterBlobURLForSlice(url, srcURL, start, end), 0);
}
unsigned long long BlobRegistryProxy::blobSize(const URL& url)
{
ASSERT(WebProcess::shared().usesNetworkProcess());
uint64_t resultSize;
if (!WebProcess::shared().networkConnection()->connection()->sendSync(Messages::NetworkConnectionToWebProcess::BlobSize(url), Messages::NetworkConnectionToWebProcess::BlobSize::Reply(resultSize), 0))
return 0;
return resultSize;
}
}
#endif // ENABLE(NETWORK_PROCESS)