BlobRegistryImpl.h [plain text]
#pragma once
#include "BlobData.h"
#include "BlobRegistry.h"
#include <wtf/HashMap.h>
#include <wtf/URLHash.h>
#include <wtf/text/StringHash.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class ResourceHandle;
class ResourceHandleClient;
class ResourceRequest;
class ThreadSafeDataBuffer;
class WEBCORE_EXPORT BlobRegistryImpl {
WTF_MAKE_FAST_ALLOCATED;
public:
virtual ~BlobRegistryImpl();
BlobData* getBlobDataFromURL(const URL&) const;
Ref<ResourceHandle> createResourceHandle(const ResourceRequest&, ResourceHandleClient*);
void writeBlobToFilePath(const URL& blobURL, const String& path, Function<void(bool success)>&& completionHandler);
void appendStorageItems(BlobData*, const BlobDataItemList&, long long offset, long long length);
void registerFileBlobURL(const URL&, Ref<BlobDataFileReference>&&, const String& contentType);
void registerBlobURL(const URL&, Vector<BlobPart>&&, const String& contentType);
void registerBlobURL(const URL&, const URL& srcURL);
void registerBlobURLOptionallyFileBacked(const URL&, const URL& srcURL, RefPtr<BlobDataFileReference>&&, const String& contentType);
void registerBlobURLForSlice(const URL&, const URL& srcURL, long long start, long long end);
void unregisterBlobURL(const URL&);
unsigned long long blobSize(const URL&);
void writeBlobsToTemporaryFiles(const Vector<String>& blobURLs, CompletionHandler<void(Vector<String>&& filePaths)>&&);
struct BlobForFileWriting {
String blobURL;
Vector<std::pair<String, ThreadSafeDataBuffer>> filePathsOrDataBuffers;
};
bool populateBlobsForFileWriting(const Vector<String>& blobURLs, Vector<BlobForFileWriting>&);
Vector<RefPtr<BlobDataFileReference>> filesInBlob(const URL&) const;
private:
HashMap<String, RefPtr<BlobData>> m_blobs;
};
}