Index: WebCore/platform/network/BlobData.cpp |
=================================================================== |
--- WebCore/platform/network/BlobData.cpp (revision 140218) |
+++ WebCore/platform/network/BlobData.cpp (working copy) |
@@ -31,6 +31,8 @@ |
#include "config.h" |
#include "BlobData.h" |
+#include "BlobRegistry.h" |
+#include "UUID.h" |
#include <wtf/OwnPtr.h> |
#include <wtf/PassOwnPtr.h> |
#include <wtf/PassRefPtr.h> |
@@ -53,7 +55,7 @@ |
{ |
data->detachFromCurrentThread(); |
path = path.isolatedCopy(); |
- url = url.copy(); |
+ fileSystemURL = fileSystemURL.copy(); |
} |
PassOwnPtr<BlobData> BlobData::create() |
@@ -84,15 +86,15 @@ |
m_items.append(BlobDataItem(path, offset, length, expectedModificationTime)); |
} |
-void BlobData::appendBlob(const KURL& url, long long offset, long long length) |
+void BlobData::appendBlob(PassRefPtr<BlobDataHandle> blobDataHandle, long long offset, long long length) |
{ |
- m_items.append(BlobDataItem(url, offset, length)); |
+ m_items.append(BlobDataItem(blobDataHandle, offset, length)); |
} |
#if ENABLE(FILE_SYSTEM) |
-void BlobData::appendURL(const KURL& url, long long offset, long long length, double expectedModificationTime) |
+void BlobData::appendFileSystemURL(const KURL& fileSystemURL, long long offset, long long length, double expectedModificationTime) |
{ |
- m_items.append(BlobDataItem(url, offset, length, expectedModificationTime)); |
+ m_items.append(BlobDataItem(fileSystemURL, offset, length, expectedModificationTime)); |
} |
#endif |
@@ -101,4 +103,37 @@ |
m_items.swap(items); |
} |
+ |
+// TODO: Maybe we could/should embed the 'type' and 'size' into the id value too? |
+// In some place we pass just the string id value around and in those places |
+// we have no way of reconstructing the 'type' and 'size'. |
+ |
+BlobDataHandle::BlobDataHandle() |
+ : m_uuid(createCanonicalUUIDString()) |
+ , m_size(0) |
+{ |
+ blobRegistry().registerBlobData(m_uuid, BlobData::create()); |
+} |
+ |
+BlobDataHandle::BlobDataHandle(PassOwnPtr<BlobData> data, long long size) |
+ : m_uuid(createCanonicalUUIDString()) |
+ , m_type(data->contentType().isolatedCopy()) |
+ , m_size(size) |
+{ |
+ blobRegistry().registerBlobData(m_uuid, data); |
+} |
+ |
+BlobDataHandle::BlobDataHandle(const String& uuid, const String& type, long long size) |
+ : m_uuid(uuid.isolatedCopy()) |
+ , m_type(type.isolatedCopy()) |
+ , m_size(size) |
+{ |
+ blobRegistry().addBlobDataRef(m_uuid); |
+} |
+ |
+BlobDataHandle::~BlobDataHandle() |
+{ |
+ blobRegistry().removeBlobDataRef(m_uuid); |
+} |
+ |
} // namespace WebCore |