Title: [150670] trunk
Revision
150670
Author
[email protected]
Date
2013-05-24 17:19:40 -0700 (Fri, 24 May 2013)

Log Message

[Windows] Expose database storage and cache locations via preferences.
https://bugs.webkit.org/show_bug.cgi?id=116729

Reviewed by Tim Horton.

Source/WebKit: 

* WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: Export
three symbols needed to implement the feature.

Source/WebKit/win: 

* WebDatabaseManager.cpp: Update to check preferences for the
desired location of the database store.
(databasesDirectory): Added.
(WebKitInitializeWebDatabasesIfNecessary): Use new databasesDirectory
method to determine what system path to use for file storage.
* WebKit.vcproj/WebKitExports.def.in: Export three symbols
needed to implement the feature.
* WebView.cpp: Update to check preferences for the desired location
of the various caches used by WebKit.
(WebView::setCacheModel): Update to check preferences for URL cache
storage.
(WebKitSetApplicationCachePathIfNecessary): Update to check
preferences for ccache storage.

Tools: 

Update DumpRenderTree to use CFPreferences to control where WebKit
stores its local databases, URL caches, etc.

* DumpRenderTree/win/DumpRenderTree.cpp:
(libraryPathForDumpRenderTree): Added.
(dllLauncherEntryPoint): Set up DRT-specific cache locations.
* Scripts/webkitpy/port/base.py:
(Port._driver_tempdir): Added (to allow port-specific overload).
(Port._driver_tempdir_for_environment): Ditto
* Scripts/webkitpy/port/driver.py:
(Driver._setup_environ_for_driver): Use new overload to set
environment variable.
(Driver._start): Use new overload for temp directory location.
* Scripts/webkitpy/port/win.py:
(WinPort._driver_tempdir_for_environment): New overload to supply
Windows path to DumpRenderTree environment (while still using
cygwin paths for internal operations.

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (150669 => 150670)


--- trunk/Source/WebKit/ChangeLog	2013-05-25 00:17:20 UTC (rev 150669)
+++ trunk/Source/WebKit/ChangeLog	2013-05-25 00:19:40 UTC (rev 150670)
@@ -1,3 +1,13 @@
+2013-05-24  Brent Fulgham  <[email protected]>
+
+        [Windows] Expose database storage and cache locations via preferences.
+        https://bugs.webkit.org/show_bug.cgi?id=116729
+
+        Reviewed by Tim Horton.
+
+        * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: Export
+        three symbols needed to implement the feature.
+
 2013-05-24  Anders Carlsson  <[email protected]>
 
         Move history property list writer to WebKit

Modified: trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in (150669 => 150670)


--- trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in	2013-05-25 00:17:20 UTC (rev 150669)
+++ trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in	2013-05-25 00:19:40 UTC (rev 150670)
@@ -178,6 +178,9 @@
         ?childItemWithTarget@HistoryItem@WebCore@@QBEPAV12@ABVString@WTF@@@Z
         ?create@Range@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@V?$PassRefPtr@VDocument@WebCore@@@4@V?$PassRefPtr@VNode@WebCore@@@4@H1H@Z
         ?create@SerializedScriptValue@WebCore@@SA?AV?$PassRefPtr@VSerializedScriptValue@WebCore@@@WTF@@ABVString@4@@Z
+#if USE(CF)
+        ?createCFString@String@WTF@@QBE?AV?$RetainPtr@PBU__CFString@@@2@XZ
+#endif
         ?createShadowRoot@Element@WebCore@@QAE?AV?$PassRefPtr@VShadowRoot@WebCore@@@WTF@@AAH@Z
         ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
         ?deprecatedShadowAncestorNode@Node@WebCore@@QBEPAV12@XZ
@@ -222,6 +225,7 @@
         ?setProperty@Settings@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@0@Z
         ?windowObjectCleared@InspectorFrontendClientLocal@WebCore@@UAEXXZ
         ?setResourcesDataSizeLimitsFromInternals@InspectorController@WebCore@@QAEXHH@Z
+        ?pathByAppendingComponent@WebCore@@YA?AVString@WTF@@ABV23@0@Z
         ?profilerEnabled@InspectorController@WebCore@@QAE_NXZ
         ?setProfilerEnabled@InspectorController@WebCore@@QAEX_N@Z
         ?disconnectFrontend@InspectorController@WebCore@@QAEXXZ
@@ -237,6 +241,7 @@
         ?firstChild@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?lastChild@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?length@StaticNodeList@WebCore@@UBEIXZ
+        ?localUserSpecificStorageDirectory@WebCore@@YA?AVString@WTF@@XZ
         ?namedItem@StaticNodeList@WebCore@@UBEPAVNode@2@ABVAtomicString@WTF@@@Z
         ?next@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?previous@ComposedShadowTreeWalker@WebCore@@QAEXXZ

Modified: trunk/Source/WebKit/win/ChangeLog (150669 => 150670)


--- trunk/Source/WebKit/win/ChangeLog	2013-05-25 00:17:20 UTC (rev 150669)
+++ trunk/Source/WebKit/win/ChangeLog	2013-05-25 00:19:40 UTC (rev 150670)
@@ -1,3 +1,24 @@
+2013-05-24  Brent Fulgham  <[email protected]>
+
+        [Windows] Expose database storage and cache locations via preferences.
+        https://bugs.webkit.org/show_bug.cgi?id=116729
+
+        Reviewed by Tim Horton.
+
+        * WebDatabaseManager.cpp: Update to check preferences for the
+        desired location of the database store.
+        (databasesDirectory): Added.
+        (WebKitInitializeWebDatabasesIfNecessary): Use new databasesDirectory
+        method to determine what system path to use for file storage.
+        * WebKit.vcproj/WebKitExports.def.in: Export three symbols
+        needed to implement the feature.
+        * WebView.cpp: Update to check preferences for the desired location
+        of the various caches used by WebKit.
+        (WebView::setCacheModel): Update to check preferences for URL cache
+        storage.
+        (WebKitSetApplicationCachePathIfNecessary): Update to check
+        preferences for ccache storage.
+
 2013-05-24  Christophe Dumez  <[email protected]>
 
         Remove custom code for webkitAudioContext global constructor getter

Modified: trunk/Source/WebKit/win/WebDatabaseManager.cpp (150669 => 150670)


--- trunk/Source/WebKit/win/WebDatabaseManager.cpp	2013-05-25 00:17:20 UTC (rev 150669)
+++ trunk/Source/WebKit/win/WebDatabaseManager.cpp	2013-05-25 00:19:40 UTC (rev 150670)
@@ -47,6 +47,8 @@
 
 using namespace WebCore;
 
+static CFStringRef WebDatabaseDirectoryDefaultsKey = CFSTR("WebDatabaseDirectory");
+
 static inline bool isEqual(LPCWSTR s1, LPCWSTR s2)
 {
     return !wcscmp(s1, s2);
@@ -405,14 +407,24 @@
     notifyCenter->postNotificationName(databaseDidModifyOriginName, securityOrigin.get(), userInfoBag.get());
 }
 
+static WTF::String databasesDirectory()
+{
+#if USE(CF)
+    RetainPtr<CFPropertyListRef> directoryPref = adoptCF(CFPreferencesCopyAppValue(WebDatabaseDirectoryDefaultsKey, kCFPreferencesCurrentApplication));
+    if (directoryPref && (CFStringGetTypeID() == CFGetTypeID(directoryPref.get())))
+        return static_cast<CFStringRef>(directoryPref.get());
+#endif
+
+    return WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");
+}
+
 void WebKitInitializeWebDatabasesIfNecessary()
 {
     static bool initialized = false;
     if (initialized)
         return;
 
-    WTF::String databasesDirectory = WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");
-    WebCore::DatabaseManager::manager().initialize(databasesDirectory);
+    WebCore::DatabaseManager::manager().initialize(databasesDirectory());
 
     initialized = true;
 }

Modified: trunk/Source/WebKit/win/WebKit.vcproj/WebKitExports.def.in (150669 => 150670)


--- trunk/Source/WebKit/win/WebKit.vcproj/WebKitExports.def.in	2013-05-25 00:17:20 UTC (rev 150669)
+++ trunk/Source/WebKit/win/WebKit.vcproj/WebKitExports.def.in	2013-05-25 00:19:40 UTC (rev 150670)
@@ -178,6 +178,9 @@
         ?childItemWithTarget@HistoryItem@WebCore@@QBEPAV12@ABVString@WTF@@@Z
         ?create@Range@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@V?$PassRefPtr@VDocument@WebCore@@@4@V?$PassRefPtr@VNode@WebCore@@@4@H1H@Z
         ?create@SerializedScriptValue@WebCore@@SA?AV?$PassRefPtr@VSerializedScriptValue@WebCore@@@WTF@@ABVString@4@@Z
+#if USE(CF)
+        ?createCFString@String@WTF@@QBE?AV?$RetainPtr@PBU__CFString@@@2@XZ
+#endif
         ?createShadowRoot@Element@WebCore@@QAE?AV?$PassRefPtr@VShadowRoot@WebCore@@@WTF@@AAH@Z
         ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
         ?deprecatedShadowAncestorNode@Node@WebCore@@QBEPAV12@XZ
@@ -222,6 +225,7 @@
         ?setProperty@Settings@InspectorFrontendClientLocal@WebCore@@UAEXABVString@WTF@@0@Z
         ?windowObjectCleared@InspectorFrontendClientLocal@WebCore@@UAEXXZ
         ?setResourcesDataSizeLimitsFromInternals@InspectorController@WebCore@@QAEXHH@Z
+        ?pathByAppendingComponent@WebCore@@YA?AVString@WTF@@ABV23@0@Z
         ?profilerEnabled@InspectorController@WebCore@@QAE_NXZ
         ?setProfilerEnabled@InspectorController@WebCore@@QAEX_N@Z
         ?disconnectFrontend@InspectorController@WebCore@@QAEXXZ
@@ -237,6 +241,7 @@
         ?firstChild@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?lastChild@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?length@StaticNodeList@WebCore@@UBEIXZ
+        ?localUserSpecificStorageDirectory@WebCore@@YA?AVString@WTF@@XZ
         ?namedItem@StaticNodeList@WebCore@@UBEPAVNode@2@ABVAtomicString@WTF@@@Z
         ?next@ComposedShadowTreeWalker@WebCore@@QAEXXZ
         ?previous@ComposedShadowTreeWalker@WebCore@@QAEXXZ

Modified: trunk/Source/WebKit/win/WebView.cpp (150669 => 150670)


--- trunk/Source/WebKit/win/WebView.cpp	2013-05-25 00:17:20 UTC (rev 150669)
+++ trunk/Source/WebKit/win/WebView.cpp	2013-05-25 00:19:40 UTC (rev 150670)
@@ -195,6 +195,8 @@
 static HMODULE accessibilityLib;
 static HashSet<WebView*> pendingDeleteBackingStoreSet;
 
+static CFStringRef WebKitLocalCacheDefaultsKey = CFSTR("WebKitLocalCache");
+
 static String webKitVersionString();
 
 WebView* kit(Page* page)
@@ -478,8 +480,13 @@
 
     RetainPtr<CFURLCacheRef> cfurlCache = adoptCF(CFURLCacheCopySharedURLCache());
     RetainPtr<CFStringRef> cfurlCacheDirectory = adoptCF(wkCopyFoundationCacheDirectory(0));
-    if (!cfurlCacheDirectory)
-        cfurlCacheDirectory = WebCore::localUserSpecificStorageDirectory().createCFString();
+    if (!cfurlCacheDirectory) {
+        RetainPtr<CFPropertyListRef> preference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, kCFPreferencesCurrentApplication));
+        if (preference && (CFStringGetTypeID() == CFGetTypeID(preference.get())))
+            cfurlCacheDirectory = adoptCF(static_cast<CFStringRef>(preference.leakRef()));
+        else
+            cfurlCacheDirectory = WebCore::localUserSpecificStorageDirectory().createCFString();
+    }
 
     // As a fudge factor, use 1000 instead of 1024, in case the reported byte 
     // count doesn't align exactly to a megabyte boundary.
