Changeset 150670 in webkit


Ignore:
Timestamp:
May 24, 2013 5:19:40 PM (11 years ago)
Author:
Brent Fulgham
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.

Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r150665 r150670  
     12013-05-24  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Windows] Expose database storage and cache locations via preferences.
     4        https://bugs.webkit.org/show_bug.cgi?id=116729
     5
     6        Reviewed by Tim Horton.
     7
     8        * WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in: Export
     9        three symbols needed to implement the feature.
     10
    1112013-05-24  Anders Carlsson  <andersca@apple.com>
    212
  • trunk/Source/WebKit/WebKit.vcxproj/WebKitExportGenerator/WebKitExports.def.in

    r150172 r150670  
    179179        ?create@Range@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@V?$PassRefPtr@VDocument@WebCore@@@4@V?$PassRefPtr@VNode@WebCore@@@4@H1H@Z
    180180        ?create@SerializedScriptValue@WebCore@@SA?AV?$PassRefPtr@VSerializedScriptValue@WebCore@@@WTF@@ABVString@4@@Z
     181#if USE(CF)
     182        ?createCFString@String@WTF@@QBE?AV?$RetainPtr@PBU__CFString@@@2@XZ
     183#endif
    181184        ?createShadowRoot@Element@WebCore@@QAE?AV?$PassRefPtr@VShadowRoot@WebCore@@@WTF@@AAH@Z
    182185        ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
     
    223226        ?windowObjectCleared@InspectorFrontendClientLocal@WebCore@@UAEXXZ
    224227        ?setResourcesDataSizeLimitsFromInternals@InspectorController@WebCore@@QAEXHH@Z
     228        ?pathByAppendingComponent@WebCore@@YA?AVString@WTF@@ABV23@0@Z
    225229        ?profilerEnabled@InspectorController@WebCore@@QAE_NXZ
    226230        ?setProfilerEnabled@InspectorController@WebCore@@QAEX_N@Z
     
    238242        ?lastChild@ComposedShadowTreeWalker@WebCore@@QAEXXZ
    239243        ?length@StaticNodeList@WebCore@@UBEIXZ
     244        ?localUserSpecificStorageDirectory@WebCore@@YA?AVString@WTF@@XZ
    240245        ?namedItem@StaticNodeList@WebCore@@UBEPAVNode@2@ABVAtomicString@WTF@@@Z
    241246        ?next@ComposedShadowTreeWalker@WebCore@@QAEXXZ
  • trunk/Source/WebKit/win/ChangeLog

    r150663 r150670  
     12013-05-24  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Windows] Expose database storage and cache locations via preferences.
     4        https://bugs.webkit.org/show_bug.cgi?id=116729
     5
     6        Reviewed by Tim Horton.
     7
     8        * WebDatabaseManager.cpp: Update to check preferences for the
     9        desired location of the database store.
     10        (databasesDirectory): Added.
     11        (WebKitInitializeWebDatabasesIfNecessary): Use new databasesDirectory
     12        method to determine what system path to use for file storage.
     13        * WebKit.vcproj/WebKitExports.def.in: Export three symbols
     14        needed to implement the feature.
     15        * WebView.cpp: Update to check preferences for the desired location
     16        of the various caches used by WebKit.
     17        (WebView::setCacheModel): Update to check preferences for URL cache
     18        storage.
     19        (WebKitSetApplicationCachePathIfNecessary): Update to check
     20        preferences for ccache storage.
     21
    1222013-05-24  Christophe Dumez  <ch.dumez@sisa.samsung.com>
    223
  • trunk/Source/WebKit/win/WebDatabaseManager.cpp

    r150115 r150670  
    4848using namespace WebCore;
    4949
     50static CFStringRef WebDatabaseDirectoryDefaultsKey = CFSTR("WebDatabaseDirectory");
     51
    5052static inline bool isEqual(LPCWSTR s1, LPCWSTR s2)
    5153{
     
    406408}
    407409
     410static WTF::String databasesDirectory()
     411{
     412#if USE(CF)
     413    RetainPtr<CFPropertyListRef> directoryPref = adoptCF(CFPreferencesCopyAppValue(WebDatabaseDirectoryDefaultsKey, kCFPreferencesCurrentApplication));
     414    if (directoryPref && (CFStringGetTypeID() == CFGetTypeID(directoryPref.get())))
     415        return static_cast<CFStringRef>(directoryPref.get());
     416#endif
     417
     418    return WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");
     419}
     420
    408421void WebKitInitializeWebDatabasesIfNecessary()
    409422{
     
    412425        return;
    413426
    414     WTF::String databasesDirectory = WebCore::pathByAppendingComponent(WebCore::localUserSpecificStorageDirectory(), "Databases");
    415     WebCore::DatabaseManager::manager().initialize(databasesDirectory);
     427    WebCore::DatabaseManager::manager().initialize(databasesDirectory());
    416428
    417429    initialized = true;
  • trunk/Source/WebKit/win/WebKit.vcproj/WebKitExports.def.in

    r150172 r150670  
    179179        ?create@Range@WebCore@@SA?AV?$PassRefPtr@VRange@WebCore@@@WTF@@V?$PassRefPtr@VDocument@WebCore@@@4@V?$PassRefPtr@VNode@WebCore@@@4@H1H@Z
    180180        ?create@SerializedScriptValue@WebCore@@SA?AV?$PassRefPtr@VSerializedScriptValue@WebCore@@@WTF@@ABVString@4@@Z
     181#if USE(CF)
     182        ?createCFString@String@WTF@@QBE?AV?$RetainPtr@PBU__CFString@@@2@XZ
     183#endif
    181184        ?createShadowRoot@Element@WebCore@@QAE?AV?$PassRefPtr@VShadowRoot@WebCore@@@WTF@@AAH@Z
    182185        ?createWrapper@WebCore@@YA?AVJSValue@JSC@@PAVExecState@3@PAVJSDOMGlobalObject@1@PAVNode@1@@Z
     
    223226        ?windowObjectCleared@InspectorFrontendClientLocal@WebCore@@UAEXXZ
    224227        ?setResourcesDataSizeLimitsFromInternals@InspectorController@WebCore@@QAEXHH@Z
     228        ?pathByAppendingComponent@WebCore@@YA?AVString@WTF@@ABV23@0@Z
    225229        ?profilerEnabled@InspectorController@WebCore@@QAE_NXZ
    226230        ?setProfilerEnabled@InspectorController@WebCore@@QAEX_N@Z
     
    238242        ?lastChild@ComposedShadowTreeWalker@WebCore@@QAEXXZ
    239243        ?length@StaticNodeList@WebCore@@UBEIXZ
     244        ?localUserSpecificStorageDirectory@WebCore@@YA?AVString@WTF@@XZ
    240245        ?namedItem@StaticNodeList@WebCore@@UBEPAVNode@2@ABVAtomicString@WTF@@@Z
    241246        ?next@ComposedShadowTreeWalker@WebCore@@QAEXXZ
  • trunk/Source/WebKit/win/WebView.cpp

    r150663 r150670  
    196196static HashSet<WebView*> pendingDeleteBackingStoreSet;
    197197
     198static CFStringRef WebKitLocalCacheDefaultsKey = CFSTR("WebKitLocalCache");
     199
    198200static String webKitVersionString();
    199201
     
    479481    RetainPtr<CFURLCacheRef> cfurlCache = adoptCF(CFURLCacheCopySharedURLCache());
    480482    RetainPtr<CFStringRef> cfurlCacheDirectory = adoptCF(wkCopyFoundationCacheDirectory(0));
    481     if (!cfurlCacheDirectory)
    482         cfurlCacheDirectory = WebCore::localUserSpecificStorageDirectory().createCFString();
     483    if (!cfurlCacheDirectory) {
     484        RetainPtr<CFPropertyListRef> preference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, kCFPreferencesCurrentApplication));
     485        if (preference && (CFStringGetTypeID() == CFGetTypeID(preference.get())))
     486            cfurlCacheDirectory = adoptCF(static_cast<CFStringRef>(preference.leakRef()));
     487        else
     488            cfurlCacheDirectory = WebCore::localUserSpecificStorageDirectory().createCFString();
     489    }
    483490
    484491    // As a fudge factor, use 1000 instead of 1024, in case the reported byte
     
    25982605
    25992606    String path = localUserSpecificStorageDirectory();
     2607
     2608#if USE(CF)
     2609    RetainPtr<CFPropertyListRef> cacheDirectoryPreference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, kCFPreferencesCurrentApplication));
     2610    if (cacheDirectoryPreference && (CFStringGetTypeID() == CFGetTypeID(cacheDirectoryPreference.get())))
     2611        path = static_cast<CFStringRef>(cacheDirectoryPreference.get());
     2612#endif
     2613
    26002614    if (!path.isNull())
    26012615        cacheStorage().setCacheDirectory(path);
  • trunk/Tools/ChangeLog

    r150663 r150670  
     12013-05-24  Brent Fulgham  <bfulgham@apple.com>
     2
     3        [Windows] Expose database storage and cache locations via preferences.
     4        https://bugs.webkit.org/show_bug.cgi?id=116729
     5
     6        Reviewed by Tim Horton.
     7
     8        Update DumpRenderTree to use CFPreferences to control where WebKit
     9        stores its local databases, URL caches, etc.
     10
     11        * DumpRenderTree/win/DumpRenderTree.cpp:
     12        (libraryPathForDumpRenderTree): Added.
     13        (dllLauncherEntryPoint): Set up DRT-specific cache locations.
     14        * Scripts/webkitpy/port/base.py:
     15        (Port._driver_tempdir): Added (to allow port-specific overload).
     16        (Port._driver_tempdir_for_environment): Ditto
     17        * Scripts/webkitpy/port/driver.py:
     18        (Driver._setup_environ_for_driver): Use new overload to set
     19        environment variable.
     20        (Driver._start): Use new overload for temp directory location.
     21        * Scripts/webkitpy/port/win.py:
     22        (WinPort._driver_tempdir_for_environment): New overload to supply
     23        Windows path to DumpRenderTree environment (while still using
     24        cygwin paths for internal operations.
     25
    1262013-05-24  Christophe Dumez  <ch.dumez@sisa.samsung.com>
    227
  • trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp

    r149855 r150670  
    5555#include <windows.h>
    5656#include <CoreFoundation/CoreFoundation.h>
     57#include <WebCore/FileSystem.h>
    5758#include <WebKit/WebKit.h>
    5859#include <WebKit/WebKitCOMAPI.h>
    5960
    6061#if USE(CFNETWORK)
     62#include <CFNetwork/CFHTTPCookiesPriv.h>
    6163#include <CFNetwork/CFURLCachePriv.h>
    62 #endif
    63 
    64 #if USE(CFNETWORK)
    65 #include <CFNetwork/CFHTTPCookiesPriv.h>
    6664#endif
    6765
     
    7573
    7674static LPCWSTR fontsEnvironmentVariable = L"WEBKIT_TESTFONTS";
     75static LPCWSTR dumpRenderTreeTemp = L"DUMPRENDERTREE_TEMP";
    7776#define USE_MAC_FONTS
     77
     78static CFStringRef WebDatabaseDirectoryDefaultsKey = CFSTR("WebDatabaseDirectory");
     79static CFStringRef WebKitLocalCacheDefaultsKey = CFSTR("WebKitLocalCache");
     80static CFStringRef WebStorageDirectoryDefaultsKey = CFSTR("WebKitLocalStorageDatabasePathPreferenceKey");
    7881
    7982const LPCWSTR kDumpRenderTreeClassName = L"DumpRenderTreeWindow";
     
    191194    return string(utf8Vector.data(), utf8Vector.size() - 1);
    192195}
     196
     197#if USE(CF)
     198static String libraryPathForDumpRenderTree()
     199{
     200    DWORD size = ::GetEnvironmentVariable(dumpRenderTreeTemp, 0, 0);
     201    Vector<TCHAR> buffer(size);
     202    if (::GetEnvironmentVariable(dumpRenderTreeTemp, buffer.data(), buffer.size())) {
     203        wstring path = buffer.data();
     204        if (!path.empty() && (path[path.length() - 1] != L'\\'))
     205            path.append(L"\\");
     206        return String (path.data(), path.length());
     207    }
     208
     209    return WebCore::localUserSpecificStorageDirectory();
     210}
     211#endif
    193212
    194213string toUTF8(BSTR bstr)
     
    12761295    }
    12771296
     1297#if USE(CF)
     1298    // Set up these values before creating the WebView so that the various initializations will see these preferred values.
     1299    String path = libraryPathForDumpRenderTree();
     1300    CFPreferencesSetAppValue(WebDatabaseDirectoryDefaultsKey, WebCore::pathByAppendingComponent(path, "Databases").createCFString().get(), kCFPreferencesCurrentApplication);
     1301    CFPreferencesSetAppValue(WebStorageDirectoryDefaultsKey, WebCore::pathByAppendingComponent(path, "LocalStorage").createCFString().get(), kCFPreferencesCurrentApplication);
     1302    CFPreferencesSetAppValue(WebKitLocalCacheDefaultsKey, WebCore::pathByAppendingComponent(path, "LocalCache").createCFString().get(), kCFPreferencesCurrentApplication);
     1303#endif
     1304
    12781305    COMPtr<IWebView> webView(AdoptCOM, createWebViewAndOffscreenWindow(&webViewWindow));
    12791306    if (!webView)
  • trunk/Tools/Scripts/webkitpy/port/base.py

    r150128 r150670  
    12661266        return self._build_path(self.driver_name())
    12671267
     1268    def _driver_tempdir(self):
     1269        return self._filesystem.mkdtemp(prefix='%s-' % self.driver_name())
     1270
     1271    def _driver_tempdir_for_environment(self):
     1272        return self._driver_tempdir()
     1273
    12681274    def _path_to_webcore_library(self):
    12691275        """Returns the full path to a built copy of WebCore."""
  • trunk/Tools/Scripts/webkitpy/port/driver.py

    r150416 r150670  
    285285        environment['DYLD_FRAMEWORK_PATH'] = self._port._build_path()
    286286        # FIXME: We're assuming that WebKitTestRunner checks this DumpRenderTree-named environment variable.
    287         environment['DUMPRENDERTREE_TEMP'] = str(self._driver_tempdir)
     287        environment['DUMPRENDERTREE_TEMP'] = str(self._port._driver_tempdir_for_environment())
    288288        environment['LOCAL_RESOURCE_ROOT'] = self._port.layout_tests_dir()
    289289        if 'WEBKITOUTPUTDIR' in os.environ:
     
    295295    def _start(self, pixel_tests, per_test_args):
    296296        self.stop()
    297         self._driver_tempdir = self._port._filesystem.mkdtemp(prefix='%s-' % self._port.driver_name())
     297        self._driver_tempdir = self._port._driver_tempdir()
    298298        server_name = self._port.driver_name()
    299299        environment = self._port.setup_environ_for_server(server_name)
  • trunk/Tools/Scripts/webkitpy/port/win.py

    r150619 r150670  
    3333from webkitpy.common.system.systemhost import SystemHost
    3434from webkitpy.common.system.executive import ScriptError, Executive
    35 from webkitpy.common.system.path import abspath_to_uri
     35from webkitpy.common.system.path import abspath_to_uri, cygpath
    3636from webkitpy.port.apple import ApplePort
    3737
     
    116116    def default_child_processes(self):
    117117        return 1
     118
     119    def _driver_tempdir_for_environment(self):
     120        return cygpath(self._driver_tempdir())
Note: See TracChangeset for help on using the changeset viewer.