Modified: trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp (201635 => 201636)
--- trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp 2016-06-03 05:27:53 UTC (rev 201635)
+++ trunk/Source/WebCore/fileapi/ThreadableBlobRegistry.cpp 2016-06-03 05:38:44 UTC (rev 201636)
@@ -51,43 +51,6 @@
namespace WebCore {
-struct BlobRegistryContext {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- BlobRegistryContext(const URL& url, Vector<BlobPart> blobParts, const String& contentType)
- : url(url.isolatedCopy())
- , contentType(contentType.isolatedCopy())
- , blobParts(WTFMove(blobParts))
- {
- for (BlobPart& part : blobParts)
- part.detachFromCurrentThread();
- }
-
- BlobRegistryContext(const URL& url, const URL& srcURL)
- : url(url.isolatedCopy())
- , srcURL(srcURL.isolatedCopy())
- {
- }
-
- BlobRegistryContext(const URL& url)
- : url(url.isolatedCopy())
- {
- }
-
- BlobRegistryContext(const URL& url, const String& path, const String& contentType)
- : url(url.isolatedCopy())
- , path(path.isolatedCopy())
- , contentType(contentType.isolatedCopy())
- {
- }
-
- URL url;
- URL srcURL;
- String path;
- String contentType;
- Vector<BlobPart> blobParts;
-};
-
typedef HashMap<String, RefPtr<SecurityOrigin>> BlobUrlOriginMap;
static ThreadSpecific<BlobUrlOriginMap>& originMap()
@@ -117,9 +80,8 @@
if (isMainThread())
blobRegistry().registerFileBlobURL(url, BlobDataFileReference::create(path), contentType);
else {
- // BlobRegistryContext performs an isolated copy of data.
- callOnMainThread([context = std::make_unique<BlobRegistryContext>(url, path, contentType)] {
- blobRegistry().registerFileBlobURL(context->url, BlobDataFileReference::create(context->path), context->contentType);
+ callOnMainThread([url = "" path = path.isolatedCopy(), contentType = contentType.isolatedCopy()] {
+ blobRegistry().registerFileBlobURL(url, BlobDataFileReference::create(path), contentType);
});
}
}
@@ -129,9 +91,10 @@
if (isMainThread())
blobRegistry().registerBlobURL(url, WTFMove(blobParts), contentType);
else {
- // BlobRegistryContext performs an isolated copy of data.
- callOnMainThread([context = std::make_unique<BlobRegistryContext>(url, WTFMove(blobParts), contentType)] {
- blobRegistry().registerBlobURL(context->url, WTFMove(context->blobParts), context->contentType);
+ for (auto& part : blobParts)
+ part.detachFromCurrentThread();
+ callOnMainThread([url = "" blobParts = WTFMove(blobParts), contentType = contentType.isolatedCopy()]() mutable {
+ blobRegistry().registerBlobURL(url, WTFMove(blobParts), contentType);
});
}
}
@@ -145,9 +108,8 @@
if (isMainThread())
blobRegistry().registerBlobURL(url, srcURL);
else {
- // BlobRegistryContext performs an isolated copy of data.
- callOnMainThread([context = std::make_unique<BlobRegistryContext>(url, srcURL)] {
- blobRegistry().registerBlobURL(context->url, context->srcURL);
+ callOnMainThread([url = "" srcURL = srcURL.isolatedCopy()] {
+ blobRegistry().registerBlobURL(url, srcURL);
});
}
}
@@ -172,9 +134,8 @@
if (isMainThread())
blobRegistry().registerBlobURLForSlice(newURL, srcURL, start, end);
else {
- // BlobRegistryContext performs an isolated copy of data.
- callOnMainThread([context = std::make_unique<BlobRegistryContext>(newURL, srcURL), start, end] {
- blobRegistry().registerBlobURLForSlice(context->url, context->srcURL, start, end);
+ callOnMainThread([newURL = newURL.isolatedCopy(), srcURL = srcURL.isolatedCopy(), start, end] {
+ blobRegistry().registerBlobURLForSlice(newURL, srcURL, start, end);
});
}
}
@@ -185,10 +146,9 @@
if (isMainThread())
resultSize = blobRegistry().blobSize(url);
else {
- // BlobRegistryContext performs an isolated copy of data.
BinarySemaphore semaphore;
- callOnMainThread([context = std::make_unique<BlobRegistryContext>(url), &semaphore, &resultSize] {
- resultSize = blobRegistry().blobSize(context->url);
+ callOnMainThread([url = "" &semaphore, &resultSize] {
+ resultSize = blobRegistry().blobSize(url);
semaphore.signal();
});
semaphore.wait(std::numeric_limits<double>::max());
@@ -204,9 +164,8 @@
if (isMainThread())
blobRegistry().unregisterBlobURL(url);
else {
- // BlobRegistryContext performs an isolated copy of data.
- callOnMainThread([context = std::make_unique<BlobRegistryContext>(url)] {
- blobRegistry().unregisterBlobURL(context->url);
+ callOnMainThread([url = "" {
+ blobRegistry().unregisterBlobURL(url);
});
}
}