@@ -2597,6 +2604,13 @@
         return;
 
     String path = localUserSpecificStorageDirectory();
+
+#if USE(CF)
+    RetainPtr<CFPropertyListRef> cacheDirectoryPreference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, kCFPreferencesCurrentApplication));
+    if (cacheDirectoryPreference && (CFStringGetTypeID() == CFGetTypeID(cacheDirectoryPreference.get())))
+        path = static_cast<CFStringRef>(cacheDirectoryPreference.get());
+#endif
+
     if (!path.isNull())
         cacheStorage().setCacheDirectory(path);
 

Modified: trunk/Tools/ChangeLog (150669 => 150670)


--- trunk/Tools/ChangeLog	2013-05-25 00:17:20 UTC (rev 150669)
+++ trunk/Tools/ChangeLog	2013-05-25 00:19:40 UTC (rev 150670)
@@ -1,3 +1,28 @@
+2013-05-24  Brent Fulgham  <[email protected]>
+
+        [Windows] Expose database storage and cache locations via preferences.
+        https://bugs.webkit.org/show_bug.cgi?id=116729
+
+        Reviewed by Tim Horton.
+
+        Update DumpRenderTree to use CFPreferences to control where WebKit
+        stores its local databases, URL caches, etc.
+
+        * DumpRenderTree/win/DumpRenderTree.cpp:
+        (libraryPathForDumpRenderTree): Added.
+        (dllLauncherEntryPoint): Set up DRT-specific cache locations.
+        * Scripts/webkitpy/port/base.py:
+        (Port._driver_tempdir): Added (to allow port-specific overload).
+        (Port._driver_tempdir_for_environment): Ditto
+        * Scripts/webkitpy/port/driver.py:
+        (Driver._setup_environ_for_driver): Use new overload to set
+        environment variable.
+        (Driver._start): Use new overload for temp directory location.
+        * Scripts/webkitpy/port/win.py:
+        (WinPort._driver_tempdir_for_environment): New overload to supply
+        Windows path to DumpRenderTree environment (while still using
+        cygwin paths for internal operations.
+
 2013-05-24  Christophe Dumez  <[email protected]>
 
         Remove custom code for webkitAudioContext global constructor getter

Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (150669 => 150670)


--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2013-05-25 00:17:20 UTC (rev 150669)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp	2013-05-25 00:19:40 UTC (rev 150670)
@@ -54,17 +54,15 @@
 #include <wtf/Vector.h>
 #include <windows.h>
 #include <CoreFoundation/CoreFoundation.h>
+#include <WebCore/FileSystem.h>
 #include <WebKit/WebKit.h>
 #include <WebKit/WebKitCOMAPI.h>
 
 #if USE(CFNETWORK)
+#include <CFNetwork/CFHTTPCookiesPriv.h>
 #include <CFNetwork/CFURLCachePriv.h>
 #endif
 
-#if USE(CFNETWORK)
-#include <CFNetwork/CFHTTPCookiesPriv.h>
-#endif
-
 using namespace std;
 
 #ifdef DEBUG_ALL
@@ -74,8 +72,13 @@
 #endif
 
 static LPCWSTR fontsEnvironmentVariable = L"WEBKIT_TESTFONTS";
+static LPCWSTR dumpRenderTreeTemp = L"DUMPRENDERTREE_TEMP";
 #define USE_MAC_FONTS
 
+static CFStringRef WebDatabaseDirectoryDefaultsKey = CFSTR("WebDatabaseDirectory");
+static CFStringRef WebKitLocalCacheDefaultsKey = CFSTR("WebKitLocalCache");
+static CFStringRef WebStorageDirectoryDefaultsKey = CFSTR("WebKitLocalStorageDatabasePathPreferenceKey");
+
 const LPCWSTR kDumpRenderTreeClassName = L"DumpRenderTreeWindow";
 
 static bool dumpTree = true;
@@ -191,6 +194,22 @@
     return string(utf8Vector.data(), utf8Vector.size() - 1);
 }
 
