Changeset 235260 in webkit
- Timestamp:
- Aug 23, 2018 4:37:45 PM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r235259 r235260 1 2018-08-23 Sihui Liu <sihui_liu@apple.com> 2 3 Move legacy directory configuration from WebProcessPool to API::WebsiteDataStore 4 https://bugs.webkit.org/show_bug.cgi?id=188765 5 <rdar://problem/43633183> 6 7 Reviewed by Geoffrey Garen. 8 9 Diretories are parameters of websiteDataStore instead of webProcessPool, so we should move 10 legacy default paths to API::WebsiteDataStore, which already stores default paths for 11 non-legacy cases. 12 13 * UIProcess/API/APIProcessPoolConfiguration.cpp: 14 (API::ProcessPoolConfiguration::createWithLegacyOptions): 15 (API::ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration): 16 * UIProcess/API/APIWebsiteDataStore.cpp: 17 (API::WebsiteDataStore::legacyDefaultDataStoreConfiguration): 18 * UIProcess/API/APIWebsiteDataStore.h: 19 * UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm: 20 (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory): 21 (API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory): 22 (API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory): 23 (API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory): 24 (API::WebsiteDataStore::legacyDefaultLocalStorageDirectory): 25 (API::WebsiteDataStore::legacyDefaultMediaCacheDirectory): 26 (API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory): 27 (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory): 28 * UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp: 29 (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory): 30 (API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory): 31 (API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory): 32 (API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory): 33 (API::WebsiteDataStore::legacyDefaultLocalStorageDirectory): 34 (API::WebsiteDataStore::legacyDefaultMediaCacheDirectory): 35 (API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory): 36 (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory): 37 * UIProcess/API/win/APIWebsiteDataStoreWin.cpp: 38 (API::WebsiteDataStore::legacyDefaultApplicationCacheDirectory): 39 (API::WebsiteDataStore::legacyDefaultNetworkCacheDirectory): 40 (API::WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory): 41 (API::WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory): 42 (API::WebsiteDataStore::legacyDefaultLocalStorageDirectory): 43 (API::WebsiteDataStore::legacyDefaultMediaCacheDirectory): 44 (API::WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory): 45 (API::WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory): 46 * UIProcess/Cocoa/WebProcessPoolCocoa.mm: 47 (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted. 48 (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted. 49 (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted. 50 (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted. 51 (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted. 52 (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted. 53 (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted. 54 (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted. 55 * UIProcess/WebProcessPool.h: 56 * UIProcess/gtk/WebProcessPoolGtk.cpp: 57 (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted. 58 (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted. 59 (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted. 60 (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted. 61 (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted. 62 (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted. 63 (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted. 64 (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted. 65 * UIProcess/win/WebProcessPoolWin.cpp: 66 (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted. 67 (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted. 68 (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted. 69 (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted. 70 (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted. 71 (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted. 72 (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted. 73 (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted. 74 * UIProcess/wpe/WebProcessPoolWPE.cpp: 75 (WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory): Deleted. 76 (WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory): Deleted. 77 (WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory): Deleted. 78 (WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory): Deleted. 79 (WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory): Deleted. 80 (WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory): Deleted. 81 (WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory): Deleted. 82 (WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory): Deleted. 83 1 84 2018-08-23 Alex Christensen <achristensen@webkit.org> 2 85 -
trunk/Source/WebKit/UIProcess/API/APIProcessPoolConfiguration.cpp
r235224 r235260 39 39 Ref<ProcessPoolConfiguration> ProcessPoolConfiguration::createWithLegacyOptions() 40 40 { 41 auto configuration = ProcessPoolConfiguration::create ();41 auto configuration = ProcessPoolConfiguration::createWithWebsiteDataStoreConfiguration(WebsiteDataStore::legacyDefaultDataStoreConfiguration()); 42 42 43 43 configuration->m_shouldHaveLegacyDataStore = true; 44 44 configuration->m_maximumProcessCount = 1; 45 45 configuration->m_cacheModel = WebKit::CacheModelDocumentViewer; 46 47 configuration->m_applicationCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory();48 configuration->m_applicationCacheFlatFileSubdirectoryName = "ApplicationCache";49 configuration->m_diskCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory();50 configuration->m_mediaCacheDirectory = WebKit::WebProcessPool::legacyPlatformDefaultMediaCacheDirectory();51 configuration->m_indexedDBDatabaseDirectory = WebKit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory();52 configuration->m_localStorageDirectory = WebKit::WebProcessPool::legacyPlatformDefaultLocalStorageDirectory();53 configuration->m_mediaKeysStorageDirectory = WebKit::WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory();54 configuration->m_webSQLDatabaseDirectory = WebKit::WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory();55 configuration->m_javaScriptConfigurationDirectory = WebKit::WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory();56 46 57 47 return configuration; … … 66 56 configuration->m_diskCacheDirectory = legacyConfiguration.networkCacheDirectory; 67 57 configuration->m_mediaCacheDirectory = legacyConfiguration.mediaCacheDirectory; 68 configuration->m_indexedDBDatabaseDirectory = Web Kit::WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory();58 configuration->m_indexedDBDatabaseDirectory = WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory(); 69 59 configuration->m_localStorageDirectory = legacyConfiguration.localStorageDirectory; 70 60 configuration->m_mediaKeysStorageDirectory = legacyConfiguration.mediaKeysStorageDirectory; 71 61 configuration->m_resourceLoadStatisticsDirectory = legacyConfiguration.resourceLoadStatisticsDirectory; 72 62 configuration->m_webSQLDatabaseDirectory = legacyConfiguration.webSQLDatabaseDirectory; 63 configuration->m_javaScriptConfigurationDirectory = legacyConfiguration.javaScriptConfigurationDirectory; 73 64 74 65 return configuration; -
trunk/Source/WebKit/UIProcess/API/APIWebsiteDataStore.cpp
r235224 r235260 120 120 #endif 121 121 122 WebKit::WebsiteDataStore::Configuration WebsiteDataStore::legacyDefaultDataStoreConfiguration() 123 { 124 WebKit::WebsiteDataStore::Configuration configuration = defaultDataStoreConfiguration(); 125 126 configuration.applicationCacheDirectory = legacyDefaultApplicationCacheDirectory(); 127 configuration.applicationCacheFlatFileSubdirectoryName = "ApplicationCache"; 128 configuration.networkCacheDirectory = legacyDefaultNetworkCacheDirectory(); 129 configuration.mediaCacheDirectory = legacyDefaultMediaCacheDirectory(); 130 configuration.mediaKeysStorageDirectory = legacyDefaultMediaKeysStorageDirectory(); 131 configuration.indexedDBDatabaseDirectory = legacyDefaultIndexedDBDatabaseDirectory(); 132 configuration.webSQLDatabaseDirectory = legacyDefaultWebSQLDatabaseDirectory(); 133 configuration.localStorageDirectory = legacyDefaultLocalStorageDirectory(); 134 configuration.javaScriptConfigurationDirectory = legacyDefaultJavaScriptConfigurationDirectory(); 135 136 return configuration; 122 137 } 138 139 } // namespace API -
trunk/Source/WebKit/UIProcess/API/APIWebsiteDataStore.h
r235224 r235260 58 58 static String defaultNetworkCacheDirectory(); 59 59 static String defaultMediaCacheDirectory(); 60 61 60 static String defaultIndexedDBDatabaseDirectory(); 62 61 static String defaultServiceWorkerRegistrationDirectory(); … … 65 64 static String defaultWebSQLDatabaseDirectory(); 66 65 static String defaultResourceLoadStatisticsDirectory(); 67 68 66 static String defaultJavaScriptConfigurationDirectory(); 69 67 70 68 static WebKit::WebsiteDataStore::Configuration defaultDataStoreConfiguration(); 69 70 static String legacyDefaultApplicationCacheDirectory(); 71 static String legacyDefaultNetworkCacheDirectory(); 72 static String legacyDefaultLocalStorageDirectory(); 73 static String legacyDefaultIndexedDBDatabaseDirectory(); 74 static String legacyDefaultWebSQLDatabaseDirectory(); 75 static String legacyDefaultMediaKeysStorageDirectory(); 76 static String legacyDefaultMediaCacheDirectory(); 77 static String legacyDefaultJavaScriptConfigurationDirectory(); 78 79 static WebKit::WebsiteDataStore::Configuration legacyDefaultDataStoreConfiguration(); 71 80 72 81 private: -
trunk/Source/WebKit/UIProcess/API/Cocoa/APIWebsiteDataStoreCocoa.mm
r235224 r235260 30 30 #include "SandboxUtilities.h" 31 31 32 #include <Foundation/Foundation.h> 33 #include <WebCore/FileSystem.h> 34 32 35 #if PLATFORM(IOS) 33 36 #import <WebCore/RuntimeApplicationChecks.h> … … 35 38 36 39 namespace API { 40 41 NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory"; 42 NSString *WebStorageDirectoryDefaultsKey = @"WebKitLocalStorageDatabasePathPreferenceKey"; 43 NSString *WebKitMediaCacheDirectoryDefaultsKey = @"WebKitMediaCacheDirectory"; 44 NSString *WebKitMediaKeysStorageDirectoryDefaultsKey = @"WebKitMediaKeysStorageDirectory"; 37 45 38 46 String WebsiteDataStore::defaultApplicationCacheDirectory() … … 101 109 { 102 110 return tempDirectoryFileSystemRepresentation("JavaScriptCoreDebug", DontCreateDirectory); 111 } 112 113 String WebsiteDataStore::legacyDefaultApplicationCacheDirectory() 114 { 115 NSString *appName = [[NSBundle mainBundle] bundleIdentifier]; 116 if (!appName) 117 appName = [[NSProcessInfo processInfo] processName]; 118 #if PLATFORM(IOS) 119 // This quirk used to make these apps share application cache storage, but doesn't accomplish that any more. 120 // Preserving it avoids the need to migrate data when upgrading. 121 if (WebCore::IOSApplication::isMobileSafari() || WebCore::IOSApplication::isWebApp()) 122 appName = @"com.apple.WebAppCache"; 123 #endif 124 125 ASSERT(appName); 126 127 #if PLATFORM(IOS) 128 NSString *cacheDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"]; 129 #else 130 char cacheDirectory[MAXPATHLEN]; 131 size_t cacheDirectoryLen = confstr(_CS_DARWIN_USER_CACHE_DIR, cacheDirectory, MAXPATHLEN); 132 if (!cacheDirectoryLen) 133 return String(); 134 135 NSString *cacheDir = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:cacheDirectory length:cacheDirectoryLen - 1]; 136 #endif 137 NSString* cachePath = [cacheDir stringByAppendingPathComponent:appName]; 138 return WebKit::stringByResolvingSymlinksInPath([cachePath stringByStandardizingPath]); 139 } 140 141 String WebsiteDataStore::legacyDefaultNetworkCacheDirectory() 142 { 143 NSString *cachePath = CFBridgingRelease(_CFURLCacheCopyCacheDirectory([[NSURLCache sharedURLCache] _CFURLCache])); 144 if (!cachePath) 145 cachePath = @"~/Library/Caches/com.apple.WebKit.WebProcess"; 146 147 cachePath = [cachePath stringByAppendingPathComponent:@"WebKitCache"]; 148 149 return WebKit::stringByResolvingSymlinksInPath([cachePath stringByStandardizingPath]); 150 } 151 152 String WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory() 153 { 154 NSString *databasesDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebDatabaseDirectoryDefaultsKey]; 155 if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]]) 156 databasesDirectory = @"~/Library/WebKit/Databases"; 157 return WebKit::stringByResolvingSymlinksInPath([databasesDirectory stringByStandardizingPath]); 158 } 159 160 String WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory() 161 { 162 // Indexed databases exist in a subdirectory of the "database directory path." 163 // Currently, the top level of that directory contains entities related to WebSQL databases. 164 // We should fix this, and move WebSQL into a subdirectory (https://bugs.webkit.org/show_bug.cgi?id=124807) 165 // In the meantime, an entity name prefixed with three underscores will not conflict with any WebSQL entities. 166 return WebCore::FileSystem::pathByAppendingComponent(legacyDefaultWebSQLDatabaseDirectory(), "___IndexedDB"); 167 } 168 169 String WebsiteDataStore::legacyDefaultLocalStorageDirectory() 170 { 171 NSString *localStorageDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebStorageDirectoryDefaultsKey]; 172 if (!localStorageDirectory || ![localStorageDirectory isKindOfClass:[NSString class]]) 173 localStorageDirectory = @"~/Library/WebKit/LocalStorage"; 174 return WebKit::stringByResolvingSymlinksInPath([localStorageDirectory stringByStandardizingPath]); 175 } 176 177 String WebsiteDataStore::legacyDefaultMediaCacheDirectory() 178 { 179 NSString *mediaKeysCacheDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebKitMediaCacheDirectoryDefaultsKey]; 180 if (!mediaKeysCacheDirectory || ![mediaKeysCacheDirectory isKindOfClass:[NSString class]]) { 181 mediaKeysCacheDirectory = NSTemporaryDirectory(); 182 183 if (!WebKit::processHasContainer()) { 184 NSString *bundleIdentifier = [NSBundle mainBundle].bundleIdentifier; 185 if (!bundleIdentifier) 186 bundleIdentifier = [NSProcessInfo processInfo].processName; 187 mediaKeysCacheDirectory = [mediaKeysCacheDirectory stringByAppendingPathComponent:bundleIdentifier]; 188 } 189 mediaKeysCacheDirectory = [mediaKeysCacheDirectory stringByAppendingPathComponent:@"WebKit/MediaCache"]; 190 } 191 return WebKit::stringByResolvingSymlinksInPath([mediaKeysCacheDirectory stringByStandardizingPath]); 192 } 193 194 String WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory() 195 { 196 NSString *mediaKeysStorageDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebKitMediaKeysStorageDirectoryDefaultsKey]; 197 if (!mediaKeysStorageDirectory || ![mediaKeysStorageDirectory isKindOfClass:[NSString class]]) 198 mediaKeysStorageDirectory = @"~/Library/WebKit/MediaKeys"; 199 return WebKit::stringByResolvingSymlinksInPath([mediaKeysStorageDirectory stringByStandardizingPath]); 200 } 201 202 String WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory() 203 { 204 #if PLATFORM(IOS) 205 String path = WebKit::pathForProcessContainer(); 206 if (path.isEmpty()) 207 path = NSHomeDirectory(); 208 209 path = path + "/Library/WebKit/JavaScriptCoreDebug"; 210 path = WebKit::stringByResolvingSymlinksInPath(path); 211 212 return path; 213 #else 214 RetainPtr<NSString> javaScriptConfigPath = @"~/Library/WebKit/JavaScriptCoreDebug"; 215 216 return WebKit::stringByResolvingSymlinksInPath([javaScriptConfigPath stringByStandardizingPath]); 217 #endif 103 218 } 104 219 … … 210 325 } 211 326 212 } 327 } // namespace API -
trunk/Source/WebKit/UIProcess/API/glib/APIWebsiteDataStoreGLib.cpp
r235224 r235260 94 94 } 95 95 96 String WebsiteDataStore::legacyDefaultApplicationCacheDirectory() 97 { 98 #if PLATFORM(WPE) 99 GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "appcache", nullptr)); 100 return WebCore::FileSystem::stringFromFileSystemRepresentation(cacheDirectory.get()); 101 #endif 102 return defaultApplicationCacheDirectory(); 103 } 104 105 String WebsiteDataStore::legacyDefaultNetworkCacheDirectory() 106 { 107 #if PLATFORM(WPE) 108 GUniquePtr<char> diskCacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "cache", nullptr)); 109 return WebCore::FileSystem::stringFromFileSystemRepresentation(diskCacheDirectory.get()); 110 #endif 111 return defaultNetworkCacheDirectory(); 112 } 113 114 String WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory() 115 { 116 #if PLATFORM(WPE) 117 GUniquePtr<gchar> databaseDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "databases", nullptr)); 118 return WebCore::FileSystem::stringFromFileSystemRepresentation(databaseDirectory.get()); 119 #endif 120 return defaultWebSQLDatabaseDirectory(); 121 } 122 123 String WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory() 124 { 125 #if PLATFORM(WPE) 126 GUniquePtr<gchar> indexedDBDatabaseDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "databases", "indexeddb", nullptr)); 127 return WebCore::FileSystem::stringFromFileSystemRepresentation(indexedDBDatabaseDirectory.get()); 128 #endif 129 return defaultIndexedDBDatabaseDirectory(); 130 } 131 132 String WebsiteDataStore::legacyDefaultLocalStorageDirectory() 133 { 134 #if PLATFORM(WPE) 135 GUniquePtr<gchar> storageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "localstorage", nullptr)); 136 return WebCore::FileSystem::stringFromFileSystemRepresentation(storageDirectory.get()); 137 #endif 138 return defaultLocalStorageDirectory(); 139 } 140 141 String WebsiteDataStore::legacyDefaultMediaCacheDirectory() 142 { 143 #if PLATFORM(WPE) 144 GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "mediacache", nullptr)); 145 return WebCore::FileSystem::stringFromFileSystemRepresentation(cacheDirectory.get()); 146 #endif 147 return defaultMediaCacheDirectory(); 148 } 149 150 String WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory() 151 { 152 #if PLATFORM(WPE) 153 GUniquePtr<gchar> mediaKeysStorageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "mediakeys", nullptr)); 154 return WebCore::FileSystem::stringFromFileSystemRepresentation(mediaKeysStorageDirectory.get()); 155 #endif 156 return defaultMediaKeysStorageDirectory(); 157 } 158 159 String WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory() 160 { 161 GUniquePtr<gchar> javaScriptCoreConfigDirectory(g_build_filename(g_get_user_data_dir(), BASE_DIRECTORY, "JavaScriptCoreDebug", nullptr)); 162 return WebCore::FileSystem::stringFromFileSystemRepresentation(javaScriptCoreConfigDirectory.get()); 163 } 164 96 165 WebKit::WebsiteDataStore::Configuration WebsiteDataStore::defaultDataStoreConfiguration() 97 166 { -
trunk/Source/WebKit/UIProcess/API/win/APIWebsiteDataStoreWin.cpp
r235224 r235260 86 86 } 87 87 88 String WebsiteDataStore::legacyDefaultApplicationCacheDirectory() 89 { 90 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "ApplicationCache"); 91 } 92 93 String WebsiteDataStore::legacyDefaultNetworkCacheDirectory() 94 { 95 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "NetworkCache"); 96 } 97 98 String WebsiteDataStore::legacyDefaultWebSQLDatabaseDirectory() 99 { 100 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "WebSQL"); 101 } 102 103 String WebsiteDataStore::legacyDefaultIndexedDBDatabaseDirectory() 104 { 105 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "IndexedDB"); 106 } 107 108 String WebsiteDataStore::legacyDefaultLocalStorageDirectory() 109 { 110 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "LocalStorage"); 111 } 112 113 String WebsiteDataStore::legacyDefaultMediaCacheDirectory() 114 { 115 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "MediaCache"); 116 } 117 118 String WebsiteDataStore::legacyDefaultMediaKeysStorageDirectory() 119 { 120 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "MediaKeyStorage"); 121 } 122 123 String WebsiteDataStore::legacyDefaultJavaScriptConfigurationDirectory() 124 { 125 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "JavaScriptCoreDebug"); 126 } 127 88 128 WebKit::WebsiteDataStore::Configuration WebsiteDataStore::defaultDataStoreConfiguration() 89 129 { -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessPoolCocoa.mm
r235239 r235260 63 63 using namespace WebCore; 64 64 65 NSString *WebDatabaseDirectoryDefaultsKey = @"WebDatabaseDirectory";66 65 NSString *WebServiceWorkerRegistrationDirectoryDefaultsKey = @"WebServiceWorkerRegistrationDirectory"; 67 66 NSString *WebKitLocalCacheDefaultsKey = @"WebKitLocalCache"; 68 NSString *WebStorageDirectoryDefaultsKey = @"WebKitLocalStorageDatabasePathPreferenceKey";69 67 NSString *WebKitJSCJITEnabledDefaultsKey = @"WebKitJSCJITEnabledDefaultsKey"; 70 68 NSString *WebKitJSCFTLJITEnabledDefaultsKey = @"WebKitJSCFTLJITEnabledDefaultsKey"; 71 NSString *WebKitMediaKeysStorageDirectoryDefaultsKey = @"WebKitMediaKeysStorageDirectory";72 NSString *WebKitMediaCacheDirectoryDefaultsKey = @"WebKitMediaCacheDirectory";73 69 74 70 #if !PLATFORM(IOS) … … 385 381 } 386 382 #endif 387 388 String WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory()389 {390 registerUserDefaultsIfNeeded();391 392 NSString *databasesDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebDatabaseDirectoryDefaultsKey];393 if (!databasesDirectory || ![databasesDirectory isKindOfClass:[NSString class]])394 databasesDirectory = @"~/Library/WebKit/Databases";395 return stringByResolvingSymlinksInPath([databasesDirectory stringByStandardizingPath]);396 }397 398 String WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory()399 {400 // Indexed databases exist in a subdirectory of the "database directory path."401 // Currently, the top level of that directory contains entities related to WebSQL databases.402 // We should fix this, and move WebSQL into a subdirectory (https://bugs.webkit.org/show_bug.cgi?id=124807)403 // In the meantime, an entity name prefixed with three underscores will not conflict with any WebSQL entities.404 return FileSystem::pathByAppendingComponent(legacyPlatformDefaultWebSQLDatabaseDirectory(), "___IndexedDB");405 }406 407 String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory()408 {409 registerUserDefaultsIfNeeded();410 411 NSString *localStorageDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebStorageDirectoryDefaultsKey];412 if (!localStorageDirectory || ![localStorageDirectory isKindOfClass:[NSString class]])413 localStorageDirectory = @"~/Library/WebKit/LocalStorage";414 return stringByResolvingSymlinksInPath([localStorageDirectory stringByStandardizingPath]);415 }416 417 String WebProcessPool::legacyPlatformDefaultMediaCacheDirectory()418 {419 registerUserDefaultsIfNeeded();420 421 NSString *mediaKeysCacheDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebKitMediaCacheDirectoryDefaultsKey];422 if (!mediaKeysCacheDirectory || ![mediaKeysCacheDirectory isKindOfClass:[NSString class]]) {423 mediaKeysCacheDirectory = NSTemporaryDirectory();424 425 if (!WebKit::processHasContainer()) {426 NSString *bundleIdentifier = [NSBundle mainBundle].bundleIdentifier;427 if (!bundleIdentifier)428 bundleIdentifier = [NSProcessInfo processInfo].processName;429 mediaKeysCacheDirectory = [mediaKeysCacheDirectory stringByAppendingPathComponent:bundleIdentifier];430 }431 mediaKeysCacheDirectory = [mediaKeysCacheDirectory stringByAppendingPathComponent:@"WebKit/MediaCache"];432 }433 return stringByResolvingSymlinksInPath([mediaKeysCacheDirectory stringByStandardizingPath]);434 }435 436 String WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory()437 {438 registerUserDefaultsIfNeeded();439 440 NSString *mediaKeysStorageDirectory = [[NSUserDefaults standardUserDefaults] objectForKey:WebKitMediaKeysStorageDirectoryDefaultsKey];441 if (!mediaKeysStorageDirectory || ![mediaKeysStorageDirectory isKindOfClass:[NSString class]])442 mediaKeysStorageDirectory = @"~/Library/WebKit/MediaKeys";443 return stringByResolvingSymlinksInPath([mediaKeysStorageDirectory stringByStandardizingPath]);444 }445 446 String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory()447 {448 NSString *appName = [[NSBundle mainBundle] bundleIdentifier];449 if (!appName)450 appName = [[NSProcessInfo processInfo] processName];451 #if PLATFORM(IOS)452 // This quirk used to make these apps share application cache storage, but doesn't accomplish that any more.453 // Preserving it avoids the need to migrate data when upgrading.454 if (IOSApplication::isMobileSafari() || IOSApplication::isWebApp())455 appName = @"com.apple.WebAppCache";456 #endif457 458 ASSERT(appName);459 460 #if PLATFORM(IOS)461 NSString *cacheDir = [NSHomeDirectory() stringByAppendingPathComponent:@"Library/Caches"];462 #else463 char cacheDirectory[MAXPATHLEN];464 size_t cacheDirectoryLen = confstr(_CS_DARWIN_USER_CACHE_DIR, cacheDirectory, MAXPATHLEN);465 if (!cacheDirectoryLen)466 return String();467 468 NSString *cacheDir = [[NSFileManager defaultManager] stringWithFileSystemRepresentation:cacheDirectory length:cacheDirectoryLen - 1];469 #endif470 NSString* cachePath = [cacheDir stringByAppendingPathComponent:appName];471 return stringByResolvingSymlinksInPath([cachePath stringByStandardizingPath]);472 }473 474 String WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory()475 {476 NSString *cachePath = CFBridgingRelease(_CFURLCacheCopyCacheDirectory([[NSURLCache sharedURLCache] _CFURLCache]));477 if (!cachePath)478 cachePath = @"~/Library/Caches/com.apple.WebKit.WebProcess";479 480 cachePath = [cachePath stringByAppendingPathComponent:@"WebKitCache"];481 482 return stringByResolvingSymlinksInPath([cachePath stringByStandardizingPath]);483 }484 485 String WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory()486 {487 #if PLATFORM(IOS)488 String path = pathForProcessContainer();489 if (path.isEmpty())490 path = NSHomeDirectory();491 492 path = path + "/Library/WebKit/JavaScriptCoreDebug";493 path = stringByResolvingSymlinksInPath(path);494 495 return path;496 #else497 RetainPtr<NSString> javaScriptConfigPath = @"~/Library/WebKit/JavaScriptCoreDebug";498 499 return stringByResolvingSymlinksInPath([javaScriptConfigPath stringByStandardizingPath]);500 #endif501 }502 383 503 384 #if PLATFORM(IOS) -
trunk/Source/WebKit/UIProcess/WebProcessPool.h
r235224 r235260 418 418 } 419 419 420 // FIXME: Move these to API::WebsiteDataStore.421 static String legacyPlatformDefaultLocalStorageDirectory();422 static String legacyPlatformDefaultIndexedDBDatabaseDirectory();423 static String legacyPlatformDefaultWebSQLDatabaseDirectory();424 static String legacyPlatformDefaultMediaKeysStorageDirectory();425 static String legacyPlatformDefaultMediaCacheDirectory();426 static String legacyPlatformDefaultApplicationCacheDirectory();427 static String legacyPlatformDefaultNetworkCacheDirectory();428 static String legacyPlatformDefaultJavaScriptConfigurationDirectory();429 430 420 void setResourceLoadStatisticsEnabled(bool); 431 421 void clearResourceLoadStatistics(); -
trunk/Source/WebKit/UIProcess/gtk/WebProcessPoolGtk.cpp
r235224 r235260 78 78 } 79 79 80 WTF::String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory()81 {82 return API::WebsiteDataStore::defaultApplicationCacheDirectory();83 }84 85 WTF::String WebProcessPool::legacyPlatformDefaultMediaCacheDirectory()86 {87 return API::WebsiteDataStore::defaultMediaCacheDirectory();88 }89 90 80 void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters) 91 81 { … … 111 101 } 112 102 113 String WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory()114 {115 return API::WebsiteDataStore::defaultWebSQLDatabaseDirectory();116 }117 118 String WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory()119 {120 return API::WebsiteDataStore::defaultIndexedDBDatabaseDirectory();121 }122 123 String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory()124 {125 return API::WebsiteDataStore::defaultLocalStorageDirectory();126 }127 128 String WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory()129 {130 return API::WebsiteDataStore::defaultMediaKeysStorageDirectory();131 }132 133 String WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory()134 {135 return API::WebsiteDataStore::defaultNetworkCacheDirectory();136 }137 138 String WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory()139 {140 GUniquePtr<gchar> javaScriptCoreConfigDirectory(g_build_filename(g_get_user_data_dir(), "webkitgtk", "JavaScriptCoreDebug", nullptr));141 return WebCore::FileSystem::stringFromFileSystemRepresentation(javaScriptCoreConfigDirectory.get());142 }143 144 103 void WebProcessPool::platformResolvePathsForSandboxExtensions() 145 104 { -
trunk/Source/WebKit/UIProcess/win/WebProcessPoolWin.cpp
r235224 r235260 54 54 } 55 55 56 String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory()57 {58 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "ApplicationCache");59 }60 61 String WebProcessPool::legacyPlatformDefaultMediaCacheDirectory()62 {63 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "MediaCache");64 }65 66 String WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory()67 {68 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "WebSQL");69 }70 71 String WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory()72 {73 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "IndexedDB");74 }75 76 String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory()77 {78 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "LocalStorage");79 }80 81 String WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory()82 {83 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "MediaKeyStorage");84 }85 86 String WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory()87 {88 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "NetworkCache");89 }90 91 String WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory()92 {93 return WebCore::FileSystem::pathByAppendingComponent(WebCore::FileSystem::localUserSpecificStorageDirectory(), "JavaScriptCoreDebug");94 }95 96 56 void WebProcessPool::platformResolvePathsForSandboxExtensions() 97 57 { -
trunk/Source/WebKit/UIProcess/wpe/WebProcessPoolWPE.cpp
r235224 r235260 79 79 } 80 80 81 WTF::String WebProcessPool::legacyPlatformDefaultApplicationCacheDirectory()82 {83 GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "appcache", nullptr));84 return WebCore::FileSystem::stringFromFileSystemRepresentation(cacheDirectory.get());85 }86 87 WTF::String WebProcessPool::legacyPlatformDefaultMediaCacheDirectory()88 {89 GUniquePtr<gchar> cacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "mediacache", nullptr));90 return WebCore::FileSystem::stringFromFileSystemRepresentation(cacheDirectory.get());91 }92 93 81 void WebProcessPool::platformInitializeWebProcess(WebProcessCreationParameters& parameters) 94 82 { … … 110 98 } 111 99 112 String WebProcessPool::legacyPlatformDefaultWebSQLDatabaseDirectory()113 {114 GUniquePtr<gchar> databaseDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "databases", nullptr));115 return WebCore::FileSystem::stringFromFileSystemRepresentation(databaseDirectory.get());116 }117 118 String WebProcessPool::legacyPlatformDefaultIndexedDBDatabaseDirectory()119 {120 GUniquePtr<gchar> indexedDBDatabaseDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "databases", "indexeddb", nullptr));121 return WebCore::FileSystem::stringFromFileSystemRepresentation(indexedDBDatabaseDirectory.get());122 }123 124 String WebProcessPool::legacyPlatformDefaultLocalStorageDirectory()125 {126 GUniquePtr<gchar> storageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "localstorage", nullptr));127 return WebCore::FileSystem::stringFromFileSystemRepresentation(storageDirectory.get());128 }129 130 String WebProcessPool::legacyPlatformDefaultMediaKeysStorageDirectory()131 {132 GUniquePtr<gchar> mediaKeysStorageDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "mediakeys", nullptr));133 return WebCore::FileSystem::stringFromFileSystemRepresentation(mediaKeysStorageDirectory.get());134 }135 136 String WebProcessPool::legacyPlatformDefaultNetworkCacheDirectory()137 {138 GUniquePtr<char> diskCacheDirectory(g_build_filename(g_get_user_cache_dir(), "wpe", "cache", nullptr));139 return WebCore::FileSystem::stringFromFileSystemRepresentation(diskCacheDirectory.get());140 }141 142 String WebProcessPool::legacyPlatformDefaultJavaScriptConfigurationDirectory()143 {144 GUniquePtr<gchar> javaScriptCoreConfigDirectory(g_build_filename(g_get_user_data_dir(), "wpe", "JavaScriptCoreDebug", nullptr));145 return WebCore::FileSystem::stringFromFileSystemRepresentation(javaScriptCoreConfigDirectory.get());146 }147 148 100 void WebProcessPool::platformResolvePathsForSandboxExtensions() 149 101 {
Note: See TracChangeset
for help on using the changeset viewer.