Changeset 240805 in webkit


Ignore:
Timestamp:
Jan 31, 2019 12:01:07 PM (5 years ago)
Author:
jiewen_tan@apple.com
Message:

Formalize WebKitAdditions mechanism of LoadOptimizer
https://bugs.webkit.org/show_bug.cgi?id=193886
<rdar://problem/47696809>

Reviewed by Brent Fulgham.

Source/WebCore:

Covered by existing tests.

  • platform/network/ResourceRequestBase.h:

Export isolatedCopy().

Source/WebKit:

This patch does the following few things:
1) formalizes WebKitAdditions mechanism of LoadOptimizer;
2) modernizes AppLinks code in tryInterceptNavigation to use BlockPtr;
3) lets AppLinks have higher precedence than LoadOptimizer.

  • SourcesCocoa.txt:
  • UIProcess/Cocoa/LoadOptimizer.h: Removed.
  • UIProcess/Cocoa/LoadOptimizer.mm: Removed.
  • UIProcess/Cocoa/NavigationState.mm:

(WebKit::tryOptimizingLoad):
(WebKit::tryInterceptNavigation):

  • UIProcess/WebsiteData/WebsiteDataStore.cpp:

(WebKit::WebsiteDataStore::WebsiteDataStore):

  • UIProcess/WebsiteData/WebsiteDataStore.h:

(WebKit::WebsiteDataStore::loadOptimizer): Deleted.

  • WebKit.xcodeproj/project.pbxproj:

Tools:

  • MiniBrowser/MiniBrowser.entitlements:

Make com.apple.security.temporary-exception.mach-lookup.global-name an array.