+#if USE(CF)
+static String libraryPathForDumpRenderTree()
+{
+    DWORD size = ::GetEnvironmentVariable(dumpRenderTreeTemp, 0, 0);
+    Vector<TCHAR> buffer(size);
+    if (::GetEnvironmentVariable(dumpRenderTreeTemp, buffer.data(), buffer.size())) {
+        wstring path = buffer.data();
+        if (!path.empty() && (path[path.length() - 1] != L'\\'))
+            path.append(L"\\");
+        return String (path.data(), path.length());
+    }
+
+    return WebCore::localUserSpecificStorageDirectory();
+}
+#endif
+
 string toUTF8(BSTR bstr)
 {
     return toUTF8(bstr, SysStringLen(bstr));
@@ -1275,6 +1294,14 @@
         return 0;
     }
 
+#if USE(CF)
+    // Set up these values before creating the WebView so that the various initializations will see these preferred values.
+    String path = libraryPathForDumpRenderTree();
+    CFPreferencesSetAppValue(WebDatabaseDirectoryDefaultsKey, WebCore::pathByAppendingComponent(path, "Databases").createCFString().get(), kCFPreferencesCurrentApplication);
+    CFPreferencesSetAppValue(WebStorageDirectoryDefaultsKey, WebCore::pathByAppendingComponent(path, "LocalStorage").createCFString().get(), kCFPreferencesCurrentApplication);
+    CFPreferencesSetAppValue(WebKitLocalCacheDefaultsKey, WebCore::pathByAppendingComponent(path, "LocalCache").createCFString().get(), kCFPreferencesCurrentApplication);
+#endif
+
     COMPtr<IWebView> webView(AdoptCOM, createWebViewAndOffscreenWindow(&webViewWindow));
     if (!webView)
         return -1;

