<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[162623] trunk</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/162623">162623</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2014-01-23 10:20:38 -0800 (Thu, 23 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Curl] There is no way to specify cache folder.
https://bugs.webkit.org/show_bug.cgi?id=125028
Patch by peavo@outlook.com <peavo@outlook.com> on 2014-01-23
Reviewed by Brent Fulgham.
Source/WebCore:
Fixed logical test, disc cache should be disabled if creating cache folder fails.
* platform/network/curl/CurlCacheManager.cpp:
(WebCore::CurlCacheManager::setCacheDirectory):
Source/WebKit/win:
Added interface methods to set and get cache folder location.
* Interfaces/IWebCache.idl:
* WebCache.cpp:
(WebCache::disabled):
(WebCache::cacheFolder):
(WebCache::setCacheFolder):
* WebCache.h:
Tools:
Enable disc cache in WinLauncher by setting cache folder location.
* WinLauncher/WinLauncher.cpp:
(getAppDataFolder): Added function to get app data folder.
(setCacheFolder): Added function to set cache folder.
(createCrashReport): Use new getAppDataFolder function.
(wWinMain): Use function setCacheFolder to set cache folder location.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformnetworkcurlCurlCacheManagercpp">trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp</a></li>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinInterfacesIWebCacheidl">trunk/Source/WebKit/win/Interfaces/IWebCache.idl</a></li>
<li><a href="#trunkSourceWebKitwinWebCachecpp">trunk/Source/WebKit/win/WebCache.cpp</a></li>
<li><a href="#trunkSourceWebKitwinWebCacheh">trunk/Source/WebKit/win/WebCache.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsWinLauncherWinLaunchercpp">trunk/Tools/WinLauncher/WinLauncher.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (162622 => 162623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2014-01-23 18:15:55 UTC (rev 162622)
+++ trunk/Source/WebCore/ChangeLog        2014-01-23 18:20:38 UTC (rev 162623)
</span><span class="lines">@@ -1,3 +1,15 @@
</span><ins>+2014-01-23 peavo@outlook.com <peavo@outlook.com>
+
+ [Curl] There is no way to specify cache folder.
+ https://bugs.webkit.org/show_bug.cgi?id=125028
+
+ Reviewed by Brent Fulgham.
+
+ Fixed logical test, disc cache should be disabled if creating cache folder fails.
+
+ * platform/network/curl/CurlCacheManager.cpp:
+ (WebCore::CurlCacheManager::setCacheDirectory):
+
</ins><span class="cx"> 2014-01-23 Brady Eidson <beidson@apple.com>
</span><span class="cx">
</span><span class="cx"> Unreviewed build fix.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformnetworkcurlCurlCacheManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp (162622 => 162623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp        2014-01-23 18:15:55 UTC (rev 162622)
+++ trunk/Source/WebCore/platform/network/curl/CurlCacheManager.cpp        2014-01-23 18:20:38 UTC (rev 162623)
</span><span class="lines">@@ -73,7 +73,7 @@
</span><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> if (!fileExists(m_cacheDir)) {
</span><del>- if (makeAllDirectories(m_cacheDir)) {
</del><ins>+ if (!makeAllDirectories(m_cacheDir)) {
</ins><span class="cx"> LOG(Network, "Cache Error: Could not open or create cache directory! CacheManager disabled.\n");
</span><span class="cx"> m_disabled = true;
</span><span class="cx"> return;
</span></span></pre></div>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (162622 => 162623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2014-01-23 18:15:55 UTC (rev 162622)
+++ trunk/Source/WebKit/win/ChangeLog        2014-01-23 18:20:38 UTC (rev 162623)
</span><span class="lines">@@ -1,3 +1,19 @@
</span><ins>+2014-01-23 peavo@outlook.com <peavo@outlook.com>
+
+ [Curl] There is no way to specify cache folder.
+ https://bugs.webkit.org/show_bug.cgi?id=125028
+
+ Reviewed by Brent Fulgham.
+
+ Added interface methods to set and get cache folder location.
+
+ * Interfaces/IWebCache.idl:
+ * WebCache.cpp:
+ (WebCache::disabled):
+ (WebCache::cacheFolder):
+ (WebCache::setCacheFolder):
+ * WebCache.h:
+
</ins><span class="cx"> 2014-01-21 peavo@outlook.com <peavo@outlook.com>
</span><span class="cx">
</span><span class="cx"> [WinCairo][Curl] Download request has incorrect user agent string.
</span></span></pre></div>
<a id="trunkSourceWebKitwinInterfacesIWebCacheidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/Interfaces/IWebCache.idl (162622 => 162623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/Interfaces/IWebCache.idl        2014-01-23 18:15:55 UTC (rev 162622)
+++ trunk/Source/WebKit/win/Interfaces/IWebCache.idl        2014-01-23 18:20:38 UTC (rev 162623)
</span><span class="lines">@@ -41,4 +41,6 @@
</span><span class="cx"> HRESULT empty();
</span><span class="cx"> HRESULT setDisabled([in] BOOL disabled);
</span><span class="cx"> HRESULT disabled([out, retval] BOOL*);
</span><ins>+ HRESULT cacheFolder([out, retval] BSTR* location);
+ HRESULT setCacheFolder([in] BSTR location);
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebCache.cpp (162622 => 162623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebCache.cpp        2014-01-23 18:15:55 UTC (rev 162622)
+++ trunk/Source/WebKit/win/WebCache.cpp        2014-01-23 18:20:38 UTC (rev 162623)
</span><span class="lines">@@ -29,9 +29,14 @@
</span><span class="cx">
</span><span class="cx"> #include "CFDictionaryPropertyBag.h"
</span><span class="cx"> #include <WebCore/ApplicationCacheStorage.h>
</span><ins>+#include <WebCore/BString.h>
</ins><span class="cx"> #include <WebCore/MemoryCache.h>
</span><span class="cx"> #include <WebCore/CrossOriginPreflightResultCache.h>
</span><span class="cx">
</span><ins>+#if USE(CURL)
+#include <WebCore/CurlCacheManager.h>
+#endif
+
</ins><span class="cx"> // WebCache ---------------------------------------------------------------------------
</span><span class="cx">
</span><span class="cx"> WebCache::WebCache()
</span><span class="lines">@@ -229,3 +234,25 @@
</span><span class="cx"> *disabled = WebCore::memoryCache()->disabled();
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><ins>+
+HRESULT WebCache::cacheFolder(BSTR* location)
+{
+#if USE(CURL)
+ String cacheFolder = WebCore::CurlCacheManager::getInstance().getCacheDirectory();
+ *location = WebCore::BString(cacheFolder).release();
+ return S_OK;
+#else
+ return E_NOTIMPL;
+#endif
+}
+
+HRESULT WebCache::setCacheFolder(BSTR location)
+{
+#if USE(CURL)
+ String cacheFolder(location, SysStringLen(location));
+ WebCore::CurlCacheManager::getInstance().setCacheDirectory(cacheFolder);
+ return S_OK;
+#else
+ return E_NOTIMPL;
+#endif
+}
</ins></span></pre></div>
<a id="trunkSourceWebKitwinWebCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebCache.h (162622 => 162623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebCache.h        2014-01-23 18:15:55 UTC (rev 162622)
+++ trunk/Source/WebKit/win/WebCache.h        2014-01-23 18:20:38 UTC (rev 162623)
</span><span class="lines">@@ -47,7 +47,7 @@
</span><span class="cx"> /* [in][out] */ int* count,
</span><span class="cx"> /* [retval][out] */ IPropertyBag **s);
</span><span class="cx">
</span><del>- virtual HRESULT STDMETHODCALLTYPE empty( void);
</del><ins>+ virtual HRESULT STDMETHODCALLTYPE empty(void);
</ins><span class="cx">
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE setDisabled(
</span><span class="cx"> /* [in] */ BOOL disabled);
</span><span class="lines">@@ -55,6 +55,10 @@
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE disabled(
</span><span class="cx"> /* [out][retval] */ BOOL*);
</span><span class="cx">
</span><ins>+ virtual HRESULT STDMETHODCALLTYPE cacheFolder(/* [out, retval] */ BSTR* location);
+
+ virtual HRESULT STDMETHODCALLTYPE setCacheFolder(/* [in] */ BSTR location);
+
</ins><span class="cx"> protected:
</span><span class="cx"> ULONG m_refCount;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (162622 => 162623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2014-01-23 18:15:55 UTC (rev 162622)
+++ trunk/Tools/ChangeLog        2014-01-23 18:20:38 UTC (rev 162623)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2014-01-23 peavo@outlook.com <peavo@outlook.com>
+
+ [Curl] There is no way to specify cache folder.
+ https://bugs.webkit.org/show_bug.cgi?id=125028
+
+ Reviewed by Brent Fulgham.
+
+ Enable disc cache in WinLauncher by setting cache folder location.
+
+ * WinLauncher/WinLauncher.cpp:
+ (getAppDataFolder): Added function to get app data folder.
+ (setCacheFolder): Added function to set cache folder.
+ (createCrashReport): Use new getAppDataFolder function.
+ (wWinMain): Use function setCacheFolder to set cache folder location.
+
</ins><span class="cx"> 2014-01-23 Daniel Bates <dabates@apple.com>
</span><span class="cx">
</span><span class="cx"> build-webkit --sdk=iphonesimulator doesn't think it's building iOS
</span></span></pre></div>
<a id="trunkToolsWinLauncherWinLaunchercpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/WinLauncher/WinLauncher.cpp (162622 => 162623)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/WinLauncher/WinLauncher.cpp        2014-01-23 18:15:55 UTC (rev 162622)
+++ trunk/Tools/WinLauncher/WinLauncher.cpp        2014-01-23 18:20:38 UTC (rev 162623)
</span><span class="lines">@@ -77,6 +77,7 @@
</span><span class="cx"> typedef _com_ptr_t<_com_IIID<IWebPreferencesPrivate, &__uuidof(IWebPreferencesPrivate)>> IWebPreferencesPrivatePtr;
</span><span class="cx"> typedef _com_ptr_t<_com_IIID<IWebView, &__uuidof(IWebView)>> IWebViewPtr;
</span><span class="cx"> typedef _com_ptr_t<_com_IIID<IWebViewPrivate, &__uuidof(IWebViewPrivate)>> IWebViewPrivatePtr;
</span><ins>+typedef _com_ptr_t<_com_IIID<IWebCache, &__uuidof(IWebCache)>> IWebCachePtr;
</ins><span class="cx">
</span><span class="cx"> // Global Variables:
</span><span class="cx"> HINSTANCE hInst; // current instance
</span><span class="lines">@@ -390,6 +391,21 @@
</span><span class="cx"> return TRUE;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static bool getAppDataFolder(_bstr_t& directory)
+{
+ wchar_t appDataDirectory[MAX_PATH];
+ if (FAILED(SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, 0, 0, appDataDirectory)))
+ return false;
+
+ wchar_t executablePath[MAX_PATH];
+ ::GetModuleFileNameW(0, executablePath, MAX_PATH);
+ ::PathRemoveExtensionW(executablePath);
+
+ directory = _bstr_t(appDataDirectory) + L"\\" + ::PathFindFileNameW(executablePath);
+
+ return true;
+}
+
</ins><span class="cx"> static bool setToDefaultPreferences()
</span><span class="cx"> {
</span><span class="cx"> HRESULT hr = gStandardPreferences->QueryInterface(IID_IWebPreferencesPrivate, reinterpret_cast<void**>(&gPrefsPrivate.GetInterfacePtr()));
</span><span class="lines">@@ -416,18 +432,32 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static bool setCacheFolder()
+{
+ IWebCachePtr webCache;
+
+ HRESULT hr = WebKitCreateInstance(CLSID_WebCache, 0, __uuidof(webCache), reinterpret_cast<void**>(&webCache.GetInterfacePtr()));
+ if (FAILED(hr))
+ return false;
+
+ _bstr_t appDataFolder;
+ if (!getAppDataFolder(appDataFolder))
+ return false;
+
+ appDataFolder += L"\\cache";
+ webCache->setCacheFolder(appDataFolder);
+
+ return true;
+}
+
</ins><span class="cx"> void createCrashReport(EXCEPTION_POINTERS* exceptionPointers)
</span><span class="cx"> {
</span><del>- wchar_t appDataDirectory[MAX_PATH];
- if (FAILED(SHGetFolderPathW(0, CSIDL_LOCAL_APPDATA | CSIDL_FLAG_CREATE, 0, 0, appDataDirectory)))
</del><ins>+ _bstr_t directory;
+
+ if (!getAppDataFolder(directory))
</ins><span class="cx"> return;
</span><span class="cx">
</span><del>- wchar_t executablePath[MAX_PATH];
- ::GetModuleFileNameW(0, executablePath, MAX_PATH);
- ::PathRemoveExtensionW(executablePath);
-
- std::wstring directory = std::wstring(appDataDirectory) + L"\\" + PathFindFileNameW(executablePath);
- if (::SHCreateDirectoryEx(0, directory.c_str(), 0) != ERROR_SUCCESS
</del><ins>+ if (::SHCreateDirectoryEx(0, directory, 0) != ERROR_SUCCESS
</ins><span class="cx"> && ::GetLastError() != ERROR_FILE_EXISTS
</span><span class="cx"> && ::GetLastError() != ERROR_ALREADY_EXISTS)
</span><span class="cx"> return;
</span><span class="lines">@@ -548,6 +578,9 @@
</span><span class="cx"> if (FAILED(hr))
</span><span class="cx"> goto exit;
</span><span class="cx">
</span><ins>+ if (!setCacheFolder())
+ goto exit;
+
</ins><span class="cx"> gWebHost = new WinLauncherWebHost();
</span><span class="cx"> gWebHost->AddRef();
</span><span class="cx"> hr = gWebView->setFrameLoadDelegate(gWebHost);
</span></span></pre>
</div>
</div>
</body>
</html>