Changeset 206122 in webkit


Ignore:
Timestamp:
Sep 19, 2016 3:33:56 PM (8 years ago)
Author:
dbates@webkit.org
Message:

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):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r206121 r206122  
     12016-09-19  Daniel Bates  <dabates@apple.com>
     2
     3        Cleanup: Remove an extraneous copy of SecurityOrigin
     4        https://bugs.webkit.org/show_bug.cgi?id=162118
     5
     6        Reviewed by Youenn Fablet.
     7
     8        Share one isolated copy of the SecurityOrigin between the ContentSecurityPolicy and
     9        LoaderTaskOptions objects instead of creating two isolated copies of the SecurityOrigin.
     10        This is safe because both ContentSecurityPolicy and LoaderTaskOptions are instantiated
     11        in WorkerThreadableLoader::MainThreadBridge for use on the main thread only.
     12
     13        * loader/WorkerThreadableLoader.cpp:
     14        (WebCore::LoaderTaskOptions::LoaderTaskOptions):
     15        (WebCore::WorkerThreadableLoader::MainThreadBridge::MainThreadBridge):
     16
    1172016-09-19  Antti Koivisto  <antti@apple.com>
    218
  • trunk/Source/WebCore/loader/WorkerThreadableLoader.cpp

    r206074 r206122  
    8686
    8787struct LoaderTaskOptions {
    88     LoaderTaskOptions(const ThreadableLoaderOptions&, const String&, const SecurityOrigin&);
     88    LoaderTaskOptions(const ThreadableLoaderOptions&, const String&, Ref<SecurityOrigin>&&);
    8989    ThreadableLoaderOptions options;
    9090    String referrer;
    91     RefPtr<SecurityOrigin> origin;
     91    Ref<SecurityOrigin> origin;
    9292};
    9393
    94 LoaderTaskOptions::LoaderTaskOptions(const ThreadableLoaderOptions& options, const String& referrer, const SecurityOrigin& origin)
     94LoaderTaskOptions::LoaderTaskOptions(const ThreadableLoaderOptions& options, const String& referrer, Ref<SecurityOrigin>&& origin)
    9595    : options(options, options.preflightPolicy, options.contentSecurityPolicyEnforcement, options.initiator.isolatedCopy(), options.opaqueResponse)
    9696    , referrer(referrer.isolatedCopy())
    97     , origin(origin.isolatedCopy())
     97    , origin(WTFMove(origin))
    9898{
    9999}
     
    109109    ASSERT(contentSecurityPolicy);
    110110
    111     auto contentSecurityPolicyCopy = std::make_unique<ContentSecurityPolicy>(securityOrigin->isolatedCopy());
     111    auto securityOriginCopy = securityOrigin->isolatedCopy();
     112    auto contentSecurityPolicyCopy = std::make_unique<ContentSecurityPolicy>(securityOriginCopy);
    112113    contentSecurityPolicyCopy->copyStateFrom(contentSecurityPolicy);
    113114
    114     auto optionsCopy = std::make_unique<LoaderTaskOptions>(options, request.httpReferrer().isNull() ? outgoingReferrer : request.httpReferrer(), *securityOrigin);
     115    auto optionsCopy = std::make_unique<LoaderTaskOptions>(options, request.httpReferrer().isNull() ? outgoingReferrer : request.httpReferrer(), WTFMove(securityOriginCopy));
    115116
    116117    // Can we benefit from request being an r-value to create more efficiently its isolated copy?
Note: See TracChangeset for help on using the changeset viewer.