Title: [207084] releases/WebKitGTK/webkit-2.14/Source/WebCore
Revision
207084
Author
carlo...@webkit.org
Date
2016-10-11 03:49:00 -0700 (Tue, 11 Oct 2016)

Log Message

Merge r206122 - Cleanup: Remove an extraneous copy of SecurityOrigin
https://bugs.webkit.org/show_bug.cgi?id=162118

Reviewed by Youenn Fablet.

Share one isolated copy of the SecurityOrigin between the ContentSecurityPolicy and
LoaderTaskOptions objects instead of creating two isolated copies of the SecurityOrigin.
This is safe because both ContentSecurityPolicy and LoaderTaskOptions are instantiated
in WorkerThreadableLoader::MainThreadBridge for use on the main thread only.

* loader/WorkerThreadableLoader.cpp:
(WebCore::LoaderTaskOptions::LoaderTaskOptions):
(WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog (207083 => 207084)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-10-11 10:45:35 UTC (rev 207083)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/ChangeLog	2016-10-11 10:49:00 UTC (rev 207084)
@@ -1,3 +1,19 @@
+2016-09-19  Daniel Bates  <daba...@apple.com>
+
+        Cleanup: Remove an extraneous copy of SecurityOrigin
+        https://bugs.webkit.org/show_bug.cgi?id=162118
+
+        Reviewed by Youenn Fablet.
+
+        Share one isolated copy of the SecurityOrigin between the ContentSecurityPolicy and
+        LoaderTaskOptions objects instead of creating two isolated copies of the SecurityOrigin.
+        This is safe because both ContentSecurityPolicy and LoaderTaskOptions are instantiated
+        in WorkerThreadableLoader::MainThreadBridge for use on the main thread only.
+
+        * loader/WorkerThreadableLoader.cpp:
+        (WebCore::LoaderTaskOptions::LoaderTaskOptions):
+        (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
+
 2016-09-19  Chris Dumez  <cdu...@apple.com>
 
         Update XHTMLParser to recognize "-//W3C//DTD MathML 2.0//EN" public identifier

Modified: releases/WebKitGTK/webkit-2.14/Source/WebCore/loader/WorkerThreadableLoader.cpp (207083 => 207084)


--- releases/WebKitGTK/webkit-2.14/Source/WebCore/loader/WorkerThreadableLoader.cpp	2016-10-11 10:45:35 UTC (rev 207083)
+++ releases/WebKitGTK/webkit-2.14/Source/WebCore/loader/WorkerThreadableLoader.cpp	2016-10-11 10:49:00 UTC (rev 207084)
@@ -85,16 +85,16 @@
 }
 
 struct LoaderTaskOptions {
-    LoaderTaskOptions(const ThreadableLoaderOptions&, const String&, const SecurityOrigin&);
+    LoaderTaskOptions(const ThreadableLoaderOptions&, const String&, Ref<SecurityOrigin>&&);
     ThreadableLoaderOptions options;
     String referrer;
-    RefPtr<SecurityOrigin> origin;
+    Ref<SecurityOrigin> origin;
 };
 
-LoaderTaskOptions::LoaderTaskOptions(const ThreadableLoaderOptions& options, const String& referrer, const SecurityOrigin& origin)
+LoaderTaskOptions::LoaderTaskOptions(const ThreadableLoaderOptions& options, const String& referrer, Ref<SecurityOrigin>&& origin)
     : options(options, options.preflightPolicy, options.contentSecurityPolicyEnforcement, options.initiator.isolatedCopy(), options.opaqueResponse, options.sameOriginDataURLFlag)
     , referrer(referrer.isolatedCopy())
-    , origin(origin.isolatedCopy())
+    , origin(WTFMove(origin))
 {
 }
 
@@ -108,10 +108,11 @@
     ASSERT(securityOrigin);
     ASSERT(contentSecurityPolicy);
 
-    auto contentSecurityPolicyCopy = std::make_unique<ContentSecurityPolicy>(securityOrigin->isolatedCopy());
+    auto securityOriginCopy = securityOrigin->isolatedCopy();
+    auto contentSecurityPolicyCopy = std::make_unique<ContentSecurityPolicy>(securityOriginCopy);
     contentSecurityPolicyCopy->copyStateFrom(contentSecurityPolicy);
 
-    auto optionsCopy = std::make_unique<LoaderTaskOptions>(options, request.httpReferrer().isNull() ? outgoingReferrer : request.httpReferrer(), *securityOrigin);
+    auto optionsCopy = std::make_unique<LoaderTaskOptions>(options, request.httpReferrer().isNull() ? outgoingReferrer : request.httpReferrer(), WTFMove(securityOriginCopy));
 
     // Can we benefit from request being an r-value to create more efficiently its isolated copy?
     m_loaderProxy.postTaskToLoader([this, request = request.isolatedCopy(), options = WTFMove(optionsCopy), contentSecurityPolicyCopy = WTFMove(contentSecurityPolicyCopy)](ScriptExecutionContext& context) mutable {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to