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

Side by Side Diff: public/platform/WebBlobRegistry.h

Issue 1162773003: [Blob] Dependencies for blob storage testing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Builder for WebBlobRegistry Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « public/platform/WebBlobData.h ('k') | public/platform/WebThreadSafeData.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 14 matching lines...) Expand all
25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 */ 29 */
30 30
31 #ifndef WebBlobRegistry_h 31 #ifndef WebBlobRegistry_h
32 #define WebBlobRegistry_h 32 #define WebBlobRegistry_h
33 33
34 #include "WebCommon.h" 34 #include "WebCommon.h"
35 #include "WebThreadSafeData.h"
35 36
36 namespace blink { 37 namespace blink {
37 38
38 class WebBlobData; 39 class WebBlobData;
39 class WebString; 40 class WebString;
40 class WebURL; 41 class WebURL;
41 42
43 // Acts as singleton facade for all Blob interactions ouside of blink. This
44 // includes blob:
45 // * creation,
46 // * reference counting,
47 // * publishing, and
48 // * streaming.
42 class WebBlobRegistry { 49 class WebBlobRegistry {
43 public: 50 public:
51 // The blob is build in the registry on destruction of this class.
52 // Preconditions:
53 // * Not meant to be used on multiple threads.
54 // * Must not be kept alive longer than creator WebBlobRegistry (shouldn't
55 // be an issue because of the singleton nature of the WebBlobRegistry)
56 // Calls on this object can be sending IPCs to the browser process, so make
57 // sure to destruct this ASAP.
58 class Builder {
59 public:
60 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
61 virtual void appendData(const WebThreadSafeData&) = 0;
62 virtual void appendFile(const WebString& path, uint64_t offset, uint64_t length, double expectedModificationTime) = 0;
63 // Calling this method ensures the given blob lives for the creation of
64 // the new blob.
65 virtual void appendBlob(const WebString& uuid, uint64_t offset, uint64_t length) = 0;
66 virtual void appendFileSystemURL(const WebURL&, uint64_t offset, uint64_ t length, double expectedModificationTime) = 0;
67 };
68
44 virtual ~WebBlobRegistry() { } 69 virtual ~WebBlobRegistry() { }
45 70
71 // TODO(dmurph): Deprecate and migrate to createBuilder
46 virtual void registerBlobData(const WebString& uuid, const WebBlobData&) { } 72 virtual void registerBlobData(const WebString& uuid, const WebBlobData&) { }
73
74 // Caller takes ownership of the Builder. The blob is finalized on destructi on
75 // of the builder. Append calls on the builder can be sending state over
76 // to the browser (to avoid copying), so destruct this builder ASAP.
77 virtual Builder* createBuilder(const WebString& uuid, const WebString& conte ntType) { BLINK_ASSERT_NOT_REACHED(); return nullptr; }
78
47 virtual void addBlobDataRef(const WebString& uuid) { } 79 virtual void addBlobDataRef(const WebString& uuid) { }
48 virtual void removeBlobDataRef(const WebString& uuid) { } 80 virtual void removeBlobDataRef(const WebString& uuid) { }
49 virtual void registerPublicBlobURL(const WebURL&, const WebString& uuid) { } 81 virtual void registerPublicBlobURL(const WebURL&, const WebString& uuid) { }
50 virtual void revokePublicBlobURL(const WebURL&) { } 82 virtual void revokePublicBlobURL(const WebURL&) { }
51 83
52 // Registers a stream URL referring to a stream with the specified media 84 // Registers a stream URL referring to a stream with the specified media
53 // type. 85 // type.
54 virtual void registerStreamURL(const WebURL&, const WebString&) { BLINK_ASSE RT_NOT_REACHED(); } 86 virtual void registerStreamURL(const WebURL&, const WebString&) { BLINK_ASSE RT_NOT_REACHED(); }
55 87
56 // Registers a stream URL referring to the stream identified by the 88 // Registers a stream URL referring to the stream identified by the
(...skipping 14 matching lines...) Expand all
71 // so it won't receive any more data. 103 // so it won't receive any more data.
72 virtual void abortStream(const WebURL&) { BLINK_ASSERT_NOT_REACHED(); } 104 virtual void abortStream(const WebURL&) { BLINK_ASSERT_NOT_REACHED(); }
73 105
74 // Unregisters a stream referred by the URL. 106 // Unregisters a stream referred by the URL.
75 virtual void unregisterStreamURL(const WebURL&) { BLINK_ASSERT_NOT_REACHED() ; } 107 virtual void unregisterStreamURL(const WebURL&) { BLINK_ASSERT_NOT_REACHED() ; }
76 }; 108 };
77 109
78 } // namespace blink 110 } // namespace blink
79 111
80 #endif // WebBlobRegistry_h 112 #endif // WebBlobRegistry_h
OLDNEW
« no previous file with comments | « public/platform/WebBlobData.h ('k') | public/platform/WebThreadSafeData.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698