Location:
trunk
Files:
2 deleted
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r240804 r240805  
     12019-01-31  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        Formalize WebKitAdditions mechanism of LoadOptimizer
     4        https://bugs.webkit.org/show_bug.cgi?id=193886
     5        <rdar://problem/47696809>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        Covered by existing tests.
     10
     11        * platform/network/ResourceRequestBase.h:
     12        Export isolatedCopy().
     13
    1142019-01-31  Jer Noble  <jer.noble@apple.com>
    215
  • trunk/Source/WebCore/platform/network/ResourceRequestBase.h

    r239742 r240805  
    5858    WTF_MAKE_FAST_ALLOCATED;
    5959public:
    60     ResourceRequest isolatedCopy() const;
     60    WEBCORE_EXPORT ResourceRequest isolatedCopy() const;
    6161    WEBCORE_EXPORT void setAsIsolatedCopy(const ResourceRequest&);
    6262
  • trunk/Source/WebKit/ChangeLog

    r240803 r240805  
     12019-01-31  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        Formalize WebKitAdditions mechanism of LoadOptimizer
     4        https://bugs.webkit.org/show_bug.cgi?id=193886
     5        <rdar://problem/47696809>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        This patch does the following few things:
     10        1) formalizes WebKitAdditions mechanism of LoadOptimizer;
     11        2) modernizes AppLinks code in tryInterceptNavigation to use BlockPtr;
     12        3) lets AppLinks have higher precedence than LoadOptimizer.
     13
     14        * SourcesCocoa.txt:
     15        * UIProcess/Cocoa/LoadOptimizer.h: Removed.
     16        * UIProcess/Cocoa/LoadOptimizer.mm: Removed.
     17        * UIProcess/Cocoa/NavigationState.mm:
     18        (WebKit::tryOptimizingLoad):
     19        (WebKit::tryInterceptNavigation):
     20        * UIProcess/WebsiteData/WebsiteDataStore.cpp:
     21        (WebKit::WebsiteDataStore::WebsiteDataStore):
     22        * UIProcess/WebsiteData/WebsiteDataStore.h:
     23        (WebKit::WebsiteDataStore::loadOptimizer): Deleted.
     24        * WebKit.xcodeproj/project.pbxproj:
     25
    1262019-01-31  Chris Dumez  <cdumez@apple.com>
    227
  • trunk/Source/WebKit/SourcesCocoa.txt

    r240685 r240805  
    325325UIProcess/Cocoa/IconLoadingDelegate.mm
    326326UIProcess/Cocoa/LegacyCustomProtocolManagerClient.mm
    327 UIProcess/Cocoa/LoadOptimizer.mm
    328327UIProcess/Cocoa/MediaCaptureUtilities.mm
    329328UIProcess/Cocoa/NavigationState.mm
  • trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm

    r240555 r240805  
    3838#import "AuthenticationDecisionListener.h"
    3939#import "CompletionHandlerCallChecker.h"
    40 #import "LoadOptimizer.h"
    4140#import "Logging.h"
    4241#import "NavigationActionData.h"
     
    8079#endif
    8180
     81#if USE(APPLE_INTERNAL_SDK)
     82#import <WebKitAdditions/NavigationStateAdditions.mm>
     83#endif
     84
    8285#if USE(QUICK_LOOK)
    8386#import "QuickLookDocumentData.h"
     
    466469#endif
    467470
     471#if !USE(APPLE_INTERNAL_SDK)
     472static void tryOptimizingLoad(const WebCore::ResourceRequest&, WebPageProxy&, Function<void(bool)>&& completionHandler)
     473{
     474    completionHandler(false);
     475}
     476#endif
     477
    468478static void tryInterceptNavigation(Ref<API::NavigationAction>&& navigationAction, WebPageProxy& page, WTF::Function<void(bool)>&& completionHandler)
    469479{
    470480#if HAVE(APP_LINKS)
    471481    if (navigationAction->shouldOpenAppLinks()) {
    472         auto* localCompletionHandler = new WTF::Function<void (bool)>(WTFMove(completionHandler));
    473         [LSAppLink openWithURL:navigationAction->request().url() completionHandler:[localCompletionHandler](BOOL success, NSError *) {
    474             dispatch_async(dispatch_get_main_queue(), [localCompletionHandler, success] {
    475                 (*localCompletionHandler)(success);
    476                 delete localCompletionHandler;
     482        auto callback = makeBlockPtr([request = navigationAction->request().isolatedCopy(), weakPage = makeWeakPtr(page), completionHandler = WTFMove(completionHandler)] (BOOL success, NSError *) mutable {
     483            RunLoop::main().dispatch([request = request.isolatedCopy(), weakPage, completionHandler = WTFMove(completionHandler), success]() mutable {
     484                if (!success && weakPage) {
     485                    tryOptimizingLoad(request, *weakPage, WTFMove(completionHandler));
     486                    return;
     487                }
     488                completionHandler(success);
    477489            });
    478         }];
    479         return;
    480     }
    481 #endif
    482 
    483 #if HAVE(LOAD_OPTIMIZER)
    484     if (LoadOptimizer::canOptimizeLoad(navigationAction->request().url())) {
    485         page.websiteDataStore().loadOptimizer().optimizeLoad(navigationAction->request(), page, WTFMove(completionHandler));
    486         return;
    487     }
    488 #endif
    489 
    490     completionHandler(false);
     490        });
     491        [LSAppLink openWithURL:navigationAction->request().url() completionHandler:callback.get()];
     492        return;
     493    }
     494#endif
     495
     496    tryOptimizingLoad(navigationAction->request(), page, WTFMove(completionHandler));
    491497}
    492498
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.cpp

    r240785 r240805  
    5757#include <wtf/RunLoop.h>
    5858
    59 #if HAVE(LOAD_OPTIMIZER)
    60 #include "LoadOptimizer.h"
    61 #endif
    62 
    6359#if ENABLE(NETSCAPE_PLUGIN_API)
    6460#include "PluginProcessManager.h"
     
    105101#endif
    106102    , m_client(makeUniqueRef<WebsiteDataStoreClient>())
     103{
    107104#if HAVE(LOAD_OPTIMIZER)
    108     , m_loadOptimizer(makeUniqueRef<LoadOptimizer>())
    109 #endif
    110 {
     105WEBSITEDATASTORE_LOADOPTIMIZER_ADDITIONS_2
     106#endif
    111107    WTF::setProcessPrivileges(allPrivileges());
    112108    maybeRegisterWithSessionIDMap();
     
    126122#endif
    127123    , m_client(makeUniqueRef<WebsiteDataStoreClient>())
     124{
    128125#if HAVE(LOAD_OPTIMIZER)
    129     , m_loadOptimizer(makeUniqueRef<LoadOptimizer>())
    130 #endif
    131 {
     126WEBSITEDATASTORE_LOADOPTIMIZER_ADDITIONS_2
     127#endif
    132128    maybeRegisterWithSessionIDMap();
    133129    platformInitialize();
  • trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStore.h

    r240785 r240805  
    5353#endif
    5454
     55#if USE(APPLE_INTERNAL_SDK)
     56#include <WebKitAdditions/WebsiteDataStoreAdditions.h>
     57#endif
     58
    5559namespace WebCore {
    5660class SecurityOrigin;
     
    6064
    6165class AuthenticatorManager;
    62 class LoadOptimizer;
    6366class SecKeyProxyStore;
    6467class StorageManager;
     
    228231
    229232#if HAVE(LOAD_OPTIMIZER)
    230     LoadOptimizer& loadOptimizer() { return m_loadOptimizer.get(); }
     233WEBSITEDATASTORE_LOADOPTIMIZER_ADDITIONS_1
    231234#endif
    232235
     
    307310
    308311    UniqueRef<WebsiteDataStoreClient> m_client;
    309 
    310 #if HAVE(LOAD_OPTIMIZER)
    311     UniqueRef<LoadOptimizer> m_loadOptimizer;
    312 #endif
    313312};
    314313
  • trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj

    r240685 r240805  
    10251025                5772F206217DBD6A0056BF2C /* HidService.h in Headers */ = {isa = PBXBuildFile; fileRef = 5772F204217DBD6A0056BF2C /* HidService.h */; };
    10261026                578DC2982155A0020074E815 /* LocalAuthenticationSoftLink.h in Headers */ = {isa = PBXBuildFile; fileRef = 578DC2972155A0010074E815 /* LocalAuthenticationSoftLink.h */; };
    1027                 57900B4021F8F9B8008317DE /* LoadOptimizer.h in Headers */ = {isa = PBXBuildFile; fileRef = 57900B3E21F8F9B8008317DE /* LoadOptimizer.h */; };
    10281027                57AC8F50217FEED90055438C /* HidConnection.h in Headers */ = {isa = PBXBuildFile; fileRef = 57AC8F4E217FEED90055438C /* HidConnection.h */; };
    10291028                57B4B46020B504AC00D4AD79 /* ClientCertificateAuthenticationXPCConstants.h in Headers */ = {isa = PBXBuildFile; fileRef = 57B4B45E20B504AB00D4AD79 /* ClientCertificateAuthenticationXPCConstants.h */; };
     
    33763375                5772F205217DBD6A0056BF2C /* HidService.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = HidService.mm; sourceTree = "<group>"; };
    33773376                578DC2972155A0010074E815 /* LocalAuthenticationSoftLink.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LocalAuthenticationSoftLink.h; sourceTree = "<group>"; };
    3378                 57900B3E21F8F9B8008317DE /* LoadOptimizer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LoadOptimizer.h; sourceTree = "<group>"; };
    3379                 57900B3F21F8F9B8008317DE /* LoadOptimizer.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = LoadOptimizer.mm; sourceTree = "<group>"; };
    33803377                57AC8F4E217FEED90055438C /* HidConnection.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = HidConnection.h; sourceTree = "<group>"; };
    33813378                57AC8F4F217FEED90055438C /* HidConnection.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = HidConnection.mm; sourceTree = "<group>"; };
     
    53185315                                7A821F4B1E2F664800604577 /* LegacyCustomProtocolManagerClient.h */,
    53195316                                7A821F4D1E2F679E00604577 /* LegacyCustomProtocolManagerClient.mm */,
    5320                                 57900B3E21F8F9B8008317DE /* LoadOptimizer.h */,
    5321                                 57900B3F21F8F9B8008317DE /* LoadOptimizer.mm */,
    53225317                                411286EF21C8A90C003A8550 /* MediaCaptureUtilities.h */,
    53235318                                411286F021C8A90D003A8550 /* MediaCaptureUtilities.mm */,
     
    91239118                                41DC459C1E3DBB2800B11F51 /* LibWebRTCSocketClient.h in Headers */,
    91249119                                413075B21DE85F580039EC69 /* LibWebRTCSocketFactory.h in Headers */,
    9125                                 57900B4021F8F9B8008317DE /* LoadOptimizer.h in Headers */,
    91269120                                2D1087611D2C573E00B85F82 /* LoadParameters.h in Headers */,
    91279121                                578DC2982155A0020074E815 /* LocalAuthenticationSoftLink.h in Headers */,
  • trunk/Tools/ChangeLog

    r240781 r240805  
     12019-01-31  Jiewen Tan  <jiewen_tan@apple.com>
     2
     3        Formalize WebKitAdditions mechanism of LoadOptimizer
     4        https://bugs.webkit.org/show_bug.cgi?id=193886
     5        <rdar://problem/47696809>
     6
     7        Reviewed by Brent Fulgham.
     8
     9        * MiniBrowser/MiniBrowser.entitlements:
     10        Make com.apple.security.temporary-exception.mach-lookup.global-name an array.
     11
    1122019-01-31  Zalan Bujtas  <zalan@apple.com>
    213
  • trunk/Tools/MiniBrowser/MiniBrowser.entitlements

    r238166 r240805  
    66        <true/>
    77        <key>com.apple.security.temporary-exception.mach-lookup.global-name</key>
    8         <string>com.apple.Safari.SafeBrowsing.Service</string>
     8        <array>
     9                <string>com.apple.Safari.SafeBrowsing.Service</string>
     10        </array>
    911        <key>com.apple.security.app-sandbox</key>
    1012        <true/>
Note: See TracChangeset for help on using the changeset viewer.