<!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>[207067] 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/207067">207067</a></dd>
<dt>Author</dt> <dd>pvollan@apple.com</dd>
<dt>Date</dt> <dd>2016-10-11 01:35:46 -0700 (Tue, 11 Oct 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[Win] Parallel DRTs are sharing preferences and cache.
https://bugs.webkit.org/show_bug.cgi?id=163013
Reviewed by Brent Fulgham.
Source/WebKit/win:
Make it possible for a WebKit client to use separate preferences and cache.
* Interfaces/IWebPreferencesPrivate.idl:
* WebApplicationCache.cpp:
(applicationCachePath):
* WebCache.cpp:
(WebCache::cacheFolder):
(WebCache::setCacheFolder):
* WebDatabaseManager.cpp:
(databasesDirectory):
* WebPreferences.cpp:
(WebPreferences::applicationId):
(WebPreferences::valueForKey):
(WebPreferences::setValueForKey):
(WebPreferences::save):
(WebPreferences::QueryInterface):
(WebPreferences::modernMediaControlsEnabled):
(WebPreferences::setApplicationId):
* WebPreferences.h:
* WebView.cpp:
(WebView::setCacheModel):
Tools:
Use separate cache and preferences for each DRT instance.
* DumpRenderTree/win/DumpRenderTree.cpp:
(applicationId):
(setApplicationId):
(setCacheFolder):
(setDefaultsToConsistentValuesForTesting):
* Scripts/webkitpy/port/win.py:
(WinPort.setup_test_run):</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitwinChangeLog">trunk/Source/WebKit/win/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitwinInterfacesIWebPreferencesPrivateidl">trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl</a></li>
<li><a href="#trunkSourceWebKitwinWebApplicationCachecpp">trunk/Source/WebKit/win/WebApplicationCache.cpp</a></li>
<li><a href="#trunkSourceWebKitwinWebCachecpp">trunk/Source/WebKit/win/WebCache.cpp</a></li>
<li><a href="#trunkSourceWebKitwinWebDatabaseManagercpp">trunk/Source/WebKit/win/WebDatabaseManager.cpp</a></li>
<li><a href="#trunkSourceWebKitwinWebPreferencescpp">trunk/Source/WebKit/win/WebPreferences.cpp</a></li>
<li><a href="#trunkSourceWebKitwinWebPreferencesh">trunk/Source/WebKit/win/WebPreferences.h</a></li>
<li><a href="#trunkSourceWebKitwinWebViewcpp">trunk/Source/WebKit/win/WebView.cpp</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsDumpRenderTreewinDumpRenderTreecpp">trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp</a></li>
<li><a href="#trunkToolsScriptswebkitpyportwinpy">trunk/Tools/Scripts/webkitpy/port/win.py</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitwinChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/ChangeLog (207066 => 207067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/ChangeLog        2016-10-11 08:30:37 UTC (rev 207066)
+++ trunk/Source/WebKit/win/ChangeLog        2016-10-11 08:35:46 UTC (rev 207067)
</span><span class="lines">@@ -1,3 +1,32 @@
</span><ins>+2016-10-11 Per Arne Vollan <pvollan@apple.com>
+
+ [Win] Parallel DRTs are sharing preferences and cache.
+ https://bugs.webkit.org/show_bug.cgi?id=163013
+
+ Reviewed by Brent Fulgham.
+
+ Make it possible for a WebKit client to use separate preferences and cache.
+
+ * Interfaces/IWebPreferencesPrivate.idl:
+ * WebApplicationCache.cpp:
+ (applicationCachePath):
+ * WebCache.cpp:
+ (WebCache::cacheFolder):
+ (WebCache::setCacheFolder):
+ * WebDatabaseManager.cpp:
+ (databasesDirectory):
+ * WebPreferences.cpp:
+ (WebPreferences::applicationId):
+ (WebPreferences::valueForKey):
+ (WebPreferences::setValueForKey):
+ (WebPreferences::save):
+ (WebPreferences::QueryInterface):
+ (WebPreferences::modernMediaControlsEnabled):
+ (WebPreferences::setApplicationId):
+ * WebPreferences.h:
+ * WebView.cpp:
+ (WebView::setCacheModel):
+
</ins><span class="cx"> 2016-10-09 Wenson Hsieh <wenson_hsieh@apple.com>
</span><span class="cx">
</span><span class="cx"> Support InputEvent.inputType for the new InputEvent spec
</span></span></pre></div>
<a id="trunkSourceWebKitwinInterfacesIWebPreferencesPrivateidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl (207066 => 207067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl        2016-10-11 08:30:37 UTC (rev 207066)
+++ trunk/Source/WebKit/win/Interfaces/IWebPreferencesPrivate.idl        2016-10-11 08:35:46 UTC (rev 207067)
</span><span class="lines">@@ -187,3 +187,8 @@
</span><span class="cx"> HRESULT setModernMediaControlsEnabled([in] BOOL enabled);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+[uuid(F9582D72-6348-45B1-AB09-39E33459B5B9)]
+interface IWebPreferencesPrivate4 : IWebPreferencesPrivate3
+{
+ HRESULT setApplicationId([in] BSTR applicationId);
+}
</ins><span class="cx">\ No newline at end of file
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebApplicationCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebApplicationCache.cpp (207066 => 207067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebApplicationCache.cpp        2016-10-11 08:30:37 UTC (rev 207066)
+++ trunk/Source/WebKit/win/WebApplicationCache.cpp        2016-10-11 08:35:46 UTC (rev 207067)
</span><span class="lines">@@ -28,6 +28,7 @@
</span><span class="cx">
</span><span class="cx"> #include "CFDictionaryPropertyBag.h"
</span><span class="cx"> #include "MarshallingHelpers.h"
</span><ins>+#include "WebPreferences.h"
</ins><span class="cx"> #include "WebSecurityOrigin.h"
</span><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="cx"> #include <WebCore/ApplicationCache.h>
</span><span class="lines">@@ -68,7 +69,7 @@
</span><span class="cx"> String path = localUserSpecificStorageDirectory();
</span><span class="cx">
</span><span class="cx"> #if USE(CF)
</span><del>- auto cacheDirectoryPreference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, kCFPreferencesCurrentApplication));
</del><ins>+ auto cacheDirectoryPreference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, WebPreferences::applicationId()));
</ins><span class="cx"> if (cacheDirectoryPreference && CFStringGetTypeID() == CFGetTypeID(cacheDirectoryPreference.get()))
</span><span class="cx"> path = static_cast<CFStringRef>(cacheDirectoryPreference.get());
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebCache.cpp (207066 => 207067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebCache.cpp        2016-10-11 08:30:37 UTC (rev 207066)
+++ trunk/Source/WebKit/win/WebCache.cpp        2016-10-11 08:35:46 UTC (rev 207067)
</span><span class="lines">@@ -35,8 +35,13 @@
</span><span class="cx">
</span><span class="cx"> #if USE(CURL)
</span><span class="cx"> #include <WebCore/CurlCacheManager.h>
</span><ins>+#elif USE(CFNETWORK)
+#include <CFNetwork/CFURLCachePriv.h>
+#include <WebKitSystemInterface/WebKitSystemInterface.h>
</ins><span class="cx"> #endif
</span><span class="cx">
</span><ins>+using namespace WebCore;
+
</ins><span class="cx"> // WebCache ---------------------------------------------------------------------------
</span><span class="cx">
</span><span class="cx"> WebCache::WebCache()
</span><span class="lines">@@ -243,8 +248,10 @@
</span><span class="cx"> String cacheFolder = WebCore::CurlCacheManager::getInstance().cacheDirectory();
</span><span class="cx"> *location = WebCore::BString(cacheFolder).release();
</span><span class="cx"> return S_OK;
</span><del>-#else
- return E_NOTIMPL;
</del><ins>+#elif USE(CFNETWORK)
+ RetainPtr<CFStringRef> cfurlCacheDirectory = adoptCF(wkCopyFoundationCacheDirectory(0));
+ *location = BString(cfurlCacheDirectory.get()).release();
+ return S_OK;
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -254,7 +261,12 @@
</span><span class="cx"> String cacheFolder(location, SysStringLen(location));
</span><span class="cx"> WebCore::CurlCacheManager::getInstance().setCacheDirectory(cacheFolder);
</span><span class="cx"> return S_OK;
</span><del>-#else
- return E_NOTIMPL;
</del><ins>+#elif USE(CFNETWORK)
+ RetainPtr<CFURLCacheRef> cache = adoptCF(CFURLCacheCopySharedURLCache());
+ CFIndex memoryCapacity = CFURLCacheMemoryCapacity(cache.get());
+ CFIndex diskCapacity = CFURLCacheDiskCapacity(cache.get());
+ RetainPtr<CFURLCacheRef> newCache = adoptCF(CFURLCacheCreate(kCFAllocatorDefault, memoryCapacity, diskCapacity, String(location).createCFString().get()));
+ CFURLCacheSetSharedURLCache(newCache.get());
+ return S_OK;
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebDatabaseManagercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebDatabaseManager.cpp (207066 => 207067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebDatabaseManager.cpp        2016-10-11 08:30:37 UTC (rev 207066)
+++ trunk/Source/WebKit/win/WebDatabaseManager.cpp        2016-10-11 08:35:46 UTC (rev 207067)
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include "COMPropertyBag.h"
</span><span class="cx"> #include "MarshallingHelpers.h"
</span><span class="cx"> #include "WebNotificationCenter.h"
</span><ins>+#include "WebPreferences.h"
</ins><span class="cx"> #include "WebSecurityOrigin.h"
</span><span class="cx">
</span><span class="cx"> #include <WebCore/BString.h>
</span><span class="lines">@@ -420,7 +421,7 @@
</span><span class="cx"> static WTF::String databasesDirectory()
</span><span class="cx"> {
</span><span class="cx"> #if USE(CF)
</span><del>- RetainPtr<CFPropertyListRef> directoryPref = adoptCF(CFPreferencesCopyAppValue(WebDatabaseDirectoryDefaultsKey, kCFPreferencesCurrentApplication));
</del><ins>+ RetainPtr<CFPropertyListRef> directoryPref = adoptCF(CFPreferencesCopyAppValue(WebDatabaseDirectoryDefaultsKey, WebPreferences::applicationId()));
</ins><span class="cx"> if (directoryPref && (CFStringGetTypeID() == CFGetTypeID(directoryPref.get())))
</span><span class="cx"> return static_cast<CFStringRef>(directoryPref.get());
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebKitwinWebPreferencescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebPreferences.cpp (207066 => 207067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebPreferences.cpp        2016-10-11 08:30:37 UTC (rev 207066)
+++ trunk/Source/WebKit/win/WebPreferences.cpp        2016-10-11 08:35:46 UTC (rev 207067)
</span><span class="lines">@@ -101,6 +101,8 @@
</span><span class="cx">
</span><span class="cx"> static CFDictionaryRef defaultSettings;
</span><span class="cx">
</span><ins>+RetainPtr<CFStringRef> WebPreferences::m_applicationId = kCFPreferencesCurrentApplication;
+
</ins><span class="cx"> static HashMap<WTF::String, COMPtr<WebPreferences>>& webPreferencesInstances()
</span><span class="cx"> {
</span><span class="cx"> static NeverDestroyed<HashMap<WTF::String, COMPtr<WebPreferences>>> webPreferencesInstances;
</span><span class="lines">@@ -183,6 +185,11 @@
</span><span class="cx"> webPreferencesInstances().remove(identifierString);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+CFStringRef WebPreferences::applicationId()
+{
+ return m_applicationId.get();
+}
+
</ins><span class="cx"> void WebPreferences::initializeDefaultSettings()
</span><span class="cx"> {
</span><span class="cx"> if (defaultSettings)
</span><span class="lines">@@ -306,7 +313,7 @@
</span><span class="cx"> if (value)
</span><span class="cx"> return value;
</span><span class="cx">
</span><del>- value = adoptCF(CFPreferencesCopyAppValue(key, kCFPreferencesCurrentApplication));
</del><ins>+ value = adoptCF(CFPreferencesCopyAppValue(key, applicationId()));
</ins><span class="cx"> if (value)
</span><span class="cx"> return value;
</span><span class="cx">
</span><span class="lines">@@ -317,7 +324,7 @@
</span><span class="cx"> {
</span><span class="cx"> CFDictionarySetValue(m_privatePrefs.get(), key, value);
</span><span class="cx"> if (m_autoSaves) {
</span><del>- CFPreferencesSetAppValue(key, value, kCFPreferencesCurrentApplication);
</del><ins>+ CFPreferencesSetAppValue(key, value, applicationId());
</ins><span class="cx"> save();
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="lines">@@ -448,7 +455,7 @@
</span><span class="cx">
</span><span class="cx"> void WebPreferences::save()
</span><span class="cx"> {
</span><del>- CFPreferencesAppSynchronize(kCFPreferencesCurrentApplication);
</del><ins>+ CFPreferencesAppSynchronize(applicationId());
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebPreferences::load()
</span><span class="lines">@@ -540,6 +547,8 @@
</span><span class="cx"> *ppvObject = static_cast<IWebPreferencesPrivate2*>(this);
</span><span class="cx"> else if (IsEqualGUID(riid, IID_IWebPreferencesPrivate3))
</span><span class="cx"> *ppvObject = static_cast<IWebPreferencesPrivate3*>(this);
</span><ins>+ else if (IsEqualGUID(riid, IID_IWebPreferencesPrivate4))
+ *ppvObject = static_cast<IWebPreferencesPrivate4*>(this);
</ins><span class="cx"> else if (IsEqualGUID(riid, CLSID_WebPreferences))
</span><span class="cx"> *ppvObject = this;
</span><span class="cx"> else
</span><span class="lines">@@ -1993,3 +2002,9 @@
</span><span class="cx"> *enabled = boolValueForKey(WebKitModernMediaControlsEnabledPreferenceKey);
</span><span class="cx"> return S_OK;
</span><span class="cx"> }
</span><ins>+
+HRESULT WebPreferences::setApplicationId(BSTR applicationId)
+{
+ m_applicationId = String(applicationId).createCFString();
+ return S_OK;
+}
</ins></span></pre></div>
<a id="trunkSourceWebKitwinWebPreferencesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebPreferences.h (207066 => 207067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebPreferences.h        2016-10-11 08:30:37 UTC (rev 207066)
+++ trunk/Source/WebKit/win/WebPreferences.h        2016-10-11 08:35:46 UTC (rev 207067)
</span><span class="lines">@@ -23,8 +23,7 @@
</span><span class="cx"> * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx"> */
</span><span class="cx">
</span><del>-#ifndef WebPreferences_H
-#define WebPreferences_H
</del><ins>+#pragma once
</ins><span class="cx">
</span><span class="cx"> #include "WebKit.h"
</span><span class="cx"> #include <CoreFoundation/CoreFoundation.h>
</span><span class="lines">@@ -31,7 +30,7 @@
</span><span class="cx"> #include <WebCore/BString.h>
</span><span class="cx"> #include <wtf/RetainPtr.h>
</span><span class="cx">
</span><del>-class WebPreferences : public IWebPreferences, public IWebPreferencesPrivate3 {
</del><ins>+class WebPreferences : public IWebPreferences, public IWebPreferencesPrivate4 {
</ins><span class="cx"> public:
</span><span class="cx"> static WebPreferences* createInstance();
</span><span class="cx"> protected:
</span><span class="lines">@@ -244,6 +243,9 @@
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE modernMediaControlsEnabled(_Out_ BOOL*);
</span><span class="cx"> virtual HRESULT STDMETHODCALLTYPE setModernMediaControlsEnabled(BOOL);
</span><span class="cx">
</span><ins>+ // IWebPreferencesPrivate4
+ virtual HRESULT STDMETHODCALLTYPE setApplicationId(BSTR);
+
</ins><span class="cx"> // WebPreferences
</span><span class="cx">
</span><span class="cx"> // This method accesses a different preference key than developerExtrasEnabled.
</span><span class="lines">@@ -257,6 +259,8 @@
</span><span class="cx"> static void removeReferenceForIdentifier(BSTR identifier);
</span><span class="cx"> static WebPreferences* sharedStandardPreferences();
</span><span class="cx">
</span><ins>+ static CFStringRef applicationId();
+
</ins><span class="cx"> // From WebHistory.h
</span><span class="cx"> HRESULT historyItemLimit(_Out_ int*);
</span><span class="cx"> HRESULT setHistoryItemLimit(int);
</span><span class="lines">@@ -263,8 +267,8 @@
</span><span class="cx"> HRESULT historyAgeInDaysLimit(_Out_ int*);
</span><span class="cx"> HRESULT setHistoryAgeInDaysLimit(int);
</span><span class="cx">
</span><del>- void willAddToWebView();
- void didRemoveFromWebView();
</del><ins>+ void willAddToWebView();
+ void didRemoveFromWebView();
</ins><span class="cx">
</span><span class="cx"> HRESULT postPreferencesChangesNotification();
</span><span class="cx">
</span><span class="lines">@@ -297,6 +301,5 @@
</span><span class="cx"> bool m_autoSaves { false };
</span><span class="cx"> bool m_automaticallyDetectsCacheModel { true };
</span><span class="cx"> unsigned m_numWebViews { 0 };
</span><ins>+ static RetainPtr<CFStringRef> m_applicationId;
</ins><span class="cx"> };
</span><del>-
-#endif
</del></span></pre></div>
<a id="trunkSourceWebKitwinWebViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/win/WebView.cpp (207066 => 207067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/win/WebView.cpp        2016-10-11 08:30:37 UTC (rev 207066)
+++ trunk/Source/WebKit/win/WebView.cpp        2016-10-11 08:35:46 UTC (rev 207067)
</span><span class="lines">@@ -501,7 +501,7 @@
</span><span class="cx"> RetainPtr<CFURLCacheRef> cfurlCache = adoptCF(CFURLCacheCopySharedURLCache());
</span><span class="cx"> RetainPtr<CFStringRef> cfurlCacheDirectory = adoptCF(wkCopyFoundationCacheDirectory(0));
</span><span class="cx"> if (!cfurlCacheDirectory) {
</span><del>- RetainPtr<CFPropertyListRef> preference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, kCFPreferencesCurrentApplication));
</del><ins>+ RetainPtr<CFPropertyListRef> preference = adoptCF(CFPreferencesCopyAppValue(WebKitLocalCacheDefaultsKey, WebPreferences::applicationId()));
</ins><span class="cx"> if (preference && (CFStringGetTypeID() == CFGetTypeID(preference.get())))
</span><span class="cx"> cfurlCacheDirectory = adoptCF(static_cast<CFStringRef>(preference.leakRef()));
</span><span class="cx"> else
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (207066 => 207067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-10-11 08:30:37 UTC (rev 207066)
+++ trunk/Tools/ChangeLog        2016-10-11 08:35:46 UTC (rev 207067)
</span><span class="lines">@@ -1,3 +1,20 @@
</span><ins>+2016-10-11 Per Arne Vollan <pvollan@apple.com>
+
+ [Win] Parallel DRTs are sharing preferences and cache.
+ https://bugs.webkit.org/show_bug.cgi?id=163013
+
+ Reviewed by Brent Fulgham.
+
+ Use separate cache and preferences for each DRT instance.
+
+ * DumpRenderTree/win/DumpRenderTree.cpp:
+ (applicationId):
+ (setApplicationId):
+ (setCacheFolder):
+ (setDefaultsToConsistentValuesForTesting):
+ * Scripts/webkitpy/port/win.py:
+ (WinPort.setup_test_run):
+
</ins><span class="cx"> 2016-10-10 Zan Dobersek <zdobersek@igalia.com>
</span><span class="cx">
</span><span class="cx"> Add ENABLE_ENCRYPTED_MEDIA configuration option
</span></span></pre></div>
<a id="trunkToolsDumpRenderTreewinDumpRenderTreecpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp (207066 => 207067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp        2016-10-11 08:30:37 UTC (rev 207066)
+++ trunk/Tools/DumpRenderTree/win/DumpRenderTree.cpp        2016-10-11 08:35:46 UTC (rev 207067)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> #include <fstream>
</span><span class="cx"> #include <io.h>
</span><span class="cx"> #include <math.h>
</span><ins>+#include <shlobj.h>
</ins><span class="cx"> #include <shlwapi.h>
</span><span class="cx"> #include <tchar.h>
</span><span class="cx"> #include <wtf/NeverDestroyed.h>
</span><span class="lines">@@ -859,16 +860,52 @@
</span><span class="cx"> setAlwaysAcceptCookies(false);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static String applicationId()
+{
+ DWORD processId = ::GetCurrentProcessId();
+ return String::format("com.apple.DumpRenderTree.%d", processId);
+}
+
+static void setApplicationId()
+{
+ COMPtr<IWebPreferences> preferences;
+ if (SUCCEEDED(WebKitCreateInstance(CLSID_WebPreferences, 0, IID_IWebPreferences, (void**)&preferences))) {
+ COMPtr<IWebPreferencesPrivate4> prefsPrivate4(Query, preferences);
+ ASSERT(prefsPrivate4);
+ _bstr_t fileName = applicationId().charactersWithNullTermination().data();
+ prefsPrivate4->setApplicationId(fileName);
+ }
+}
+
+static void setCacheFolder()
+{
+ String libraryPath = libraryPathForDumpRenderTree();
+
+ COMPtr<IWebCache> webCache;
+ if (SUCCEEDED(WebKitCreateInstance(CLSID_WebCache, 0, IID_IWebCache, (void**)&webCache))) {
+ _bstr_t cacheFolder = WebCore::pathByAppendingComponent(libraryPath, "LocalCache").utf8().data();
+ webCache->setCacheFolder(cacheFolder);
+ }
+}
+
</ins><span class="cx"> // Called once on DumpRenderTree startup.
</span><span class="cx"> static void setDefaultsToConsistentValuesForTesting()
</span><span class="cx"> {
</span><span class="cx"> #if USE(CF)
</span><ins>+ // Create separate preferences for each DRT instance
+ setApplicationId();
+
+ RetainPtr<CFStringRef> appId = applicationId().createCFString();
+
</ins><span class="cx"> String libraryPath = libraryPathForDumpRenderTree();
</span><span class="cx">
</span><span class="cx"> // Set up these values before creating the WebView so that the various initializations will see these preferred values.
</span><del>- CFPreferencesSetAppValue(WebDatabaseDirectoryDefaultsKey, WebCore::pathByAppendingComponent(libraryPath, "Databases").createCFString().get(), kCFPreferencesCurrentApplication);
- CFPreferencesSetAppValue(WebStorageDirectoryDefaultsKey, WebCore::pathByAppendingComponent(libraryPath, "LocalStorage").createCFString().get(), kCFPreferencesCurrentApplication);
- CFPreferencesSetAppValue(WebKitLocalCacheDefaultsKey, WebCore::pathByAppendingComponent(libraryPath, "LocalCache").createCFString().get(), kCFPreferencesCurrentApplication);
</del><ins>+ CFPreferencesSetAppValue(WebDatabaseDirectoryDefaultsKey, WebCore::pathByAppendingComponent(libraryPath, "Databases").createCFString().get(), appId.get());
+ CFPreferencesSetAppValue(WebStorageDirectoryDefaultsKey, WebCore::pathByAppendingComponent(libraryPath, "LocalStorage").createCFString().get(), appId.get());
+ CFPreferencesSetAppValue(WebKitLocalCacheDefaultsKey, WebCore::pathByAppendingComponent(libraryPath, "LocalCache").createCFString().get(), appId.get());
+
+ // Create separate cache for each DRT instance
+ setCacheFolder();
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="trunkToolsScriptswebkitpyportwinpy"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/webkitpy/port/win.py (207066 => 207067)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/webkitpy/port/win.py        2016-10-11 08:30:37 UTC (rev 207066)
+++ trunk/Tools/Scripts/webkitpy/port/win.py        2016-10-11 08:35:46 UTC (rev 207067)
</span><span class="lines">@@ -28,8 +28,9 @@
</span><span class="cx"> # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">
</span><span class="cx"> import atexit
</span><ins>+import glob
+import logging
</ins><span class="cx"> import os
</span><del>-import logging
</del><span class="cx"> import re
</span><span class="cx"> import sys
</span><span class="cx"> import time
</span><span class="lines">@@ -351,6 +352,12 @@
</span><span class="cx"> self.setup_crash_log_saving()
</span><span class="cx"> self.prevent_error_dialogs()
</span><span class="cx"> self.delete_sem_locks()
</span><ins>+
+ preferences_files = self._filesystem.join(os.environ['APPDATA'], "Apple Computer/Preferences", "com.apple.DumpRenderTree*")
+ filelist = glob.glob(preferences_files)
+ for file in filelist:
+ self._filesystem.remove(file)
+
</ins><span class="cx"> super(WinPort, self).setup_test_run(device_class)
</span><span class="cx">
</span><span class="cx"> def clean_up_test_run(self):
</span></span></pre>
</div>
</div>
</body>
</html>