Index: WebCore/platform/network/chromium/BlobRegistryProxy.cpp |
=================================================================== |
--- WebCore/platform/network/chromium/BlobRegistryProxy.cpp (revision 140218) |
+++ WebCore/platform/network/chromium/BlobRegistryProxy.cpp (working copy) |
@@ -37,6 +37,7 @@ |
#include "BlobData.h" |
#include "KURL.h" |
#include "ResourceHandle.h" |
+#include "SecurityOrigin.h" |
#include <public/Platform.h> |
#include <public/WebBlobData.h> |
#include <public/WebBlobRegistry.h> |
@@ -46,9 +47,13 @@ |
namespace WebCore { |
+// FIXME: ensure webkit::init causes this to be initalized. |
+// Alternatively, remove the blobRegistry() accessor from WebKit::Platform and instead |
+// define a WebBlobRegistry::setBlobRegistry(WebBlobRegistry*) for embedders to inject |
+// and instance pointer into. Injecting these things is frustratingly messy? |
BlobRegistry& blobRegistry() |
{ |
- ASSERT(isMainThread()); |
+ // AtomicallyInitializedStatic(BlobRegistryProxy&, intance = *new BlobRegistryProxy); ?? |
DEFINE_STATIC_LOCAL(BlobRegistryProxy, instance, ()); |
return instance; |
} |
@@ -56,28 +61,48 @@ |
BlobRegistryProxy::BlobRegistryProxy() |
: m_webBlobRegistry(WebKit::Platform::current()->blobRegistry()) |
{ |
+ //ASSERT(isMainThread()); // FIXME: restore this assertion or claim this is ok. |
} |
-void BlobRegistryProxy::registerBlobURL(const KURL& url, PassOwnPtr<BlobData> blobData) |
+void BlobRegistryProxy::registerBlobData(const String& uuid, PassOwnPtr<BlobData> blobData) |
{ |
if (m_webBlobRegistry) { |
WebKit::WebBlobData webBlobData(blobData); |
- m_webBlobRegistry->registerBlobURL(url, webBlobData); |
+ m_webBlobRegistry->registerBlobData(uuid, webBlobData); |
} |
} |
-void BlobRegistryProxy::registerBlobURL(const KURL& url, const KURL& srcURL) |
+void BlobRegistryProxy::addBlobDataRef(const String& uuid) |
{ |
if (m_webBlobRegistry) |
- m_webBlobRegistry->registerBlobURL(url, srcURL); |
+ m_webBlobRegistry->addBlobDataRef(uuid); |
} |
-void BlobRegistryProxy::unregisterBlobURL(const KURL& url) |
+void BlobRegistryProxy::removeBlobDataRef(const String& uuid) |
{ |
if (m_webBlobRegistry) |
- m_webBlobRegistry->unregisterBlobURL(url); |
+ m_webBlobRegistry->removeBlobDataRef(uuid); |
} |
+void BlobRegistryProxy::registerPublicBlobURL(SecurityOrigin* origin, const KURL& url, PassRefPtr<BlobDataHandle> blobDataHandle) |
+{ |
+ BlobRegistry::setCachedUniqueOrigin(url, origin); |
+ if (m_webBlobRegistry) |
+ m_webBlobRegistry->registerPublicBlobURL(url, blobDataHandle->uuid()); |
+} |
+ |
+void BlobRegistryProxy::revokePublicBlobURL(const KURL& url) |
+{ |
+ BlobRegistry::clearCachedUniqueOrigin(url); |
+ if (m_webBlobRegistry) |
+ m_webBlobRegistry->revokePublicBlobURL(url); |
+} |
+ |
+PassRefPtr<SecurityOrigin> BlobRegistryProxy::cachedUniqueOrigin(const KURL& url) |
+{ |
+ return BlobRegistry::getCachedUniqueOrigin(url); |
+} |
+ |
} // namespace WebCore |
#endif |