Changeset 250377 in webkit
- Timestamp:
- Sep 25, 2019, 9:24:23 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r250373 r250377 1 2019-09-25 Alex Christensen <achristensen@webkit.org> 2 3 Add replacement SPI on _WKWebsiteDataStoreConfiguration for enabling speculative cache validation and IPC-free server trust evaluation 4 https://bugs.webkit.org/show_bug.cgi?id=202251 5 6 Reviewed by Tim Horton. 7 8 These are two performance optimizations that are currently per-ProcessPool that need to be per-WebsiteDataStore. 9 This makes replacement SPI and deprecates the old SPI. I'm going to adopt the new SPI then remove the old SPI. 10 11 * NetworkProcess/NetworkSession.cpp: 12 (WebKit::NetworkSession::NetworkSession): 13 * NetworkProcess/NetworkSessionCreationParameters.cpp: 14 (WebKit::NetworkSessionCreationParameters::encode const): 15 (WebKit::NetworkSessionCreationParameters::decode): 16 * NetworkProcess/NetworkSessionCreationParameters.h: 17 * NetworkProcess/cocoa/NetworkSessionCocoa.h: 18 * NetworkProcess/cocoa/NetworkSessionCocoa.mm: 19 (-[WKNetworkSessionDelegate URLSession:task:didReceiveChallenge:completionHandler:]): 20 (WebKit::NetworkSessionCocoa::NetworkSessionCocoa): 21 * UIProcess/API/C/WKContextPrivate.h: 22 * UIProcess/API/Cocoa/WKProcessPoolPrivate.h: 23 * UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h: 24 * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h: 25 * UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm: 26 (-[_WKWebsiteDataStoreConfiguration networkCacheSpeculativeValidationEnabled]): 27 (-[_WKWebsiteDataStoreConfiguration setNetworkCacheSpeculativeValidationEnabled:]): 28 (-[_WKWebsiteDataStoreConfiguration fastServerTrustEvaluationEnabled]): 29 (-[_WKWebsiteDataStoreConfiguration setFastServerTrustEvaluationEnabled:]): 30 * UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm: 31 (WebKit::WebsiteDataStore::parameters): 32 * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp: 33 (WebKit::WebsiteDataStoreConfiguration::copy): 34 * UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h: 35 (WebKit::WebsiteDataStoreConfiguration::fastServerTrustEvaluationEnabled const): 36 (WebKit::WebsiteDataStoreConfiguration::setFastServerTrustEvaluationEnabled): 37 (WebKit::WebsiteDataStoreConfiguration::networkCacheSpeculativeValidationEnabled const): 38 (WebKit::WebsiteDataStoreConfiguration::setNetworkCacheSpeculativeValidationEnabled): 39 1 40 2019-09-25 Wenson Hsieh <wenson_hsieh@apple.com> 2 41 -
trunk/Source/WebKit/NetworkProcess/NetworkSession.cpp
r250344 r250377 91 91 SandboxExtension::consumePermanently(parameters.networkCacheDirectoryExtensionHandle); 92 92 93 m_cache = NetworkCache::Cache::open(networkProcess, networkCacheDirectory, networkProcess.cacheOptions(), m_sessionID); 93 auto cacheOptions = networkProcess.cacheOptions(); 94 #if ENABLE(NETWORK_CACHE_SPECULATIVE_REVALIDATION) 95 if (parameters.networkCacheSpeculativeValidationEnabled) 96 cacheOptions.add(NetworkCache::CacheOption::SpeculativeRevalidation); 97 #endif 98 99 m_cache = NetworkCache::Cache::open(networkProcess, networkCacheDirectory, cacheOptions, m_sessionID); 94 100 if (!m_cache) 95 101 RELEASE_LOG_ERROR(NetworkCache, "Failed to initialize the WebKit network disk cache"); -
trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.cpp
r250351 r250377 76 76 encoder << allLoadsBlockedByDeviceManagementRestrictionsForTesting; 77 77 encoder << dataConnectionServiceType; 78 encoder << fastServerTrustEvaluationEnabled; 79 encoder << networkCacheSpeculativeValidationEnabled; 78 80 } 79 81 … … 223 225 decoder >> dataConnectionServiceType; 224 226 if (!dataConnectionServiceType) 227 return WTF::nullopt; 228 229 Optional<bool> fastServerTrustEvaluationEnabled; 230 decoder >> fastServerTrustEvaluationEnabled; 231 if (!fastServerTrustEvaluationEnabled) 232 return WTF::nullopt; 233 234 Optional<bool> networkCacheSpeculativeValidationEnabled; 235 decoder >> networkCacheSpeculativeValidationEnabled; 236 if (!networkCacheSpeculativeValidationEnabled) 225 237 return WTF::nullopt; 226 238 … … 259 271 , WTFMove(*networkCacheDirectory) 260 272 , WTFMove(*networkCacheDirectoryExtensionHandle) 261 , WTFMove(*dataConnectionServiceType), 273 , WTFMove(*dataConnectionServiceType) 274 , WTFMove(*fastServerTrustEvaluationEnabled) 275 , WTFMove(*networkCacheSpeculativeValidationEnabled) 262 276 }}; 263 277 } -
trunk/Source/WebKit/NetworkProcess/NetworkSessionCreationParameters.h
r250351 r250377 94 94 SandboxExtension::Handle networkCacheDirectoryExtensionHandle; 95 95 String dataConnectionServiceType; 96 bool fastServerTrustEvaluationEnabled { false }; 97 bool networkCacheSpeculativeValidationEnabled { false }; 96 98 }; 97 99 -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.h
r249619 r250377 80 80 void continueDidReceiveChallenge(const WebCore::AuthenticationChallenge&, NetworkDataTaskCocoa::TaskIdentifier, NetworkDataTaskCocoa*, CompletionHandler<void(WebKit::AuthenticationChallengeDisposition, const WebCore::Credential&)>&&); 81 81 82 bool fastServerTrustEvaluationEnabled() const { return m_fastServerTrustEvaluationEnabled; } 82 83 bool deviceManagementRestrictionsEnabled() const { return m_deviceManagementRestrictionsEnabled; } 83 84 bool allLoadsBlockedByDeviceManagementRestrictionsForTesting() const { return m_allLoadsBlockedByDeviceManagementRestrictionsForTesting; } … … 137 138 bool m_shouldLogCookieInformation { false }; 138 139 Seconds m_loadThrottleLatency; 140 bool m_fastServerTrustEvaluationEnabled { false }; 139 141 }; 140 142 -
trunk/Source/WebKit/NetworkProcess/cocoa/NetworkSessionCocoa.mm
r250349 r250377 579 579 580 580 // Handle server trust evaluation at platform-level if requested, for performance reasons and to use ATS defaults. 581 if (!_session->networkProcess().canHandleHTTPSServerTrustEvaluation() ) {581 if (!_session->networkProcess().canHandleHTTPSServerTrustEvaluation() || _session->fastServerTrustEvaluationEnabled()) { 582 582 #if HAVE(CFNETWORK_NSURLSESSION_STRICTRUSTEVALUATE) 583 583 if (canNSURLSessionTrustEvaluate()) { … … 923 923 , m_shouldLogCookieInformation(parameters.shouldLogCookieInformation) 924 924 , m_loadThrottleLatency(parameters.loadThrottleLatency) 925 , m_fastServerTrustEvaluationEnabled(parameters.fastServerTrustEvaluationEnabled) 925 926 { 926 927 ASSERT(hasProcessPrivilege(ProcessPrivilege::CanAccessRawCookies)); -
trunk/Source/WebKit/UIProcess/API/C/WKContextPrivate.h
r249671 r250377 68 68 WK_EXPORT void WKContextSetDomainRelaxationForbiddenForURLScheme(WKContextRef context, WKStringRef urlScheme); 69 69 70 WK_EXPORT void WKContextSetCanHandleHTTPSServerTrustEvaluation(WKContextRef context, bool value) ;70 WK_EXPORT void WKContextSetCanHandleHTTPSServerTrustEvaluation(WKContextRef context, bool value) WK_C_API_DEPRECATED; 71 71 72 72 WK_EXPORT void WKContextSetPrewarmsProcessesAutomatically(WKContextRef context, bool value); 73 73 74 WK_EXPORT void WKContextSetDiskCacheSpeculativeValidationEnabled(WKContextRef context, bool value) ;74 WK_EXPORT void WKContextSetDiskCacheSpeculativeValidationEnabled(WKContextRef context, bool value) WK_C_API_DEPRECATED; 75 75 76 76 WK_EXPORT void WKContextSetIconDatabasePath(WKContextRef context, WKStringRef iconDatabasePath); -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKProcessPoolPrivate.h
r250292 r250377 49 49 50 50 - (void)_setAllowsSpecificHTTPSCertificate:(NSArray *)certificateChain forHost:(NSString *)host; 51 - (void)_setCanHandleHTTPSServerTrustEvaluation:(BOOL)value WK_API_ AVAILABLE(macos(10.11), ios(9.0));51 - (void)_setCanHandleHTTPSServerTrustEvaluation:(BOOL)value WK_API_DEPRECATED_WITH_REPLACEMENT("_WKWebsiteDataStoreConfiguration.fastServerTrustEvaluationEnabled", macos(10.11, WK_MAC_TBA), ios(9.0, WK_IOS_TBA)); 52 52 - (void)_setCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy; 53 53 -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKProcessPoolConfiguration.h
r250349 r250377 53 53 @property (nonatomic, copy) NSArray *cachePartitionedURLSchemes; 54 54 @property (nonatomic, copy) NSArray<NSString *> *alwaysRevalidatedURLSchemes WK_API_AVAILABLE(macos(10.12), ios(10.0)); 55 @property (nonatomic) BOOL diskCacheSpeculativeValidationEnabled WK_API_ AVAILABLE(macos(10.12), ios(10.0));55 @property (nonatomic) BOOL diskCacheSpeculativeValidationEnabled WK_API_DEPRECATED_WITH_REPLACEMENT("_WKWebsiteDataStoreConfiguration.networkCacheSpeculativeValidationEnabled", macos(10.12, WK_MAC_TBA), ios(10.0, WK_IOS_TBA)); 56 56 @property (nonatomic, nullable, copy) NSString *sourceApplicationBundleIdentifier WK_API_DEPRECATED_WITH_REPLACEMENT("_WKWebsiteDataStoreConfiguration.sourceApplicationBundleIdentifier", macos(10.12.3, 10.14.4), ios(10.3, 12.2)); 57 57 @property (nonatomic, nullable, copy) NSString *sourceApplicationSecondaryIdentifier WK_API_DEPRECATED_WITH_REPLACEMENT("_WKWebsiteDataStoreConfiguration.sourceApplicationSecondaryIdentifier", macos(10.12.3, 10.14.4), ios(10.3, 12.2)); -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.h
r250349 r250377 44 44 @property (nonatomic, nullable, copy, setter=setHTTPSProxy:) NSURL *httpsProxy WK_API_AVAILABLE(macos(10.14.4), ios(12.2)); 45 45 @property (nonatomic) BOOL deviceManagementRestrictionsEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 46 @property (nonatomic) BOOL networkCacheSpeculativeValidationEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 47 @property (nonatomic) BOOL fastServerTrustEvaluationEnabled WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 46 48 @property (nonatomic) NSUInteger perOriginStorageQuota WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); 47 49 @property (nonatomic, nullable, copy) NSString *boundInterfaceIdentifier WK_API_AVAILABLE(macos(WK_MAC_TBA), ios(WK_IOS_TBA)); -
trunk/Source/WebKit/UIProcess/API/Cocoa/_WKWebsiteDataStoreConfiguration.mm
r250352 r250377 291 291 } 292 292 293 - (BOOL)networkCacheSpeculativeValidationEnabled 294 { 295 return _configuration->networkCacheSpeculativeValidationEnabled(); 296 } 297 298 - (void)setNetworkCacheSpeculativeValidationEnabled:(BOOL)enabled 299 { 300 _configuration->setNetworkCacheSpeculativeValidationEnabled(enabled); 301 } 302 303 - (BOOL)fastServerTrustEvaluationEnabled 304 { 305 return _configuration->fastServerTrustEvaluationEnabled(); 306 } 307 308 - (void)setFastServerTrustEvaluationEnabled:(BOOL)enabled 309 { 310 return _configuration->setFastServerTrustEvaluationEnabled(enabled); 311 } 312 293 313 - (NSUInteger)perOriginStorageQuota 294 314 { -
trunk/Source/WebKit/UIProcess/WebsiteData/Cocoa/WebsiteDataStoreCocoa.mm
r250349 r250377 144 144 WTFMove(networkCacheDirectoryExtensionHandle), 145 145 m_configuration->dataConnectionServiceType(), 146 m_configuration->fastServerTrustEvaluationEnabled(), 147 m_configuration->networkCacheSpeculativeValidationEnabled(), 146 148 }; 147 149 networkingHasBegun(); -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.cpp
r250352 r250377 54 54 auto copy = WebsiteDataStoreConfiguration::create(m_isPersistent); 55 55 56 copy->m_fastServerTrustEvaluationEnabled = this->m_fastServerTrustEvaluationEnabled; 57 copy->m_networkCacheSpeculativeValidationEnabled = this->m_networkCacheSpeculativeValidationEnabled; 56 58 copy->m_cacheStorageDirectory = this->m_cacheStorageDirectory; 57 59 copy->m_perOriginStorageQuota = this->m_perOriginStorageQuota; -
trunk/Source/WebKit/UIProcess/WebsiteData/WebsiteDataStoreConfiguration.h
r250352 r250377 77 77 void setAllowsCellularAccess(bool allows) { m_allowsCellularAccess = allows; } 78 78 79 bool fastServerTrustEvaluationEnabled() const { return m_fastServerTrustEvaluationEnabled; } 80 void setFastServerTrustEvaluationEnabled(bool enabled) { m_fastServerTrustEvaluationEnabled = enabled; } 81 82 bool networkCacheSpeculativeValidationEnabled() const { return m_networkCacheSpeculativeValidationEnabled; } 83 void setNetworkCacheSpeculativeValidationEnabled(bool enabled) { m_networkCacheSpeculativeValidationEnabled = enabled; } 84 79 85 #if PLATFORM(COCOA) 80 86 CFDictionaryRef proxyConfiguration() const { return m_proxyConfiguration.get(); } … … 154 160 bool m_allLoadsBlockedByDeviceManagementRestrictionsForTesting { false }; 155 161 bool m_allowsCellularAccess { true }; 162 bool m_fastServerTrustEvaluationEnabled { false }; 163 bool m_networkCacheSpeculativeValidationEnabled { false }; 156 164 #if PLATFORM(COCOA) 157 165 RetainPtr<CFDictionaryRef> m_proxyConfiguration; -
trunk/Tools/ChangeLog
r250375 r250377 1 2019-09-25 Alex Christensen <achristensen@webkit.org> 2 3 Add replacement SPI on _WKWebsiteDataStoreConfiguration for enabling speculative cache validation and IPC-free server trust evaluation 4 https://bugs.webkit.org/show_bug.cgi?id=202251 5 6 Reviewed by Tim Horton. 7 8 Adopt new SPI instead of deprecated SPI. 9 10 * MiniBrowser/mac/AppDelegate.m: 11 (persistentDataStore): 12 (defaultConfiguration): 13 (-[BrowserAppDelegate fetchDefaultStoreWebsiteData:]): 14 (-[BrowserAppDelegate fetchAndClearDefaultStoreWebsiteData:]): 15 (-[BrowserAppDelegate clearDefaultStoreWebsiteData:]): 16 1 17 2019-09-25 Jonathan Bedard <jbedard@apple.com> 2 18 -
trunk/Tools/MiniBrowser/mac/AppDelegate.m
r242339 r250377 40 40 #import <WebKit/_WKProcessPoolConfiguration.h> 41 41 #import <WebKit/_WKUserContentExtensionStore.h> 42 #import <WebKit/_WKWebsiteDataStoreConfiguration.h> 42 43 43 44 enum { … … 79 80 } 80 81 82 static WKWebsiteDataStore *persistentDataStore() 83 { 84 static WKWebsiteDataStore *dataStore; 85 86 if (!dataStore) { 87 _WKWebsiteDataStoreConfiguration *configuration = [[[_WKWebsiteDataStoreConfiguration alloc] init] autorelease]; 88 configuration.networkCacheSpeculativeValidationEnabled = YES; 89 dataStore = [[WKWebsiteDataStore alloc] _initWithConfiguration:configuration]; 90 } 91 92 return dataStore; 93 } 94 81 95 static WKWebViewConfiguration *defaultConfiguration() 82 96 { … … 85 99 if (!configuration) { 86 100 configuration = [[WKWebViewConfiguration alloc] init]; 101 configuration.websiteDataStore = persistentDataStore(); 87 102 configuration.preferences._fullScreenEnabled = YES; 88 103 configuration.preferences._developerExtrasEnabled = YES; … … 91 106 92 107 _WKProcessPoolConfiguration *processConfiguration = [[[_WKProcessPoolConfiguration alloc] init] autorelease]; 93 processConfiguration.diskCacheSpeculativeValidationEnabled = ![SettingsController shared].networkCacheSpeculativeRevalidationDisabled;94 108 if ([SettingsController shared].perWindowWebProcessesDisabled) 95 109 processConfiguration.usesSingleWebProcess = YES; … … 309 323 - (IBAction)fetchDefaultStoreWebsiteData:(id)sender 310 324 { 311 [ [WKWebsiteDataStore defaultDataStore]fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] completionHandler:^(NSArray *websiteDataRecords) {325 [persistentDataStore() fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] completionHandler:^(NSArray *websiteDataRecords) { 312 326 NSLog(@"did fetch default store website data %@.", websiteDataRecords); 313 327 }]; … … 316 330 - (IBAction)fetchAndClearDefaultStoreWebsiteData:(id)sender 317 331 { 318 [ [WKWebsiteDataStore defaultDataStore]fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] completionHandler:^(NSArray *websiteDataRecords) {319 [ [WKWebsiteDataStore defaultDataStore]removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] forDataRecords:websiteDataRecords completionHandler:^{320 [ [WKWebsiteDataStore defaultDataStore]fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] completionHandler:^(NSArray *websiteDataRecords) {332 [persistentDataStore() fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] completionHandler:^(NSArray *websiteDataRecords) { 333 [persistentDataStore() removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] forDataRecords:websiteDataRecords completionHandler:^{ 334 [persistentDataStore() fetchDataRecordsOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] completionHandler:^(NSArray *websiteDataRecords) { 321 335 NSLog(@"did clear default store website data, after clearing data is %@.", websiteDataRecords); 322 336 }]; … … 327 341 - (IBAction)clearDefaultStoreWebsiteData:(id)sender 328 342 { 329 [ [WKWebsiteDataStore defaultDataStore]removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^{343 [persistentDataStore() removeDataOfTypes:[WKWebsiteDataStore allWebsiteDataTypes] modifiedSince:[NSDate distantPast] completionHandler:^{ 330 344 NSLog(@"Did clear default store website data."); 331 345 }];
Note:
See TracChangeset
for help on using the changeset viewer.