Index: WebCore/platform/network/BlobData.h |
=================================================================== |
--- WebCore/platform/network/BlobData.h (revision 140218) |
+++ WebCore/platform/network/BlobData.h (working copy) |
@@ -39,6 +39,8 @@ |
namespace WebCore { |
+class BlobDataHandle; |
+ |
class RawData : public ThreadSafeRefCounted<RawData> { |
public: |
static PassRefPtr<RawData> create() |
@@ -101,9 +103,9 @@ |
} |
// Constructor for Blob type. |
- BlobDataItem(const KURL& url, long long offset, long long length) |
+ BlobDataItem(PassRefPtr<BlobDataHandle> blobDataHandle, long long offset, long long length) |
: type(Blob) |
- , url(url) |
+ , blobDataHandle(blobDataHandle) |
, offset(offset) |
, length(length) |
, expectedModificationTime(invalidFileTime()) |
@@ -112,9 +114,9 @@ |
#if ENABLE(FILE_SYSTEM) |
// Constructor for URL type (e.g. FileSystem files). |
- BlobDataItem(const KURL& url, long long offset, long long length, double expectedModificationTime) |
- : type(URL) |
- , url(url) |
+ BlobDataItem(const KURL& fileSystemURL, long long offset, long long length, double expectedModificationTime) |
+ : type(FileSystemURL) |
+ , fileSystemURL(fileSystemURL) |
, offset(offset) |
, length(length) |
, expectedModificationTime(expectedModificationTime) |
@@ -130,7 +132,7 @@ |
File, |
Blob |
#if ENABLE(FILE_SYSTEM) |
- , URL |
+ , FileSystemURL |
#endif |
} type; |
@@ -140,9 +142,12 @@ |
// For File type. |
String path; |
- // For Blob or URL type. |
- KURL url; |
+ // For FileSystem URL type. |
+ KURL fileSystemURL; |
+ // For Blob type. |
+ RefPtr<BlobDataHandle> blobDataHandle; |
+ |
long long offset; |
long long length; |
double expectedModificationTime; |
@@ -183,9 +188,9 @@ |
void appendData(PassRefPtr<RawData>, long long offset, long long length); |
void appendFile(const String& path); |
void appendFile(const String& path, long long offset, long long length, double expectedModificationTime); |
- void appendBlob(const KURL&, long long offset, long long length); |
+ void appendBlob(PassRefPtr<BlobDataHandle>, long long offset, long long length); |
#if ENABLE(FILE_SYSTEM) |
- void appendURL(const KURL&, long long offset, long long length, double expectedModificationTime); |
+ void appendFileSystemURL(const KURL&, long long offset, long long length, double expectedModificationTime); |
#endif |
private: |
@@ -202,6 +207,43 @@ |
BlobDataItemList m_items; |
}; |
+class BlobDataHandle : public ThreadSafeRefCounted<BlobDataHandle> { |
+public: |
+ // For empty blob construction. |
+ static PassRefPtr<BlobDataHandle> create() |
+ { |
+ return adoptRef(new BlobDataHandle()); |
+ } |
+ |
+ // For initial creation. |
+ static PassRefPtr<BlobDataHandle> create(PassOwnPtr<BlobData> data, long long size) |
+ { |
+ return adoptRef(new BlobDataHandle(data, size)); |
+ } |
+ |
+ // For deserialization of script values and ipc messages. |
+ static PassRefPtr<BlobDataHandle> create(const String& uuid, const String& type, long long size) |
+ { |
+ return adoptRef(new BlobDataHandle(uuid, type, size)); |
+ } |
+ |
+ String uuid() const { return m_uuid.isolatedCopy(); } |
+ String type() const { return m_type.isolatedCopy(); } |
+ unsigned long long size() { return m_size; } |
+ |
+ ~BlobDataHandle(); |
+ |
+private: |
+ BlobDataHandle(); |
+ BlobDataHandle(PassOwnPtr<BlobData> data, long long size); |
+ BlobDataHandle(const String& uuid, const String& type, long long size); |
+ |
+ // FIXME: check that null or empty strings don't have some wierd thread affinity that isolatedCopy() doesn't evade??? |
+ const String m_uuid; |
+ const String m_type; |
+ const long long m_size; |
+}; |
+ |
} // namespace WebCore |
#endif // BlobData_h |