Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1249)

Unified Diff: Source/core/platform/network/BlobData.h

Issue 23992003: blob hacking webcore style (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/platform/chromium/support/WebHTTPBody.cpp ('k') | Source/core/platform/network/BlobData.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/platform/network/BlobData.h
diff --git a/Source/core/platform/network/BlobData.h b/Source/core/platform/network/BlobData.h
index 2b2ea9f4de8b54a0c747e344b260f4ca85e39efe..91e0d1beca6fdbc2d8c2662c43e86dff98dfd0a1 100644
--- a/Source/core/platform/network/BlobData.h
+++ b/Source/core/platform/network/BlobData.h
@@ -40,6 +40,8 @@
namespace WebCore {
+class BlobDataHandle;
+
class RawData : public ThreadSafeRefCounted<RawData> {
public:
static PassRefPtr<RawData> create()
@@ -102,19 +104,19 @@ struct BlobDataItem {
}
// 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())
{
}
- // Constructor for URL type (e.g. FileSystem files).
- BlobDataItem(const KURL& url, long long offset, long long length, double expectedModificationTime)
- : type(URL)
- , url(url)
+ // Constructor for FileSystem file type.
+ BlobDataItem(const KURL& fileSystemURL, long long offset, long long length, double expectedModificationTime)
+ : type(FileSystemURL)
+ , fileSystemURL(fileSystemURL)
, offset(offset)
, length(length)
, expectedModificationTime(expectedModificationTime)
@@ -128,17 +130,13 @@ struct BlobDataItem {
Data,
File,
Blob,
- URL
+ FileSystemURL
} type;
- // For Data type.
- RefPtr<RawData> data;
-
- // For File type.
- String path;
-
- // For Blob or URL type.
- KURL url;
+ RefPtr<RawData> data; // For Data type.
+ String path; // For File type.
+ KURL fileSystemURL; // For FileSystemURL type.
+ RefPtr<BlobDataHandle> blobDataHandle; // For Blob type.
long long offset;
long long length;
@@ -180,8 +178,8 @@ public:
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 appendURL(const KURL&, long long offset, long long length, double expectedModificationTime);
+ void appendBlob(PassRefPtr<BlobDataHandle>, long long offset, long long length);
+ void appendFileSystemURL(const KURL&, long long offset, long long length, double expectedModificationTime);
private:
friend class BlobRegistryImpl;
@@ -197,21 +195,41 @@ private:
BlobDataItemList m_items;
};
-// FIXME: This class is mostly place holder until I get farther along with
-// https://bugs.webkit.org/show_bug.cgi?id=108733 and more specifically with landing
-// https://codereview.chromium.org/11192017/.
+
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>, long long size);
- KURL m_internalURL;
+ BlobDataHandle(const String& uuid, const String& type, long long size);
+
+ const String m_uuid;
+ const String m_type;
+ const long long m_size;
};
} // namespace WebCore
« no previous file with comments | « Source/core/platform/chromium/support/WebHTTPBody.cpp ('k') | Source/core/platform/network/BlobData.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698