OLD | NEW |
---|---|
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 15 matching lines...) Expand all Loading... | |
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 BlobRegistry_h | 31 #ifndef BlobRegistry_h |
32 #define BlobRegistry_h | 32 #define BlobRegistry_h |
33 | 33 |
34 #include <wtf/PassOwnPtr.h> | 34 #include <wtf/PassOwnPtr.h> |
35 #include <wtf/PassRefPtr.h> | 35 #include <wtf/PassRefPtr.h> |
36 #include <wtf/text/WTFString.h> | |
36 #include <wtf/Vector.h> | 37 #include <wtf/Vector.h> |
37 | 38 |
38 namespace WebCore { | 39 namespace WebCore { |
39 | 40 |
40 class BlobData; | 41 class BlobData; |
41 class BlobRegistry; | 42 class BlobDataHandle; |
42 class KURL; | 43 class KURL; |
43 class ResourceError; | 44 class ResourceError; |
44 class ResourceHandle; | 45 class ResourceHandle; |
45 class ResourceHandleClient; | 46 class ResourceHandleClient; |
46 class ResourceRequest; | 47 class ResourceRequest; |
47 class ResourceResponse; | 48 class ResourceResponse; |
49 class SecurityOrigin; | |
48 | 50 |
49 // Returns a single instance of BlobRegistry. | |
50 BlobRegistry& blobRegistry(); | |
51 | |
52 // BlobRegistry is not thread-safe. It should only be called from main thread. | |
53 class BlobRegistry { | 51 class BlobRegistry { |
54 public: | 52 public: |
55 // Registers a blob URL referring to the specified blob data. | 53 // BlobData registration: may be called on any thread. |
56 virtual void registerBlobURL(const KURL&, PassOwnPtr<BlobData>) = 0; | 54 virtual void registerBlobData(const String& uuid, PassOwnPtr<BlobData>) = 0; |
57 | 55 virtual void addBlobDataRef(const String& uuid) = 0; |
58 // Registers a blob URL referring to the blob data identified by the specifi ed srcURL. | 56 virtual void removeBlobDataRef(const String& uuid) = 0; |
59 virtual void registerBlobURL(const KURL&, const KURL& srcURL) = 0; | |
60 | 57 |
61 virtual void unregisterBlobURL(const KURL&) = 0; | 58 // Public Blob URL registration: may be called on any thread. |
62 virtual bool loadResourceSynchronously(const ResourceRequest&, ResourceError &, ResourceResponse&, Vector<char>& data) = 0; | 59 virtual void registerPublicBlobURL(SecurityOrigin*, const KURL&, PassRefPtr< BlobDataHandle>) = 0; |
60 virtual void revokePublicBlobURL(const KURL&) = 0; | |
61 virtual PassRefPtr<SecurityOrigin> cachedUniqueOrigin(const KURL&) = 0; | |
62 | |
63 // For use on the main therad only. | |
kinuko
2012/10/31 14:19:46
nit: typo (therad -> thread)
| |
64 //PassRefPtr<ResourceHandle> createResourceHandle(const ResourceRequest&, Re sourceHandleClient*); | |
65 //bool loadPublicBlobURLSynchronously(const ResourceRequest&, ResourceError& , ResourceResponse&, Vector<char>& data); | |
63 | 66 |
64 protected: | 67 protected: |
65 virtual ~BlobRegistry() { } | 68 // Helpers for derivatives to maintain a mapping from Blob URL to unique sec urity origins. This mapping is thead-specific. |
69 static void setCachedUniqueOrigin(const KURL&, SecurityOrigin*); | |
70 static void clearCachedUniqueOrigin(const KURL&); | |
71 static PassRefPtr<SecurityOrigin> getCachedUniqueOrigin(const KURL&); | |
66 }; | 72 }; |
67 | 73 |
74 BlobRegistry& blobRegistry(); | |
75 | |
68 } // namespace WebCore | 76 } // namespace WebCore |
69 | 77 |
70 #endif // BlobRegistry_h | 78 #endif // BlobRegistry_h |
OLD | NEW |