Index: WebCore/platform/network/BlobRegistryImpl.h |
=================================================================== |
--- WebCore/platform/network/BlobRegistryImpl.h (revision 140218) |
+++ WebCore/platform/network/BlobRegistryImpl.h (working copy) |
@@ -48,29 +48,52 @@ |
class ResourceRequest; |
class ResourceResponse; |
-// BlobRegistryImpl is not thread-safe. It should only be called from main thread. |
class BlobRegistryImpl : public BlobRegistry { |
WTF_MAKE_FAST_ALLOCATED; |
public: |
virtual ~BlobRegistryImpl() { } |
- virtual void registerBlobURL(const KURL&, PassOwnPtr<BlobData>); |
- virtual void registerBlobURL(const KURL&, const KURL& srcURL); |
- virtual void unregisterBlobURL(const KURL&); |
- virtual bool loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data); |
+ // BlobRegistry interface methods. |
+ virtual void registerBlobData(const String& uuid, PassOwnPtr<BlobData>); |
+ virtual void addBlobDataRef(const String& uuid); |
+ virtual void removeBlobDataRef(const String& uuid); |
+ virtual void registerPublicBlobURL(SecurityOrigin*, const KURL&, PassRefPtr<BlobDataHandle>); |
+ virtual void revokePublicBlobURL(const KURL&); |
+ virtual PassRefPtr<SecurityOrigin> cachedUniqueOrigin(const KURL&); |
+ // Extra methods that are not defined in the base class to support BlobURL resource loading |
+ // and Form uploads that include blobs as file input elements. In-process implementations need |
+ // direct access to the underlying data for these functions, but not all ports need this. |
+ // Chromium ports perform these functions out-of-process. |
+ // TODO: fix up callsites that currently use FromURL that need to use FromUUID in other ports. |
+ PassRefPtr<BlobStorageData> getBlobDataFromUUID(const String&) const; |
PassRefPtr<BlobStorageData> getBlobDataFromURL(const KURL&) const; |
- |
+ bool loadResourceSynchronously(const ResourceRequest&, ResourceError&, ResourceResponse&, Vector<char>& data); |
PassRefPtr<ResourceHandle> createResourceHandle(const ResourceRequest&, ResourceHandleClient*); |
private: |
+ class URLRegistrationHelper; |
+ typedef HashMap<String, RefPtr<BlobDataHandle> > BlobURLMap; |
+ typedef HashMap<String, std::pair<int, RefPtr<BlobStorageData> > > BlobMap; |
+ |
bool shouldLoadResource(const ResourceRequest& request) const; |
void appendStorageItems(BlobStorageData*, const BlobDataItemList&); |
void appendStorageItems(BlobStorageData*, const BlobDataItemList&, long long offset, long long length); |
- HashMap<String, RefPtr<BlobStorageData> > m_blobs; |
+ // The url map is only accessed on the main thread. |
+ BlobURLMap m_publicURLs; |
+ |
+ // The blob map is accessed on multiple threads, the mutex protects it from concurrent access. |
+ mutable Mutex m_mutex; |
+ BlobMap m_blobs; |
}; |
} // namespace WebCore |
+#if PLATFORM(CHROMIUM) |
+error error error |
+just putting junk here for now to see that we're not trying to include this anywhere |
+might be worth leaving in for real since it documents that fact that this is n/a for chromium |
+#endif |
+ |
#endif // BlobRegistryImpl_h |