Modified: trunk/Tools/Scripts/webkitpy/port/base.py (150669 => 150670)


--- trunk/Tools/Scripts/webkitpy/port/base.py	2013-05-25 00:17:20 UTC (rev 150669)
+++ trunk/Tools/Scripts/webkitpy/port/base.py	2013-05-25 00:19:40 UTC (rev 150670)
@@ -1265,6 +1265,12 @@
         """Returns the full path to the test driver (DumpRenderTree)."""
         return self._build_path(self.driver_name())
 
+    def _driver_tempdir(self):
+        return self._filesystem.mkdtemp(prefix='%s-' % self.driver_name())
+
+    def _driver_tempdir_for_environment(self):
+        return self._driver_tempdir()
+
     def _path_to_webcore_library(self):
         """Returns the full path to a built copy of WebCore."""
         return None

Modified: trunk/Tools/Scripts/webkitpy/port/driver.py (150669 => 150670)


--- trunk/Tools/Scripts/webkitpy/port/driver.py	2013-05-25 00:17:20 UTC (rev 150669)
+++ trunk/Tools/Scripts/webkitpy/port/driver.py	2013-05-25 00:19:40 UTC (rev 150670)
@@ -284,7 +284,7 @@
         environment['DYLD_LIBRARY_PATH'] = self._port._build_path()
         environment['DYLD_FRAMEWORK_PATH'] = self._port._build_path()
         # FIXME: We're assuming that WebKitTestRunner checks this DumpRenderTree-named environment variable.
