Chromium Code Reviews| 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(); |
|
kinuko
2013/10/20 09:27:33
Sorry for post-commit comments, this question just
michaeln
2013/10/22 02:38:53
Thnx for pointing that out, I'll post a change to
|
| } |
| @@ -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(®isterBlobURLTask, 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(®isterBlobURLFromTask, 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) |