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

Unified Diff: Source/core/fileapi/BlobRegistry.cpp

Issue 23992003: blob hacking webcore style (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/core/fileapi/BlobRegistry.h ('k') | Source/core/fileapi/BlobURL.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fileapi/BlobRegistry.cpp
diff --git a/Source/core/fileapi/BlobRegistry.cpp b/Source/core/fileapi/BlobRegistry.cpp
index b649b2697be18fb74ad64bd53abff6d6dc652d6e..bae718f11d4a97f146cbb87bdc4dda050e9d04db 100644
--- a/Source/core/fileapi/BlobRegistry.cpp
+++ b/Source/core/fileapi/BlobRegistry.cpp
@@ -104,7 +104,6 @@ public:
static WebBlobRegistry* blobRegistry()
{
- ASSERT(isMainThread());
return WebKit::Platform::current()->blobRegistry();
}
@@ -133,66 +132,31 @@ static void removeFromOriginMap(const KURL& url)
originMap()->remove(url.string());
}
-static void registerBlobURLTask(void* context)
+void BlobRegistry::registerBlobData(const String& uuid, PassOwnPtr<BlobData> data)
{
- OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobRegistryContext*>(context));
- if (WebBlobRegistry* registry = blobRegistry()) {
- WebBlobData webBlobData(blobRegistryContext->blobData.release());
- registry->registerBlobURL(blobRegistryContext->url, webBlobData);
- }
+ blobRegistry()->registerBlobData(uuid, WebKit::WebBlobData(data));
}
-void BlobRegistry::registerBlobURL(const KURL& url, PassOwnPtr<BlobData> blobData)
+void BlobRegistry::addBlobDataRef(const String& uuid)
{
- if (isMainThread()) {
- if (WebBlobRegistry* registry = blobRegistry()) {
- WebBlobData webBlobData(blobData);
- registry->registerBlobURL(url, webBlobData);
- }
- } else {
- OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(url, blobData));
- callOnMainThread(&registerBlobURLTask, context.leakPtr());
- }
+ blobRegistry()->addBlobDataRef(uuid);
}
-static void registerBlobURLFromTask(void* context)
+void BlobRegistry::removeBlobDataRef(const String& uuid)
{
- OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobRegistryContext*>(context));
- if (WebBlobRegistry* registry = blobRegistry())
- registry->registerBlobURL(blobRegistryContext->url, blobRegistryContext->srcURL);
+ blobRegistry()->removeBlobDataRef(uuid);
}
-void BlobRegistry::registerBlobURL(SecurityOrigin* origin, const KURL& url, const KURL& srcURL)
+void BlobRegistry::registerPublicBlobURL(SecurityOrigin* origin, const KURL& url, PassRefPtr<BlobDataHandle> handle)
{
saveToOriginMap(origin, url);
-
- if (isMainThread()) {
- if (WebBlobRegistry* registry = blobRegistry())
- registry->registerBlobURL(url, srcURL);
- } else {
- OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(url, srcURL));
- callOnMainThread(&registerBlobURLFromTask, context.leakPtr());
- }
-}
-
-static void unregisterBlobURLTask(void* context)
-{
- OwnPtr<BlobRegistryContext> blobRegistryContext = adoptPtr(static_cast<BlobRegistryContext*>(context));
- if (WebBlobRegistry* registry = blobRegistry())
- registry->unregisterBlobURL(blobRegistryContext->url);
+ blobRegistry()->registerPublicBlobURL(url, handle->uuid());
}
-void BlobRegistry::unregisterBlobURL(const KURL& url)
+void BlobRegistry::revokePublicBlobURL(const KURL& url)
{
removeFromOriginMap(url);
-
- if (isMainThread()) {
- if (WebBlobRegistry* registry = blobRegistry())
- registry->unregisterBlobURL(url);
- } else {
- OwnPtr<BlobRegistryContext> context = adoptPtr(new BlobRegistryContext(url));
- callOnMainThread(&unregisterBlobURLTask, context.leakPtr());
- }
+ blobRegistry()->revokePublicBlobURL(url);
}
static void registerStreamURLTask(void* context)
« no previous file with comments | « Source/core/fileapi/BlobRegistry.h ('k') | Source/core/fileapi/BlobURL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698