Index: public/platform/WebBlobRegistry.h |
diff --git a/public/platform/WebBlobRegistry.h b/public/platform/WebBlobRegistry.h |
index 7dac23d2d1591f6587d7cbb0ac4016c9629b1682..5c9df4d39f965e4c1e013f9dcb90e6e86118e810 100644 |
--- a/public/platform/WebBlobRegistry.h |
+++ b/public/platform/WebBlobRegistry.h |
@@ -32,6 +32,7 @@ |
#define WebBlobRegistry_h |
#include "WebCommon.h" |
+#include "WebThreadSafeData.h" |
namespace blink { |
@@ -39,11 +40,45 @@ class WebBlobData; |
class WebString; |
class WebURL; |
+// Acts as singleton facade for all Blob interactions ouside of blink. This |
+// includes blob: |
+// * creation, |
+// * reference counting, |
+// * publishing, and |
+// * streaming. |
class WebBlobRegistry { |
public: |
+ // Builder class for creating blobs. The blob is built on calling the |
+ // build() method, where IPCs are sent to the browser. |
+ // Preconditions: |
+ // * Not meant to be used on multiple threads. |
+ // * Must not be kept alive longer than creator WebBlobRegistry (shouldn't |
+ // be an issue because of the singleton nature of the WebBlobRegistry) |
+ // * append.* methods are invalid after build() is called. |
+ class Builder { |
+ public: |
+ virtual ~Builder() { } |
+ virtual void appendData(const WebThreadSafeData&) = 0; |
+ virtual void appendFile(const WebString& path, uint64_t offset, uint64_t length, double expectedModificationTime) = 0; |
+ // Calling this method ensures the given blob lives for the creation of |
+ // the new blob. |
+ virtual void appendBlob(const WebString& uuid, uint64_t offset, uint64_t length) = 0; |
+ virtual void appendFileSystemURL(const WebURL&, uint64_t offset, uint64_t length, double expectedModificationTime) = 0; |
+ |
+ // Builds the blob. All calls to append* are invalid after calling this |
+ // method. |
+ virtual void build() = 0; |
+ }; |
+ |
virtual ~WebBlobRegistry() { } |
+ // TODO(dmurph): Deprecate and migrate to createBuilder |
virtual void registerBlobData(const WebString& uuid, const WebBlobData&) { } |
+ |
+ // Caller takes ownership of the Builder. The blob is finalized (and sent to |
+ // the browser) on calling build() on the Builder object. |
+ virtual Builder* createBuilder(const WebString& uuid, const WebString& contentType) { BLINK_ASSERT_NOT_REACHED(); return nullptr; } |
+ |
virtual void addBlobDataRef(const WebString& uuid) { } |
virtual void removeBlobDataRef(const WebString& uuid) { } |
virtual void registerPublicBlobURL(const WebURL&, const WebString& uuid) { } |