Chromium Code Reviews| Index: public/platform/WebBlobRegistry.h |
| diff --git a/public/platform/WebBlobRegistry.h b/public/platform/WebBlobRegistry.h |
| index 7dac23d2d1591f6587d7cbb0ac4016c9629b1682..4fa9b4249e2a53f9722dea155f1678f6246a1e2b 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,42 @@ 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: |
| + // The blob is build in the registry on destruction of this class. |
| + // 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) |
| + // Calls on this object can be sending IPCs to the browser process, so make |
| + // sure to destruct this ASAP. |
| + class Builder { |
| + public: |
| + virtual ~Builder() { } |
|
jochen (gone - plz use gerrit)
2015/06/12 08:39:23
not needed
jsbell
2015/06/12 16:43:43
Is this for planned subclasses in unit tests on th
dmurph
2015/06/12 19:06:48
Yes, there will be a mock subclass of this as well
|
| + 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; |
| + }; |
| + |
| 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 on destruction |
| + // of the builder. Append calls on the builder can be sending state over |
| + // to the browser (to avoid copying), so destruct this builder ASAP. |
| + 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) { } |