Index: WebCore/platform/network/BlobRegistry.h |
=================================================================== |
--- WebCore/platform/network/BlobRegistry.h (revision 140218) |
+++ WebCore/platform/network/BlobRegistry.h (working copy) |
@@ -33,38 +33,42 @@ |
#include <wtf/PassOwnPtr.h> |
#include <wtf/PassRefPtr.h> |
+#include <wtf/text/WTFString.h> |
#include <wtf/Vector.h> |
namespace WebCore { |
class BlobData; |
-class BlobRegistry; |
+class BlobDataHandle; |
class KURL; |
class ResourceError; |
class ResourceHandle; |
class ResourceHandleClient; |
class ResourceRequest; |
class ResourceResponse; |
+class SecurityOrigin; |
-// Returns a single instance of BlobRegistry. |
-BlobRegistry& blobRegistry(); |
- |
-// BlobRegistry is not thread-safe. It should only be called from main thread. |
class BlobRegistry { |
public: |
- // Registers a blob URL referring to the specified blob data. |
- virtual void registerBlobURL(const KURL&, PassOwnPtr<BlobData>) = 0; |
- |
- // Registers a blob URL referring to the blob data identified by the specified srcURL. |
- virtual void registerBlobURL(const KURL&, const KURL& srcURL) = 0; |
+ // BlobData registration: may be called on any thread. |
+ virtual void registerBlobData(const String& uuid, PassOwnPtr<BlobData>) = 0; |
+ virtual void addBlobDataRef(const String& uuid) = 0; |
+ virtual void removeBlobDataRef(const String& uuid) = 0; |
- virtual void unregisterBlobURL(const KURL&) = 0; |
- virtual bool loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data) = 0; |
+ // Public Blob URL registration: may be called on any thread. |
+ virtual void registerPublicBlobURL(SecurityOrigin*, const KURL&, PassRefPtr<BlobDataHandle>) = 0; |
+ virtual void revokePublicBlobURL(const KURL&) = 0; |
+ virtual PassRefPtr<SecurityOrigin> cachedUniqueOrigin(const KURL&) = 0; |
protected: |
- virtual ~BlobRegistry() { } |
+ // Helpers for derivatives to maintain a mapping from Blob URL to unique security origins. This mapping is thead-specific. |
+ static void setCachedUniqueOrigin(const KURL&, SecurityOrigin*); |
+ static void clearCachedUniqueOrigin(const KURL&); |
+ static PassRefPtr<SecurityOrigin> getCachedUniqueOrigin(const KURL&); |
}; |
+BlobRegistry& blobRegistry(); |
+ |
} // namespace WebCore |
#endif // BlobRegistry_h |