-        environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir)
+        environment['DUMPRENDERTREE_TEMP'] = str(self._port._driver_tempdir_for_environment())
         environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir()
         if 'WEBKITOUTPUTDIR' in os.environ:
             environment['WEBKITOUTPUTDIR'] = os.environ['WEBKITOUTPUTDIR']
@@ -294,7 +294,7 @@
 
     def _start(self, pixel_tests, per_test_args):
         self.stop()
-        self._driver_tempdir = self._port._filesystem.mkdtemp(prefix='%s-' % self._port.driver_name())
+        self._driver_tempdir = self._port._driver_tempdir()
         server_name = self._port.driver_name()
         environment = self._port.setup_environ_for_server(server_name)
         environment = self._setup_environ_for_driver(environment)

Modified: trunk/Tools/Scripts/webkitpy/port/win.py (150669 => 150670)


--- trunk/Tools/Scripts/webkitpy/port/win.py	2013-05-25 00:17:20 UTC (rev 150669)
+++ trunk/Tools/Scripts/webkitpy/port/win.py	2013-05-25 00:19:40 UTC (rev 150670)
@@ -32,7 +32,7 @@
 
 from webkitpy.common.system.systemhost import SystemHost
 from webkitpy.common.system.executive import ScriptError, Executive
-from webkitpy.common.system.path import abspath_to_uri
+from webkitpy.common.system.path import abspath_to_uri, cygpath
 from webkitpy.port.apple import ApplePort
 
 
@@ -115,3 +115,6 @@
     # Remove this implementation when we are confident that DumpRenderTree on Windows works properly in parallel.
     def default_child_processes(self):
         return 1
+
+    def _driver_tempdir_for_environment(self):
+        return cygpath(self._driver_tempdir())
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to