<!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>[203857] trunk/Source</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/203857">203857</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-07-28 22:22:14 -0700 (Thu, 28 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Split calculateCacheSizes in two methods
https://bugs.webkit.org/show_bug.cgi?id=160237

Reviewed by Darin Adler.

Source/WebCore:

Rename getVolumeFreeSizeForPath as volumeFreeSizeForPath and make it available to all platforms adding an
implementation for mac.

* platform/FileSystem.h:
* platform/efl/FileSystemEfl.cpp:
(WebCore::volumeFreeSizeForPath):
(WebCore::getVolumeFreeSizeForPath): Deleted.
* platform/glib/FileSystemGlib.cpp:
(WebCore::volumeFreeSizeForPath):
(WebCore::getVolumeFreeSizeForPath): Deleted.
* platform/mac/FileSystemMac.mm:
(WebCore::volumeFreeSizeForPath):
* platform/win/FileSystemWin.cpp:
(WebCore::volumeFreeSizeForPath):

Source/WebKit2:

It's used to calculate memory and disk cache sizes, but only the web process is interested in memory caches, and
the network process in disk cache. We can also avoid a lot of duplicated code between ports to set the cache model.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::setCacheModel): Use calculateURLCacheSizes to set the disk cache size and call
platformSetURLCacheSize if not set to allow ports to setup platform specific cache.
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/cocoa/NetworkProcessCocoa.mm:
(WebKit::NetworkProcess::platformSetURLCacheSize): Remove common code that is now in cross-platform file.
(WebKit::volumeFreeSize): Deleted.
(WebKit::NetworkProcess::platformSetCacheModel): Renamed to platformSetURLCacheSize().
* NetworkProcess/soup/NetworkProcessSoup.cpp:
(WebKit::NetworkProcess::platformSetURLCacheSize): Remove common code that is now in cross-platform file.
(WebKit::getCacheDiskFreeSize): Deleted.
(WebKit::NetworkProcess::platformSetCacheModel): Renamed to platformSetURLCacheSize().
* Shared/CacheModel.cpp:
(WebKit::calculateMemoryCacheSizes): Calculate the memory and page cache sizes.
(WebKit::calculateURLCacheSizes): Calculate the disk cache size.
(WebKit::calculateCacheSizes): Deleted.
* Shared/CacheModel.h:
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess): Tell the page cache to clear backing stores for GTK+ port too. This was done before when
setting the cache model.
(WebKit::WebProcess::setCacheModel): Use calculateMemoryCacheSizes to setup memory caches and call
platformSetCacheModel to allow ports do more setup according to the cache model.
(WebKit::WebProcess::clearResourceCaches): Deleted.
* WebProcess/WebProcess.h:
* WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::platformSetCacheModel): Remove common code that is now in cross-platform file.
(WebKit::volumeFreeSize): Deleted.
(WebKit::WebProcess::platformClearResourceCaches): Deleted.
* WebProcess/soup/WebProcessSoup.cpp:
(WebKit::WebProcess::platformSetCacheModel): Remove common code that is now in cross-platform file.
(WebKit::WebProcess::platformInitializeWebProcess):
(WebKit::WebProcess::platformClearResourceCaches): Deleted.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformFileSystemh">trunk/Source/WebCore/platform/FileSystem.h</a></li>
<li><a href="#trunkSourceWebCoreplatformeflFileSystemEflcpp">trunk/Source/WebCore/platform/efl/FileSystemEfl.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformglibFileSystemGlibcpp">trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformmacFileSystemMacmm">trunk/Source/WebCore/platform/mac/FileSystemMac.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformwinFileSystemWincpp">trunk/Source/WebCore/platform/win/FileSystemWin.cpp</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcesscpp">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcessh">trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesscocoaNetworkProcessCocoamm">trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcesssoupNetworkProcessSoupcpp">trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedCacheModelcpp">trunk/Source/WebKit2/Shared/CacheModel.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedCacheModelh">trunk/Source/WebKit2/Shared/CacheModel.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcesscpp">trunk/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcessh">trunk/Source/WebKit2/WebProcess/WebProcess.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcesscocoaWebProcessCocoamm">trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcesssoupWebProcessSoupcpp">trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebCore/ChangeLog        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-07-28  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        Split calculateCacheSizes in two methods
+        https://bugs.webkit.org/show_bug.cgi?id=160237
+
+        Reviewed by Darin Adler.
+
+        Rename getVolumeFreeSizeForPath as volumeFreeSizeForPath and make it available to all platforms adding an
+        implementation for mac.
+
+        * platform/FileSystem.h:
+        * platform/efl/FileSystemEfl.cpp:
+        (WebCore::volumeFreeSizeForPath):
+        (WebCore::getVolumeFreeSizeForPath): Deleted.
+        * platform/glib/FileSystemGlib.cpp:
+        (WebCore::volumeFreeSizeForPath):
+        (WebCore::getVolumeFreeSizeForPath): Deleted.
+        * platform/mac/FileSystemMac.mm:
+        (WebCore::volumeFreeSizeForPath):
+        * platform/win/FileSystemWin.cpp:
+        (WebCore::volumeFreeSizeForPath):
+
</ins><span class="cx"> 2016-07-28  Myles C. Maxfield  &lt;mmaxfield@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove deprecated SPI for video inline / fullscreen controls
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformFileSystemh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/FileSystem.h (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/FileSystem.h        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebCore/platform/FileSystem.h        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -145,6 +145,7 @@
</span><span class="cx"> String homeDirectoryPath();
</span><span class="cx"> WEBCORE_EXPORT String pathGetFileName(const String&amp;);
</span><span class="cx"> WEBCORE_EXPORT String directoryName(const String&amp;);
</span><ins>+WEBCORE_EXPORT bool getVolumeFreeSpace(const String&amp;, uint64_t&amp;);
</ins><span class="cx"> 
</span><span class="cx"> WEBCORE_EXPORT void setMetadataURL(String&amp; URLString, const String&amp; referrer, const String&amp; path);
</span><span class="cx"> 
</span><span class="lines">@@ -202,9 +203,6 @@
</span><span class="cx"> CString applicationDirectoryPath();
</span><span class="cx"> CString sharedResourcesPath();
</span><span class="cx"> #endif
</span><del>-#if USE(SOUP)
-uint64_t getVolumeFreeSizeForPath(const char*);
-#endif
</del><span class="cx"> 
</span><span class="cx"> #if PLATFORM(WIN)
</span><span class="cx"> WEBCORE_EXPORT String localUserSpecificStorageDirectory();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformeflFileSystemEflcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/efl/FileSystemEfl.cpp (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/efl/FileSystemEfl.cpp        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebCore/platform/efl/FileSystemEfl.cpp        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -88,13 +88,18 @@
</span><span class="cx">     return String::fromUTF8(home);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-uint64_t getVolumeFreeSizeForPath(const char* path)
</del><ins>+bool getVolumeFreeSpace(const String&amp; path, uint64_t&amp; freeSpace)
</ins><span class="cx"> {
</span><ins>+    CString fsRep = fileSystemRepresentation(path);
+    if (!fsRep.data() || fsRep.data()[0] == '\0')
+        return false;
+
</ins><span class="cx">     struct statvfs buf;
</span><del>-    if (statvfs(path, &amp;buf) &lt; 0)
-        return 0;
</del><ins>+    if (statvfs(fsRep.data(), &amp;buf) &lt; 0)
+        return false;
</ins><span class="cx"> 
</span><del>-    return static_cast&lt;uint64_t&gt;(buf.f_bavail) * buf.f_bsize;
</del><ins>+    freeSpace = static_cast&lt;uint64_t&gt;(buf.f_bavail) * buf.f_bsize;
+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformglibFileSystemGlibcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebCore/platform/glib/FileSystemGlib.cpp        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -232,14 +232,19 @@
</span><span class="cx">     return cachedPath;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-uint64_t getVolumeFreeSizeForPath(const char* path)
</del><ins>+bool getVolumeFreeSpace(const String&amp; path, uint64_t&amp; freeSpace)
</ins><span class="cx"> {
</span><del>-    GRefPtr&lt;GFile&gt; file = adoptGRef(g_file_new_for_path(path));
</del><ins>+    GUniquePtr&lt;gchar&gt; filename = unescapedFilename(path);
+    if (!filename)
+        return false;
+
+    GRefPtr&lt;GFile&gt; file = adoptGRef(g_file_new_for_path(filename.get()));
</ins><span class="cx">     GRefPtr&lt;GFileInfo&gt; fileInfo = adoptGRef(g_file_query_filesystem_info(file.get(), G_FILE_ATTRIBUTE_FILESYSTEM_FREE, 0, 0));
</span><span class="cx">     if (!fileInfo)
</span><del>-        return 0;
</del><ins>+        return false;
</ins><span class="cx"> 
</span><del>-    return g_file_info_get_attribute_uint64(fileInfo.get(), G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
</del><ins>+    freeSpace = g_file_info_get_attribute_uint64(fileInfo.get(), G_FILE_ATTRIBUTE_FILESYSTEM_FREE);
+    return !!freeSpace;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> String directoryName(const String&amp; path)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformmacFileSystemMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/mac/FileSystemMac.mm (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/mac/FileSystemMac.mm        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebCore/platform/mac/FileSystemMac.mm        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -98,6 +98,15 @@
</span><span class="cx">     return [manager moveItemAtURL:[NSURL fileURLWithPath:oldPath] toURL:[NSURL fileURLWithPath:newPath] error:nil];
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool getVolumeFreeSpace(const String&amp; path, uint64_t&amp; freeSpace)
+{
+    NSDictionary *fileSystemAttributesDictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:(NSString *)path error:NULL];
+    if (!fileSystemAttributesDictionary)
+        return false;
+    freeSpace = [[fileSystemAttributesDictionary objectForKey:NSFileSystemFreeSize] unsignedLongLongValue];
+    return true;
+}
+
</ins><span class="cx"> #if !PLATFORM(IOS)
</span><span class="cx"> bool deleteEmptyDirectory(const String&amp; path)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformwinFileSystemWincpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/win/FileSystemWin.cpp (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/win/FileSystemWin.cpp        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebCore/platform/win/FileSystemWin.cpp        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -447,4 +447,10 @@
</span><span class="cx">     return entries;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+bool getVolumeFreeSpace(const String&amp;, uint64_t&amp;)
+{
+    notImplemented();
+    return false;
+}
+
</ins><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebKit2/ChangeLog        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -1,5 +1,48 @@
</span><span class="cx"> 2016-07-28  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><ins>+        Split calculateCacheSizes in two methods
+        https://bugs.webkit.org/show_bug.cgi?id=160237
+
+        Reviewed by Darin Adler.
+
+        It's used to calculate memory and disk cache sizes, but only the web process is interested in memory caches, and
+        the network process in disk cache. We can also avoid a lot of duplicated code between ports to set the cache model.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::setCacheModel): Use calculateURLCacheSizes to set the disk cache size and call
+        platformSetURLCacheSize if not set to allow ports to setup platform specific cache.
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/cocoa/NetworkProcessCocoa.mm:
+        (WebKit::NetworkProcess::platformSetURLCacheSize): Remove common code that is now in cross-platform file.
+        (WebKit::volumeFreeSize): Deleted.
+        (WebKit::NetworkProcess::platformSetCacheModel): Renamed to platformSetURLCacheSize().
+        * NetworkProcess/soup/NetworkProcessSoup.cpp:
+        (WebKit::NetworkProcess::platformSetURLCacheSize): Remove common code that is now in cross-platform file.
+        (WebKit::getCacheDiskFreeSize): Deleted.
+        (WebKit::NetworkProcess::platformSetCacheModel): Renamed to platformSetURLCacheSize().
+        * Shared/CacheModel.cpp:
+        (WebKit::calculateMemoryCacheSizes): Calculate the memory and page cache sizes.
+        (WebKit::calculateURLCacheSizes): Calculate the disk cache size.
+        (WebKit::calculateCacheSizes): Deleted.
+        * Shared/CacheModel.h:
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess): Tell the page cache to clear backing stores for GTK+ port too. This was done before when
+        setting the cache model.
+        (WebKit::WebProcess::setCacheModel): Use calculateMemoryCacheSizes to setup memory caches and call
+        platformSetCacheModel to allow ports do more setup according to the cache model.
+        (WebKit::WebProcess::clearResourceCaches): Deleted.
+        * WebProcess/WebProcess.h:
+        * WebProcess/cocoa/WebProcessCocoa.mm:
+        (WebKit::WebProcess::platformSetCacheModel): Remove common code that is now in cross-platform file.
+        (WebKit::volumeFreeSize): Deleted.
+        (WebKit::WebProcess::platformClearResourceCaches): Deleted.
+        * WebProcess/soup/WebProcessSoup.cpp:
+        (WebKit::WebProcess::platformSetCacheModel): Remove common code that is now in cross-platform file.
+        (WebKit::WebProcess::platformInitializeWebProcess):
+        (WebKit::WebProcess::platformClearResourceCaches): Deleted.
+
+2016-07-28  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
</ins><span class="cx">         Database Process: ASSERTION FAILED: paths.size() == handles.size() with SANDBOX_EXTENSIONS disabled
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=160188
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -538,11 +538,34 @@
</span><span class="cx"> {
</span><span class="cx">     CacheModel cacheModel = static_cast&lt;CacheModel&gt;(cm);
</span><span class="cx"> 
</span><del>-    if (!m_hasSetCacheModel || cacheModel != m_cacheModel) {
-        m_hasSetCacheModel = true;
-        m_cacheModel = cacheModel;
-        platformSetCacheModel(cacheModel);
</del><ins>+    if (m_hasSetCacheModel &amp;&amp; (cacheModel == m_cacheModel))
+        return;
+
+    m_hasSetCacheModel = true;
+    m_cacheModel = cacheModel;
+
+    unsigned urlCacheMemoryCapacity = 0;
+    uint64_t urlCacheDiskCapacity = 0;
+    uint64_t diskFreeSize = 0;
+    if (WebCore::getVolumeFreeSpace(m_diskCacheDirectory, diskFreeSize)) {
+        // As a fudge factor, use 1000 instead of 1024, in case the reported byte
+        // count doesn't align exactly to a megabyte boundary.
+        diskFreeSize /= KB * 1000;
+        calculateURLCacheSizes(cacheModel, diskFreeSize, urlCacheMemoryCapacity, urlCacheDiskCapacity);
</ins><span class="cx">     }
</span><ins>+
+    if (m_diskCacheSizeOverride &gt;= 0)
+        urlCacheDiskCapacity = m_diskCacheSizeOverride;
+
+#if ENABLE(NETWORK_CACHE)
+    auto&amp; networkCache = NetworkCache::singleton();
+    if (networkCache.isEnabled()) {
+        networkCache.setCapacity(urlCacheDiskCapacity);
+        return;
+    }
+#endif
+
+    platformSetURLCacheSize(urlCacheMemoryCapacity, urlCacheDiskCapacity);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcess::setCanHandleHTTPSServerTrustEvaluation(bool value)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -197,7 +197,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     // Platform Helpers
</span><del>-    void platformSetCacheModel(CacheModel);
</del><ins>+    void platformSetURLCacheSize(unsigned urlCacheMemoryCapacity, uint64_t urlCacheDiskCapacity);
</ins><span class="cx"> 
</span><span class="cx">     // Connections to WebProcesses.
</span><span class="cx">     Vector&lt;RefPtr&lt;NetworkConnectionToWebProcess&gt;&gt; m_webProcessConnections;
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesscocoaNetworkProcessCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkProcessCocoa.mm        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -38,7 +38,6 @@
</span><span class="cx"> #import &lt;WebCore/SecurityOrigin.h&gt;
</span><span class="cx"> #import &lt;WebCore/SecurityOriginData.h&gt;
</span><span class="cx"> #import &lt;WebKitSystemInterface.h&gt;
</span><del>-#import &lt;wtf/RAMSize.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="lines">@@ -124,46 +123,12 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-static uint64_t volumeFreeSize(const String&amp; path)
</del><ins>+void NetworkProcess::platformSetURLCacheSize(unsigned urlCacheMemoryCapacity, uint64_t urlCacheDiskCapacity)
</ins><span class="cx"> {
</span><del>-    NSDictionary *fileSystemAttributesDictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:(NSString *)path error:NULL];
-    return [[fileSystemAttributesDictionary objectForKey:NSFileSystemFreeSize] unsignedLongLongValue];
-}
-
-void NetworkProcess::platformSetCacheModel(CacheModel cacheModel)
-{
-    uint64_t memSize = ramSize() / 1024 / 1024;
-
-    // As a fudge factor, use 1000 instead of 1024, in case the reported byte
-    // count doesn't align exactly to a megabyte boundary.
-    uint64_t diskFreeSize = volumeFreeSize(m_diskCacheDirectory) / 1024 / 1000;
-
-    unsigned cacheTotalCapacity = 0;
-    unsigned cacheMinDeadCapacity = 0;
-    unsigned cacheMaxDeadCapacity = 0;
-    auto deadDecodedDataDeletionInterval = std::chrono::seconds { 0 };
-    unsigned pageCacheCapacity = 0;
-    unsigned long urlCacheMemoryCapacity = 0;
-    unsigned long urlCacheDiskCapacity = 0;
-
-    calculateCacheSizes(cacheModel, memSize, diskFreeSize,
-        cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval,
-        pageCacheCapacity, urlCacheMemoryCapacity, urlCacheDiskCapacity);
-
-    if (m_diskCacheSizeOverride &gt;= 0)
-        urlCacheDiskCapacity = m_diskCacheSizeOverride;
-
-#if ENABLE(NETWORK_CACHE)
-    auto&amp; networkCache = NetworkCache::singleton();
-    if (networkCache.isEnabled()) {
-        networkCache.setCapacity(urlCacheDiskCapacity);
-        return;
-    }
-#endif
</del><span class="cx">     NSURLCache *nsurlCache = [NSURLCache sharedURLCache];
</span><span class="cx">     [nsurlCache setMemoryCapacity:urlCacheMemoryCapacity];
</span><span class="cx">     if (!m_diskCacheIsDisabledForTesting)
</span><del>-        [nsurlCache setDiskCapacity:std::max&lt;unsigned long&gt;(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn.
</del><ins>+        [nsurlCache setDiskCapacity:std::max&lt;uint64_t&gt;(urlCacheDiskCapacity, [nsurlCache diskCapacity])]; // Don't shrink a big disk cache, since that would cause churn.
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static RetainPtr&lt;CFStringRef&gt; partitionName(CFStringRef domain)
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcesssoupNetworkProcessSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebKit2/NetworkProcess/soup/NetworkProcessSoup.cpp        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -45,20 +45,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-#if !ENABLE(NETWORK_CACHE)
-static uint64_t getCacheDiskFreeSize(SoupCache* cache)
-{
-    ASSERT(cache);
-
-    GUniqueOutPtr&lt;char&gt; cacheDir;
-    g_object_get(G_OBJECT(cache), &quot;cache-dir&quot;, &amp;cacheDir.outPtr(), NULL);
-    if (!cacheDir)
-        return 0;
-
-    return WebCore::getVolumeFreeSizeForPath(cacheDir.get());
-}
-#endif
-
</del><span class="cx"> void NetworkProcess::userPreferredLanguagesChanged(const Vector&lt;String&gt;&amp; languages)
</span><span class="cx"> {
</span><span class="cx">     SoupNetworkSession::defaultSession().setAcceptLanguages(languages);
</span><span class="lines">@@ -107,36 +93,14 @@
</span><span class="cx">     setIgnoreTLSErrors(parameters.ignoreTLSErrors);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkProcess::platformSetCacheModel(CacheModel cacheModel)
</del><ins>+void NetworkProcess::platformSetURLCacheSize(unsigned /*urlCacheMemoryCapacity*/, uint64_t urlCacheDiskCapacity)
</ins><span class="cx"> {
</span><del>-    unsigned cacheTotalCapacity = 0;
-    unsigned cacheMinDeadCapacity = 0;
-    unsigned cacheMaxDeadCapacity = 0;
-    auto deadDecodedDataDeletionInterval = std::chrono::seconds { 0 };
-    unsigned pageCacheCapacity = 0;
-
-    unsigned long urlCacheMemoryCapacity = 0;
-    unsigned long urlCacheDiskCapacity = 0;
-
-#if ENABLE(NETWORK_CACHE)
-    uint64_t diskFreeSize = WebCore::getVolumeFreeSizeForPath(m_diskCacheDirectory.utf8().data()) / WTF::MB;
-#else
</del><ins>+#if !ENABLE(NETWORK_CACHE)
</ins><span class="cx">     SoupCache* cache = SoupNetworkSession::defaultSession().cache();
</span><del>-    uint64_t diskFreeSize = getCacheDiskFreeSize(cache) / WTF::MB;
-#endif
-
-    uint64_t memSize = WTF::ramSize() / WTF::MB;
-    calculateCacheSizes(cacheModel, memSize, diskFreeSize,
-        cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval,
-        pageCacheCapacity, urlCacheMemoryCapacity, urlCacheDiskCapacity);
-
-#if ENABLE(NETWORK_CACHE)
-    auto&amp; networkCache = NetworkCache::singleton();
-    if (networkCache.isEnabled())
-        networkCache.setCapacity(urlCacheDiskCapacity);
-#else
</del><span class="cx">     if (urlCacheDiskCapacity &gt; soup_cache_get_max_size(cache))
</span><span class="cx">         soup_cache_set_max_size(cache, urlCacheDiskCapacity);
</span><ins>+#else
+    UNUSED_PARAM(urlCacheDiskCapacity);
</ins><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCacheModelcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/CacheModel.cpp (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/CacheModel.cpp        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebKit2/Shared/CacheModel.cpp        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -27,13 +27,15 @@
</span><span class="cx"> #include &quot;CacheModel.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &lt;algorithm&gt;
</span><ins>+#include &lt;wtf/RAMSize.h&gt;
+#include &lt;wtf/StdLibExtras.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-void calculateCacheSizes(CacheModel cacheModel, uint64_t memorySize, uint64_t diskFreeSize,
-    unsigned&amp; cacheTotalCapacity, unsigned&amp; cacheMinDeadCapacity, unsigned&amp; cacheMaxDeadCapacity, std::chrono::seconds&amp; deadDecodedDataDeletionInterval,
-    unsigned&amp; pageCacheCapacity, unsigned long&amp; urlCacheMemoryCapacity, unsigned long&amp; urlCacheDiskCapacity)
</del><ins>+void calculateMemoryCacheSizes(CacheModel cacheModel, unsigned&amp; cacheTotalCapacity, unsigned&amp; cacheMinDeadCapacity, unsigned&amp; cacheMaxDeadCapacity, std::chrono::seconds&amp; deadDecodedDataDeletionInterval, unsigned&amp; pageCacheCapacity)
</ins><span class="cx"> {
</span><ins>+    uint64_t memorySize = ramSize() / MB;
+
</ins><span class="cx">     switch (cacheModel) {
</span><span class="cx">     case CacheModelDocumentViewer: {
</span><span class="cx">         // Page cache capacity (in pages)
</span><span class="lines">@@ -41,23 +43,17 @@
</span><span class="cx"> 
</span><span class="cx">         // Object cache capacities (in bytes)
</span><span class="cx">         if (memorySize &gt;= 2048)
</span><del>-            cacheTotalCapacity = 96 * 1024 * 1024;
</del><ins>+            cacheTotalCapacity = 96 * MB;
</ins><span class="cx">         else if (memorySize &gt;= 1536)
</span><del>-            cacheTotalCapacity = 64 * 1024 * 1024;
</del><ins>+            cacheTotalCapacity = 64 * MB;
</ins><span class="cx">         else if (memorySize &gt;= 1024)
</span><del>-            cacheTotalCapacity = 32 * 1024 * 1024;
</del><ins>+            cacheTotalCapacity = 32 * MB;
</ins><span class="cx">         else if (memorySize &gt;= 512)
</span><del>-            cacheTotalCapacity = 16 * 1024 * 1024;
</del><ins>+            cacheTotalCapacity = 16 * MB;
</ins><span class="cx"> 
</span><span class="cx">         cacheMinDeadCapacity = 0;
</span><span class="cx">         cacheMaxDeadCapacity = 0;
</span><span class="cx"> 
</span><del>-        // Foundation memory cache capacity (in bytes)
-        urlCacheMemoryCapacity = 0;
-
-        // Disk cache capacity (in bytes)
-        urlCacheDiskCapacity = 0;
-
</del><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     case CacheModelDocumentBrowser: {
</span><span class="lines">@@ -71,37 +67,17 @@
</span><span class="cx"> 
</span><span class="cx">         // Object cache capacities (in bytes)
</span><span class="cx">         if (memorySize &gt;= 2048)
</span><del>-            cacheTotalCapacity = 96 * 1024 * 1024;
</del><ins>+            cacheTotalCapacity = 96 * MB;
</ins><span class="cx">         else if (memorySize &gt;= 1536)
</span><del>-            cacheTotalCapacity = 64 * 1024 * 1024;
</del><ins>+            cacheTotalCapacity = 64 * MB;
</ins><span class="cx">         else if (memorySize &gt;= 1024)
</span><del>-            cacheTotalCapacity = 32 * 1024 * 1024;
</del><ins>+            cacheTotalCapacity = 32 * MB;
</ins><span class="cx">         else if (memorySize &gt;= 512)
</span><del>-            cacheTotalCapacity = 16 * 1024 * 1024;
</del><ins>+            cacheTotalCapacity = 16 * MB;
</ins><span class="cx"> 
</span><span class="cx">         cacheMinDeadCapacity = cacheTotalCapacity / 8;
</span><span class="cx">         cacheMaxDeadCapacity = cacheTotalCapacity / 4;
</span><span class="cx"> 
</span><del>-        // Foundation memory cache capacity (in bytes)
-        if (memorySize &gt;= 2048)
-            urlCacheMemoryCapacity = 4 * 1024 * 1024;
-        else if (memorySize &gt;= 1024)
-            urlCacheMemoryCapacity = 2 * 1024 * 1024;
-        else if (memorySize &gt;= 512)
-            urlCacheMemoryCapacity = 1 * 1024 * 1024;
-        else
-            urlCacheMemoryCapacity =      512 * 1024; 
-
-        // Disk cache capacity (in bytes)
-        if (diskFreeSize &gt;= 16384)
-            urlCacheDiskCapacity = 75 * 1024 * 1024;
-        else if (diskFreeSize &gt;= 8192)
-            urlCacheDiskCapacity = 40 * 1024 * 1024;
-        else if (diskFreeSize &gt;= 4096)
-            urlCacheDiskCapacity = 30 * 1024 * 1024;
-        else
-            urlCacheDiskCapacity = 20 * 1024 * 1024;
-
</del><span class="cx">         break;
</span><span class="cx">     }
</span><span class="cx">     case CacheModelPrimaryWebBrowser: {
</span><span class="lines">@@ -115,16 +91,16 @@
</span><span class="cx"> 
</span><span class="cx">         // Object cache capacities (in bytes)
</span><span class="cx">         // (Testing indicates that value / MB depends heavily on content and
</span><del>-        // browsing pattern. Even growth above 128MB can have substantial 
</del><ins>+        // browsing pattern. Even growth above 128MB can have substantial
</ins><span class="cx">         // value / MB for some content / browsing patterns.)
</span><span class="cx">         if (memorySize &gt;= 2048)
</span><del>-            cacheTotalCapacity = 128 * 1024 * 1024;
</del><ins>+            cacheTotalCapacity = 128 * MB;
</ins><span class="cx">         else if (memorySize &gt;= 1536)
</span><del>-            cacheTotalCapacity = 96 * 1024 * 1024;
</del><ins>+            cacheTotalCapacity = 96 * MB;
</ins><span class="cx">         else if (memorySize &gt;= 1024)
</span><del>-            cacheTotalCapacity = 64 * 1024 * 1024;
</del><ins>+            cacheTotalCapacity = 64 * MB;
</ins><span class="cx">         else if (memorySize &gt;= 512)
</span><del>-            cacheTotalCapacity = 32 * 1024 * 1024;
</del><ins>+            cacheTotalCapacity = 32 * MB;
</ins><span class="cx"> 
</span><span class="cx">         cacheMinDeadCapacity = cacheTotalCapacity / 4;
</span><span class="cx">         cacheMaxDeadCapacity = cacheTotalCapacity / 2;
</span><span class="lines">@@ -135,37 +111,84 @@
</span><span class="cx"> 
</span><span class="cx">         deadDecodedDataDeletionInterval = std::chrono::seconds { 60 };
</span><span class="cx"> 
</span><ins>+        break;
+    }
+    default:
+        ASSERT_NOT_REACHED();
+    };
+}
+
+void calculateURLCacheSizes(CacheModel cacheModel, uint64_t diskFreeSize, unsigned&amp; urlCacheMemoryCapacity, uint64_t&amp; urlCacheDiskCapacity)
+{
+    switch (cacheModel) {
+    case CacheModelDocumentViewer: {
+        // Foundation memory cache capacity (in bytes)
+        urlCacheMemoryCapacity = 0;
+
+        // Disk cache capacity (in bytes)
+        urlCacheDiskCapacity = 0;
+
+        break;
+    }
+    case CacheModelDocumentBrowser: {
+        uint64_t memorySize = ramSize() / MB;
+
+        // Foundation memory cache capacity (in bytes)
+        if (memorySize &gt;= 2048)
+            urlCacheMemoryCapacity = 4 * MB;
+        else if (memorySize &gt;= 1024)
+            urlCacheMemoryCapacity = 2 * MB;
+        else if (memorySize &gt;= 512)
+            urlCacheMemoryCapacity = 1 * MB;
+        else
+            urlCacheMemoryCapacity = 512 * KB;
+
+        // Disk cache capacity (in bytes)
+        if (diskFreeSize &gt;= 16384)
+            urlCacheDiskCapacity = 75 * MB;
+        else if (diskFreeSize &gt;= 8192)
+            urlCacheDiskCapacity = 40 * MB;
+        else if (diskFreeSize &gt;= 4096)
+            urlCacheDiskCapacity = 30 * MB;
+        else
+            urlCacheDiskCapacity = 20 * MB;
+
+        break;
+    }
+    case CacheModelPrimaryWebBrowser: {
+        uint64_t memorySize = ramSize() / MB;
+
</ins><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">         if (memorySize &gt;= 1024)
</span><del>-            urlCacheMemoryCapacity = 16 * 1024 * 1024;
</del><ins>+            urlCacheMemoryCapacity = 16 * MB;
</ins><span class="cx">         else
</span><del>-            urlCacheMemoryCapacity = 8 * 1024 * 1024;
</del><ins>+            urlCacheMemoryCapacity = 8 * MB;
</ins><span class="cx"> #else
</span><span class="cx">         // Foundation memory cache capacity (in bytes)
</span><span class="cx">         // (These values are small because WebCore does most caching itself.)
</span><span class="cx">         if (memorySize &gt;= 1024)
</span><del>-            urlCacheMemoryCapacity = 4 * 1024 * 1024;
</del><ins>+            urlCacheMemoryCapacity = 4 * MB;
</ins><span class="cx">         else if (memorySize &gt;= 512)
</span><del>-            urlCacheMemoryCapacity = 2 * 1024 * 1024;
</del><ins>+            urlCacheMemoryCapacity = 2 * MB;
</ins><span class="cx">         else if (memorySize &gt;= 256)
</span><del>-            urlCacheMemoryCapacity = 1 * 1024 * 1024;
</del><ins>+            urlCacheMemoryCapacity = 1 * MB;
</ins><span class="cx">         else
</span><del>-            urlCacheMemoryCapacity =      512 * 1024;
</del><ins>+            urlCacheMemoryCapacity = 512 * KB;
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">         // Disk cache capacity (in bytes)
</span><span class="cx">         if (diskFreeSize &gt;= 16384)
</span><del>-            urlCacheDiskCapacity = 500 * 1024 * 1024;
</del><ins>+            urlCacheDiskCapacity = 500 * MB;
</ins><span class="cx">         else if (diskFreeSize &gt;= 8192)
</span><del>-            urlCacheDiskCapacity = 250 * 1024 * 1024;
</del><ins>+            urlCacheDiskCapacity = 250 * MB;
</ins><span class="cx">         else if (diskFreeSize &gt;= 4096)
</span><del>-            urlCacheDiskCapacity = 125 * 1024 * 1024;
</del><ins>+            urlCacheDiskCapacity = 125 * MB;
</ins><span class="cx">         else if (diskFreeSize &gt;= 2048)
</span><del>-            urlCacheDiskCapacity = 100 * 1024 * 1024;
</del><ins>+            urlCacheDiskCapacity = 100 * MB;
</ins><span class="cx">         else if (diskFreeSize &gt;= 1024)
</span><del>-            urlCacheDiskCapacity = 75 * 1024 * 1024;
</del><ins>+            urlCacheDiskCapacity = 75 * MB;
</ins><span class="cx">         else
</span><del>-            urlCacheDiskCapacity = 50 * 1024 * 1024;
</del><ins>+            urlCacheDiskCapacity = 50 * MB;
</ins><span class="cx"> 
</span><span class="cx">         break;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCacheModelh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/CacheModel.h (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/CacheModel.h        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebKit2/Shared/CacheModel.h        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -37,9 +37,8 @@
</span><span class="cx">     CacheModelPrimaryWebBrowser
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-void calculateCacheSizes(CacheModel cacheModel, uint64_t memorySize, uint64_t diskFreeSize,
-    unsigned&amp; cacheTotalCapacity, unsigned&amp; cacheMinDeadCapacity, unsigned&amp; cacheMaxDeadCapacity, std::chrono::seconds&amp; deadDecodedDataDeletionInterval,
-    unsigned&amp; pageCacheCapacity, unsigned long&amp; urlCacheMemoryCapacity, unsigned long&amp; urlCacheDiskCapacity);
</del><ins>+void calculateMemoryCacheSizes(CacheModel, unsigned&amp; cacheTotalCapacity, unsigned&amp; cacheMinDeadCapacity, unsigned&amp; cacheMaxDeadCapacity, std::chrono::seconds&amp; deadDecodedDataDeletionInterval, unsigned&amp; pageCacheCapacity);
+void calculateURLCacheSizes(CacheModel, uint64_t diskFreeSize, unsigned&amp; urlCacheMemoryCapacity, uint64_t&amp; urlCacheDiskCapacity);
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -205,7 +205,7 @@
</span><span class="cx">     RuntimeEnabledFeatures::sharedFeatures().setWebkitIndexedDBEnabled(true);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
</del><ins>+#if PLATFORM(IOS) || PLATFORM(GTK)
</ins><span class="cx">     PageCache::singleton().setShouldClearBackingStores(true);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -529,11 +529,25 @@
</span><span class="cx"> {
</span><span class="cx">     CacheModel cacheModel = static_cast&lt;CacheModel&gt;(cm);
</span><span class="cx"> 
</span><del>-    if (!m_hasSetCacheModel || cacheModel != m_cacheModel) {
-        m_hasSetCacheModel = true;
-        m_cacheModel = cacheModel;
-        platformSetCacheModel(cacheModel);
-    }
</del><ins>+    if (m_hasSetCacheModel &amp;&amp; (cacheModel == m_cacheModel))
+        return;
+
+    m_hasSetCacheModel = true;
+    m_cacheModel = cacheModel;
+
+    unsigned cacheTotalCapacity = 0;
+    unsigned cacheMinDeadCapacity = 0;
+    unsigned cacheMaxDeadCapacity = 0;
+    auto deadDecodedDataDeletionInterval = std::chrono::seconds { 0 };
+    unsigned pageCacheSize = 0;
+    calculateMemoryCacheSizes(cacheModel, cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval, pageCacheSize);
+
+    auto&amp; memoryCache = MemoryCache::singleton();
+    memoryCache.setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
+    memoryCache.setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
+    PageCache::singleton().setMaxSize(pageCacheSize);
+
+    platformSetCacheModel(cacheModel);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void WebProcess::clearCachedCredentials()
</span><span class="lines">@@ -751,8 +765,6 @@
</span><span class="cx"> 
</span><span class="cx"> void WebProcess::clearResourceCaches(ResourceCachesToClear resourceCachesToClear)
</span><span class="cx"> {
</span><del>-    platformClearResourceCaches(resourceCachesToClear);
-
</del><span class="cx">     // Toggling the cache model like this forces the cache to evict all its in-memory resources.
</span><span class="cx">     // FIXME: We need a better way to do this.
</span><span class="cx">     CacheModel cacheModel = m_cacheModel;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.h        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -261,7 +261,6 @@
</span><span class="cx">     void resetPlugInAutoStartOriginHashes(const HashMap&lt;WebCore::SessionID, HashMap&lt;unsigned, double&gt;&gt;&amp; hashes);
</span><span class="cx"> 
</span><span class="cx">     void platformSetCacheModel(CacheModel);
</span><del>-    void platformClearResourceCaches(ResourceCachesToClear);
</del><span class="cx"> 
</span><span class="cx">     void setEnhancedAccessibility(bool);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesscocoaWebProcessCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -48,10 +48,8 @@
</span><span class="cx"> #import &lt;WebCore/FontCache.h&gt;
</span><span class="cx"> #import &lt;WebCore/FontCascade.h&gt;
</span><span class="cx"> #import &lt;WebCore/LocalizedStrings.h&gt;
</span><del>-#import &lt;WebCore/MemoryCache.h&gt;
</del><span class="cx"> #import &lt;WebCore/MemoryPressureHandler.h&gt;
</span><span class="cx"> #import &lt;WebCore/NSAccessibilitySPI.h&gt;
</span><del>-#import &lt;WebCore/PageCache.h&gt;
</del><span class="cx"> #import &lt;WebCore/RuntimeApplicationChecks.h&gt;
</span><span class="cx"> #import &lt;WebCore/pthreadSPI.h&gt;
</span><span class="cx"> #import &lt;WebCore/VNodeTracker.h&gt;
</span><span class="lines">@@ -61,7 +59,6 @@
</span><span class="cx"> #import &lt;dispatch/dispatch.h&gt;
</span><span class="cx"> #import &lt;objc/runtime.h&gt;
</span><span class="cx"> #import &lt;stdio.h&gt;
</span><del>-#import &lt;wtf/RAMSize.h&gt;
</del><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #import &lt;WebCore/GraphicsServicesSPI.h&gt;
</span><span class="lines">@@ -75,47 +72,10 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><del>-static uint64_t volumeFreeSize(NSString *path)
</del><ins>+void WebProcess::platformSetCacheModel(CacheModel)
</ins><span class="cx"> {
</span><del>-    NSDictionary *fileSystemAttributesDictionary = [[NSFileManager defaultManager] attributesOfFileSystemForPath:path error:NULL];
-    return [[fileSystemAttributesDictionary objectForKey:NSFileSystemFreeSize] unsignedLongLongValue];
</del><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebProcess::platformSetCacheModel(CacheModel cacheModel)
-{
-    RetainPtr&lt;NSString&gt; nsurlCacheDirectory = adoptNS((NSString *)WKCopyFoundationCacheDirectory());
-    if (!nsurlCacheDirectory)
-        nsurlCacheDirectory = NSHomeDirectory();
-
-    uint64_t memSize = ramSize() / 1024 / 1024;
-
-    // As a fudge factor, use 1000 instead of 1024, in case the reported byte 
-    // count doesn't align exactly to a megabyte boundary.
-    uint64_t diskFreeSize = volumeFreeSize(nsurlCacheDirectory.get()) / 1024 / 1000;
-
-    unsigned cacheTotalCapacity = 0;
-    unsigned cacheMinDeadCapacity = 0;
-    unsigned cacheMaxDeadCapacity = 0;
-    auto deadDecodedDataDeletionInterval = std::chrono::seconds { 0 };
-    unsigned pageCacheSize = 0;
-    unsigned long urlCacheMemoryCapacity = 0;
-    unsigned long urlCacheDiskCapacity = 0;
-
-    calculateCacheSizes(cacheModel, memSize, diskFreeSize,
-        cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval,
-        pageCacheSize, urlCacheMemoryCapacity, urlCacheDiskCapacity);
-
-    auto&amp; memoryCache = MemoryCache::singleton();
-    memoryCache.setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
-    memoryCache.setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
-    PageCache::singleton().setMaxSize(pageCacheSize);
-}
-
-void WebProcess::platformClearResourceCaches(ResourceCachesToClear cachesToClear)
-{
-    // FIXME: Remove this.
-}
-
</del><span class="cx"> #if USE(APPKIT)
</span><span class="cx"> static id NSApplicationAccessibilityFocusedUIElement(NSApplication*, SEL)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcesssoupWebProcessSoupcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp (203856 => 203857)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp        2016-07-29 05:16:01 UTC (rev 203856)
+++ trunk/Source/WebKit2/WebProcess/soup/WebProcessSoup.cpp        2016-07-29 05:22:14 UTC (rev 203857)
</span><span class="lines">@@ -27,59 +27,21 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;WebProcess.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;CertificateInfo.h&quot;
-#include &quot;WebCookieManager.h&quot;
</del><span class="cx"> #include &quot;WebProcessCreationParameters.h&quot;
</span><del>-#include &lt;WebCore/FileSystem.h&gt;
-#include &lt;WebCore/Language.h&gt;
</del><span class="cx"> #include &lt;WebCore/MemoryCache.h&gt;
</span><del>-#include &lt;WebCore/PageCache.h&gt;
-#include &lt;WebCore/ResourceHandle.h&gt;
-#include &lt;WebCore/SoupNetworkSession.h&gt;
-#include &lt;libsoup/soup.h&gt;
-#include &lt;wtf/RAMSize.h&gt;
-#include &lt;wtf/glib/GRefPtr.h&gt;
-#include &lt;wtf/glib/GUniquePtr.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="cx"> 
</span><span class="cx"> void WebProcess::platformSetCacheModel(CacheModel cacheModel)
</span><span class="cx"> {
</span><del>-    unsigned cacheTotalCapacity = 0;
-    unsigned cacheMinDeadCapacity = 0;
-    unsigned cacheMaxDeadCapacity = 0;
-    auto deadDecodedDataDeletionInterval = std::chrono::seconds { 0 };
-    unsigned pageCacheSize = 0;
-
-    unsigned long urlCacheMemoryCapacity = 0;
-    unsigned long urlCacheDiskCapacity = 0;
-
-    uint64_t diskFreeSize = 0;
-
-    uint64_t memSize = WTF::ramSize() / WTF::MB;
-    calculateCacheSizes(cacheModel, memSize, diskFreeSize,
-                        cacheTotalCapacity, cacheMinDeadCapacity, cacheMaxDeadCapacity, deadDecodedDataDeletionInterval,
-                        pageCacheSize, urlCacheMemoryCapacity, urlCacheDiskCapacity);
-
-    auto&amp; memoryCache = WebCore::MemoryCache::singleton();
-    memoryCache.setDisabled(cacheModel == CacheModelDocumentViewer);
-    memoryCache.setCapacities(cacheMinDeadCapacity, cacheMaxDeadCapacity, cacheTotalCapacity);
-    memoryCache.setDeadDecodedDataDeletionInterval(deadDecodedDataDeletionInterval);
-    WebCore::PageCache::singleton().setMaxSize(pageCacheSize);
-
-#if PLATFORM(GTK)
-    WebCore::PageCache::singleton().setShouldClearBackingStores(true);
-#endif
</del><ins>+    // FIXME: this is no longer soup specific, this file should be renamed.
+    WebCore::MemoryCache::singleton().setDisabled(cacheModel == CacheModelDocumentViewer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebProcess::platformClearResourceCaches(ResourceCachesToClear cachesToClear)
</del><ins>+void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters&amp;&amp;)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void WebProcess::platformInitializeWebProcess(WebProcessCreationParameters&amp;&amp; parameters)
-{
-}
-
</del><span class="cx"> void WebProcess::platformTerminate()
</span><span class="cx"> {
</span><span class="cx"> }
</span></span></pre>
</div>
</div>

</body>
</html>