Changeset 207067 in webkit
- Timestamp:
- Oct 11, 2016 1:35:46 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/win/ChangeLog
r206979 r207067 1 2016-10-11 Per Arne Vollan <pvollan@apple.com> 2 3 [Win] Parallel DRTs are sharing preferences and cache. 4 https://bugs.webkit.org/show_bug.cgi?id=163013 5 6 Reviewed by Brent Fulgham. 7 8 Make it possible for a WebKit client to use separate preferences and cache. 9 10 * Interfaces/IWebPreferencesPrivate.idl: 11 * WebApplicationCache.cpp: 12 (applicationCachePath): 13 * WebCache.cpp: 14 (WebCache::cacheFolder): 15 (WebCache::setCacheFolder): 16 * WebDatabaseManager.cpp: 17 (databasesDirectory): 18 * WebPreferences.cpp: 19 (WebPreferences::applicationId): 20 (WebPreferences::valueForKey): 21 (WebPreferences::setValueForKey): 22 (WebPreferences::save): 23 (WebPreferences::QueryInterface): 24 (WebPreferences::modernMediaControlsEnabled): 25 (WebPreferences::setApplicationId): 26 * WebPreferences.h: 27 * WebView.cpp: 28 (WebView::setCacheModel): 29 1 30 2016-10-09 Wenson Hsieh <wenson_hsieh@apple.com> 2 31 -
trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
r206296 r207067 188 188 } 189 189 190 [uuid(F9582D72-6348-45B1-AB09-39E33459B5B9)] 191 interface IWebPreferencesPrivate4 : IWebPreferencesPrivate3 192 { 193 HRESULT setApplicationId([in] BSTR applicationId); 194 } -
trunk/Source/WebKit/win/WebApplicationCache.cpp
r199908 r207067 29 29 #include "CFDictionaryPropertyBag.h" 30 30 #include "MarshallingHelpers.h" 31 #include "WebPreferences.h" 31 32 #include "WebSecurityOrigin.h" 32 33 #include <wtf/RetainPtr.h> … … 69 70 70 71 #if USE(CF) 71 auto cacheDirectoryPreference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, kCFPreferencesCurrentApplication));72 auto cacheDirectoryPreference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, WebPreferences::applicationId())); 72 73 if (cacheDirectoryPreference && CFStringGetTypeID() == CFGetTypeID(cacheDirectoryPreference.get())) 73 74 path = static_cast<CFStringRef>(cacheDirectoryPreference.get()); -
trunk/Source/WebKit/win/WebCache.cpp
r199836 r207067 36 36 #if USE(CURL) 37 37 #include <WebCore/CurlCacheManager.h> 38 #endif 38 #elif USE(CFNETWORK) 39 #include <CFNetwork/CFURLCachePriv.h> 40 #include <WebKitSystemInterface/WebKitSystemInterface.h> 41 #endif 42 43 using namespace WebCore; 39 44 40 45 // WebCache --------------------------------------------------------------------------- … … 244 249 *location = WebCore::BString(cacheFolder).release(); 245 250 return S_OK; 246 #else 247 return E_NOTIMPL; 251 #elif USE(CFNETWORK) 252 RetainPtr<CFStringRef> cfurlCacheDirectory = adoptCF(wkCopyFoundationCacheDirectory(0)); 253 *location = BString(cfurlCacheDirectory.get()).release(); 254 return S_OK; 248 255 #endif 249 256 } … … 255 262 WebCore::CurlCacheManager::getInstance().setCacheDirectory(cacheFolder); 256 263 return S_OK; 257 #else 258 return E_NOTIMPL; 259 #endif 260 } 264 #elif USE(CFNETWORK) 265 RetainPtr<CFURLCacheRef> cache = adoptCF(CFURLCacheCopySharedURLCache()); 266 CFIndex memoryCapacity = CFURLCacheMemoryCapacity(cache.get()); 267 CFIndex diskCapacity = CFURLCacheDiskCapacity(cache.get()); 268 RetainPtr<CFURLCacheRef> newCache = adoptCF(CFURLCacheCreate(kCFAllocatorDefault, memoryCapacity, diskCapacity, String(location).createCFString().get())); 269 CFURLCacheSetSharedURLCache(newCache.get()); 270 return S_OK; 271 #endif 272 } -
trunk/Source/WebKit/win/WebDatabaseManager.cpp
r202368 r207067 34 34 #include "MarshallingHelpers.h" 35 35 #include "WebNotificationCenter.h" 36 #include "WebPreferences.h" 36 37 #include "WebSecurityOrigin.h" 37 38 … … 421 422 { 422 423 #if USE(CF) 423 RetainPtr<CFPropertyListRef> directoryPref = adoptCF(CFPreferencesCopyAppValue(WebDatabaseDirectoryDefaultsKey, kCFPreferencesCurrentApplication));424 RetainPtr<CFPropertyListRef> directoryPref = adoptCF(CFPreferencesCopyAppValue(WebDatabaseDirectoryDefaultsKey, WebPreferences::applicationId())); 424 425 if (directoryPref && (CFStringGetTypeID() == CFGetTypeID(directoryPref.get()))) 425 426 return static_cast<CFStringRef>(directoryPref.get()); -
trunk/Source/WebKit/win/WebPreferences.cpp
r206296 r207067 102 102 static CFDictionaryRef defaultSettings; 103 103 104 RetainPtr<CFStringRef> WebPreferences::m_applicationId = kCFPreferencesCurrentApplication; 105 104 106 static HashMap<WTF::String, COMPtr<WebPreferences>>& webPreferencesInstances() 105 107 { … … 182 184 if (webPreference && webPreference->m_refCount == 1) 183 185 webPreferencesInstances().remove(identifierString); 186 } 187 188 CFStringRef WebPreferences::applicationId() 189 { 190 return m_applicationId.get(); 184 191 } 185 192 … … 307 314 return value; 308 315 309 value = adoptCF(CFPreferencesCopyAppValue(key, kCFPreferencesCurrentApplication));316 value = adoptCF(CFPreferencesCopyAppValue(key, applicationId())); 310 317 if (value) 311 318 return value; … … 318 325 CFDictionarySetValue(m_privatePrefs.get(), key, value); 319 326 if (m_autoSaves) { 320 CFPreferencesSetAppValue(key, value, kCFPreferencesCurrentApplication);327 CFPreferencesSetAppValue(key, value, applicationId()); 321 328 save(); 322 329 } … … 449 456 void WebPreferences::save() 450 457 { 451 CFPreferencesAppSynchronize( kCFPreferencesCurrentApplication);458 CFPreferencesAppSynchronize(applicationId()); 452 459 } 453 460 … … 541 548 else if (IsEqualGUID(riid, IID_IWebPreferencesPrivate3)) 542 549 *ppvObject = static_cast<IWebPreferencesPrivate3*>(this); 550 else if (IsEqualGUID(riid, IID_IWebPreferencesPrivate4)) 551 *ppvObject = static_cast<IWebPreferencesPrivate4*>(this); 543 552 else if (IsEqualGUID(riid, CLSID_WebPreferences)) 544 553 *ppvObject = this; … … 1994 2003 return S_OK; 1995 2004 } 2005 2006 HRESULT WebPreferences::setApplicationId(BSTR applicationId) 2007 { 2008 m_applicationId = String(applicationId).createCFString(); 2009 return S_OK; 2010 } -
trunk/Source/WebKit/win/WebPreferences.h
r206296 r207067 24 24 */ 25 25 26 #ifndef WebPreferences_H 27 #define WebPreferences_H 26 #pragma once 28 27 29 28 #include "WebKit.h" … … 32 31 #include <wtf/RetainPtr.h> 33 32 34 class WebPreferences : public IWebPreferences, public IWebPreferencesPrivate 3{33 class WebPreferences : public IWebPreferences, public IWebPreferencesPrivate4 { 35 34 public: 36 35 static WebPreferences* createInstance(); … … 245 244 virtual HRESULT STDMETHODCALLTYPE setModernMediaControlsEnabled(BOOL); 246 245 246 // IWebPreferencesPrivate4 247 virtual HRESULT STDMETHODCALLTYPE setApplicationId(BSTR); 248 247 249 // WebPreferences 248 250 … … 257 259 static void removeReferenceForIdentifier(BSTR identifier); 258 260 static WebPreferences* sharedStandardPreferences(); 261 262 static CFStringRef applicationId(); 259 263 260 264 // From WebHistory.h … … 264 268 HRESULT setHistoryAgeInDaysLimit(int); 265 269 266 267 270 void willAddToWebView(); 271 void didRemoveFromWebView(); 268 272 269 273 HRESULT postPreferencesChangesNotification(); … … 298 302 bool m_automaticallyDetectsCacheModel { true }; 299 303 unsigned m_numWebViews { 0 }; 304 static RetainPtr<CFStringRef> m_applicationId; 300 305 }; 301 302 #endif -
trunk/Source/WebKit/win/WebView.cpp
r206816 r207067 502 502 RetainPtr<CFStringRef> cfurlCacheDirectory = adoptCF(wkCopyFoundationCacheDirectory(0)); 503 503 if (!cfurlCacheDirectory) { 504 RetainPtr<CFPropertyListRef> preference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, kCFPreferencesCurrentApplication));504 RetainPtr<CFPropertyListRef> preference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, WebPreferences::applicationId())); 505 505 if (preference && (CFStringGetTypeID() == CFGetTypeID(preference.get()))) 506 506 cfurlCacheDirectory = adoptCF(static_cast<CFStringRef>(preference.leakRef())); -
trunk/Tools/ChangeLog
r207054 r207067 1 2016-10-11 Per Arne Vollan <pvollan@apple.com> 2 3 [Win] Parallel DRTs are sharing preferences and cache. 4 https://bugs.webkit.org/show_bug.cgi?id=163013 5 6 Reviewed by Brent Fulgham. 7 8 Use separate cache and preferences for each DRT instance. 9 10 * DumpRenderTree/win/DumpRenderTree.cpp: 11 (applicationId): 12 (setApplicationId): 13 (setCacheFolder): 14 (setDefaultsToConsistentValuesForTesting): 15 * Scripts/webkitpy/port/win.py: 16 (WinPort.setup_test_run): 17 1 18 2016-10-10 Zan Dobersek <zdobersek@igalia.com> 2 19 -
trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp
r206296 r207067 50 50 #include <io.h> 51 51 #include <math.h> 52 #include <shlobj.h> 52 53 #include <shlwapi.h> 53 54 #include <tchar.h> … … 860 861 } 861 862 863 static String applicationId() 864 { 865 DWORD processId = ::GetCurrentProcessId(); 866 return String::format("com.apple.DumpRenderTree.%d", processId); 867 } 868 869 static void setApplicationId() 870 { 871 COMPtr<IWebPreferences> preferences; 872 if (SUCCEEDED(WebKitCreateInstance(CLSID_WebPreferences, 0, IID_IWebPreferences, (void**)&preferences))) { 873 COMPtr<IWebPreferencesPrivate4> prefsPrivate4(Query, preferences); 874 ASSERT(prefsPrivate4); 875 _bstr_t fileName = applicationId().charactersWithNullTermination().data(); 876 prefsPrivate4->setApplicationId(fileName); 877 } 878 } 879 880 static void setCacheFolder() 881 { 882 String libraryPath = libraryPathForDumpRenderTree(); 883 884 COMPtr<IWebCache> webCache; 885 if (SUCCEEDED(WebKitCreateInstance(CLSID_WebCache, 0, IID_IWebCache, (void**)&webCache))) { 886 _bstr_t cacheFolder = WebCore::pathByAppendingComponent(libraryPath, "LocalCache").utf8().data(); 887 webCache->setCacheFolder(cacheFolder); 888 } 889 } 890 862 891 // Called once on DumpRenderTree startup. 863 892 static void setDefaultsToConsistentValuesForTesting() 864 893 { 865 894 #if USE(CF) 895 // Create separate preferences for each DRT instance 896 setApplicationId(); 897 898 RetainPtr<CFStringRef> appId = applicationId().createCFString(); 899 866 900 String libraryPath = libraryPathForDumpRenderTree(); 867 901 868 902 // Set up these values before creating the WebView so that the various initializations will see these preferred values. 869 CFPreferencesSetAppValue(WebDatabaseDirectoryDefaultsKey, WebCore::pathByAppendingComponent(libraryPath, "Databases").createCFString().get(), kCFPreferencesCurrentApplication); 870 CFPreferencesSetAppValue(WebStorageDirectoryDefaultsKey, WebCore::pathByAppendingComponent(libraryPath, "LocalStorage").createCFString().get(), kCFPreferencesCurrentApplication); 871 CFPreferencesSetAppValue(WebKitLocalCacheDefaultsKey, WebCore::pathByAppendingComponent(libraryPath, "LocalCache").createCFString().get(), kCFPreferencesCurrentApplication); 903 CFPreferencesSetAppValue(WebDatabaseDirectoryDefaultsKey, WebCore::pathByAppendingComponent(libraryPath, "Databases").createCFString().get(), appId.get()); 904 CFPreferencesSetAppValue(WebStorageDirectoryDefaultsKey, WebCore::pathByAppendingComponent(libraryPath, "LocalStorage").createCFString().get(), appId.get()); 905 CFPreferencesSetAppValue(WebKitLocalCacheDefaultsKey, WebCore::pathByAppendingComponent(libraryPath, "LocalCache").createCFString().get(), appId.get()); 906 907 // Create separate cache for each DRT instance 908 setCacheFolder(); 872 909 #endif 873 910 } -
trunk/Tools/Scripts/webkitpy/port/win.py
r206934 r207067 29 29 30 30 import atexit 31 import glob 32 import logging 31 33 import os 32 import logging33 34 import re 34 35 import sys … … 352 353 self.prevent_error_dialogs() 353 354 self.delete_sem_locks() 355 356 preferences_files = self._filesystem.join(os.environ['APPDATA'], "Apple Computer/Preferences", "com.apple.DumpRenderTree*") 357 filelist = glob.glob(preferences_files) 358 for file in filelist: 359 self._filesystem.remove(file) 360 354 361 super(WinPort, self).setup_test_run(device_class) 355 362
Note: See TracChangeset
for help on using the changeset viewer.