Title: [201636] trunk/Source/WebCore
Revision
201636
Author
[email protected]
Date
2016-06-02 22:38:44 -0700 (Thu, 02 Jun 2016)

Log Message

Drop BlobRegistryContext class as it is no longer needed
https://bugs.webkit.org/show_bug.cgi?id=158328

Reviewed by Brady Eidson.

Drop BlobRegistryContext class as it is no longer needed. We can now
call isolatedCopy() as we capture in the lambda.

* fileapi/ThreadableBlobRegistry.cpp:
(WebCore::ThreadableBlobRegistry::registerFileBlobURL):
(WebCore::ThreadableBlobRegistry::registerBlobURL):
(WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
(WebCore::ThreadableBlobRegistry::blobSize):
(WebCore::ThreadableBlobRegistry::unregisterBlobURL):
(WebCore::BlobRegistryContext::BlobRegistryContext): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (201635 => 201636)


--- trunk/Source/WebCore/ChangeLog	2016-06-03 05:27:53 UTC (rev 201635)
+++ trunk/Source/WebCore/ChangeLog	2016-06-03 05:38:44 UTC (rev 201636)
@@ -1,3 +1,21 @@
+2016-06-02  Chris Dumez  <[email protected]>
+
+        Drop BlobRegistryContext class as it is no longer needed
+        https://bugs.webkit.org/show_bug.cgi?id=158328
+
+        Reviewed by Brady Eidson.
+
+        Drop BlobRegistryContext class as it is no longer needed. We can now
+        call isolatedCopy() as we capture in the lambda.
+
+        * fileapi/ThreadableBlobRegistry.cpp:
+        (WebCore::ThreadableBlobRegistry::registerFileBlobURL):
+        (WebCore::ThreadableBlobRegistry::registerBlobURL):
+        (WebCore::ThreadableBlobRegistry::registerBlobURLForSlice):
+        (WebCore::ThreadableBlobRegistry::blobSize):
+        (WebCore::ThreadableBlobRegistry::unregisterBlobURL):
+        (WebCore::BlobRegistryContext::BlobRegistryContext): Deleted.
+
 2016-06-02  Zalan Bujtas  <[email protected]>
 
         Repaint issue with vertical text in an out of flow container.

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);
         });
     }
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to