<!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>[196943] 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/196943">196943</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-02-22 10:31:03 -0800 (Mon, 22 Feb 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Add mechanism to disable memory pressure handling
https://bugs.webkit.org/show_bug.cgi?id=154254
&lt;rdar://problem/24662616&gt;

Patch by Keith Rollin &lt;krollin@apple.com&gt; on 2016-02-22
Reviewed by Chris Dumez.

Add a mechanism to disable WebKit's response to memory pressure
triggers. This was asked for by another group for testing purposes.

In order to disable WebKit's memory pressure handling, execute the
following from the command line:

    defaults write com.apple.Safari WebKitSuppressMemoryPressureHandler -bool true

To revert to standard behavior, delete the key or set it to False.

This flag is used when a new sub-process is being spawned. The value
is read and stored in an initialization parameter block, which is then
sent to the new sub-process.

In actuality, only the UI, WebContent, and Network processes heed the
flag. The Plugin process isn't instrumented to heed this flag for
three reasons. First, the Plugin process installs its memory pressure
handler in initializeProcess, not initializePluginProcess. This is
contrary to when the other processes install their handlers, which is
in initialize&lt;PluginType&gt;Process, not initializeProcess. So in order
to accomodate the Plugin process, we'd need to modify
ChildProcessInitializationParameters. Doing this is awkward at best,
but also seems to be opposed to what's supposed to be done in
initializeProcess and conveyed in
ChildProcessInitializationParameters. And even if we did add a boolean
to this structure and added support for conveying it through the XPC
port, it would end up being a Plugin process-only boolean in a general
parameter block, which seems asymmetric with the other processes.
Second, there's no convenient Cocoa function called in the flow that
spawns the Plugin process, meaning that there's no convenient place to
call NSUserDefaults to get the flag's value. And third, the Plugin
process doesn't elegantly respond to the memory pressure trigger
anyway. It might terminate itself, but that's it. As for the Database
process, it doesn't seem to support responding to memory pressure at
all, so we don't send it a flag telling it to ignore it.

Internally, the memory pressure handler is suppressed by not calling
MemoryPressureHandler::install() if the flag is set. In the case of
the Network process, the flag is saved so that it can be checked later
in other places that manually kick off the memory pressure handling
procedure.

Source/WebKit/mac:

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(WebInstallMemoryPressureHandler):

Source/WebKit2:

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::lowMemoryHandler):
(WebKit::NetworkProcess::initializeNetworkProcess):
* NetworkProcess/NetworkProcess.h:
* NetworkProcess/NetworkProcessCreationParameters.cpp:
(WebKit::NetworkProcessCreationParameters::encode):
(WebKit::NetworkProcessCreationParameters::decode):
* NetworkProcess/NetworkProcessCreationParameters.h:
* Shared/WebProcessCreationParameters.cpp:
(WebKit::WebProcessCreationParameters::encode):
(WebKit::WebProcessCreationParameters::decode):
* Shared/WebProcessCreationParameters.h:
* UIProcess/Cocoa/WebProcessPoolCocoa.mm:
(WebKit::WebProcessPool::platformInitializeWebProcess):
(WebKit::WebProcessPool::platformInitializeNetworkProcess):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</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="#trunkSourceWebKit2NetworkProcessNetworkProcessCreationParameterscpp">trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKit2NetworkProcessNetworkProcessCreationParametersh">trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h</a></li>
<li><a href="#trunkSourceWebKit2SharedWebProcessCreationParameterscpp">trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedWebProcessCreationParametersh">trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCocoaWebProcessPoolCocoamm">trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessiosWebMemoryPressureHandlerIOSmm">trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.mm</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>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit/mac/ChangeLog        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -1,3 +1,57 @@
</span><ins>+2016-02-22  Keith Rollin  &lt;krollin@apple.com&gt;
+
+        Add mechanism to disable memory pressure handling
+        https://bugs.webkit.org/show_bug.cgi?id=154254
+        &lt;rdar://problem/24662616&gt;
+
+        Reviewed by Chris Dumez.
+
+        Add a mechanism to disable WebKit's response to memory pressure
+        triggers. This was asked for by another group for testing purposes.
+
+        In order to disable WebKit's memory pressure handling, execute the
+        following from the command line:
+
+            defaults write com.apple.Safari WebKitSuppressMemoryPressureHandler -bool true
+
+        To revert to standard behavior, delete the key or set it to False.
+
+        This flag is used when a new sub-process is being spawned. The value
+        is read and stored in an initialization parameter block, which is then
+        sent to the new sub-process.
+
+        In actuality, only the UI, WebContent, and Network processes heed the
+        flag. The Plugin process isn't instrumented to heed this flag for
+        three reasons. First, the Plugin process installs its memory pressure
+        handler in initializeProcess, not initializePluginProcess. This is
+        contrary to when the other processes install their handlers, which is
+        in initialize&lt;PluginType&gt;Process, not initializeProcess. So in order
+        to accomodate the Plugin process, we'd need to modify
+        ChildProcessInitializationParameters. Doing this is awkward at best,
+        but also seems to be opposed to what's supposed to be done in
+        initializeProcess and conveyed in
+        ChildProcessInitializationParameters. And even if we did add a boolean
+        to this structure and added support for conveying it through the XPC
+        port, it would end up being a Plugin process-only boolean in a general
+        parameter block, which seems asymmetric with the other processes.
+        Second, there's no convenient Cocoa function called in the flow that
+        spawns the Plugin process, meaning that there's no convenient place to
+        call NSUserDefaults to get the flag's value. And third, the Plugin
+        process doesn't elegantly respond to the memory pressure trigger
+        anyway. It might terminate itself, but that's it. As for the Database
+        process, it doesn't seem to support responding to memory pressure at
+        all, so we don't send it a flag telling it to ignore it.
+
+        Internally, the memory pressure handler is suppressed by not calling
+        MemoryPressureHandler::install() if the flag is set. In the case of
+        the Network process, the flag is saved so that it can be checked later
+        in other places that manually kick off the memory pressure handling
+        procedure.
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (WebInstallMemoryPressureHandler):
+
</ins><span class="cx"> 2016-02-22  Jer Noble  &lt;jer.noble@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Enable AVFoundationNSURLSessionEnabled by default
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -1101,7 +1101,8 @@
</span><span class="cx">     _private-&gt;page-&gt;settings().setFontFallbackPrefersPictographs(true);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    MemoryPressureHandler::singleton().install();
</del><ins>+    if (![[NSUserDefaults standardUserDefaults] boolForKey:@&quot;WebKitSuppressMemoryPressureHandler&quot;])
+        MemoryPressureHandler::singleton().install();
</ins><span class="cx"> 
</span><span class="cx">     if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_LOCAL_RESOURCE_SECURITY_RESTRICTION)) {
</span><span class="cx">         // Originally, we allowed all local loads.
</span><span class="lines">@@ -8945,5 +8946,6 @@
</span><span class="cx"> 
</span><span class="cx"> void WebInstallMemoryPressureHandler(void)
</span><span class="cx"> {
</span><del>-    MemoryPressureHandler::singleton().install();
</del><ins>+    if (![[NSUserDefaults standardUserDefaults] boolForKey:@&quot;WebKitSuppressMemoryPressureHandler&quot;])
+        MemoryPressureHandler::singleton().install();
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit2/ChangeLog        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -1,3 +1,71 @@
</span><ins>+2016-02-22  Keith Rollin  &lt;krollin@apple.com&gt;
+
+        Add mechanism to disable memory pressure handling
+        https://bugs.webkit.org/show_bug.cgi?id=154254
+        &lt;rdar://problem/24662616&gt;
+
+        Reviewed by Chris Dumez.
+
+        Add a mechanism to disable WebKit's response to memory pressure
+        triggers. This was asked for by another group for testing purposes.
+
+        In order to disable WebKit's memory pressure handling, execute the
+        following from the command line:
+
+            defaults write com.apple.Safari WebKitSuppressMemoryPressureHandler -bool true
+
+        To revert to standard behavior, delete the key or set it to False.
+
+        This flag is used when a new sub-process is being spawned. The value
+        is read and stored in an initialization parameter block, which is then
+        sent to the new sub-process.
+
+        In actuality, only the UI, WebContent, and Network processes heed the
+        flag. The Plugin process isn't instrumented to heed this flag for
+        three reasons. First, the Plugin process installs its memory pressure
+        handler in initializeProcess, not initializePluginProcess. This is
+        contrary to when the other processes install their handlers, which is
+        in initialize&lt;PluginType&gt;Process, not initializeProcess. So in order
+        to accomodate the Plugin process, we'd need to modify
+        ChildProcessInitializationParameters. Doing this is awkward at best,
+        but also seems to be opposed to what's supposed to be done in
+        initializeProcess and conveyed in
+        ChildProcessInitializationParameters. And even if we did add a boolean
+        to this structure and added support for conveying it through the XPC
+        port, it would end up being a Plugin process-only boolean in a general
+        parameter block, which seems asymmetric with the other processes.
+        Second, there's no convenient Cocoa function called in the flow that
+        spawns the Plugin process, meaning that there's no convenient place to
+        call NSUserDefaults to get the flag's value. And third, the Plugin
+        process doesn't elegantly respond to the memory pressure trigger
+        anyway. It might terminate itself, but that's it. As for the Database
+        process, it doesn't seem to support responding to memory pressure at
+        all, so we don't send it a flag telling it to ignore it.
+
+        Internally, the memory pressure handler is suppressed by not calling
+        MemoryPressureHandler::install() if the flag is set. In the case of
+        the Network process, the flag is saved so that it can be checked later
+        in other places that manually kick off the memory pressure handling
+        procedure.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::lowMemoryHandler):
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        * NetworkProcess/NetworkProcess.h:
+        * NetworkProcess/NetworkProcessCreationParameters.cpp:
+        (WebKit::NetworkProcessCreationParameters::encode):
+        (WebKit::NetworkProcessCreationParameters::decode):
+        * NetworkProcess/NetworkProcessCreationParameters.h:
+        * Shared/WebProcessCreationParameters.cpp:
+        (WebKit::WebProcessCreationParameters::encode):
+        (WebKit::WebProcessCreationParameters::decode):
+        * Shared/WebProcessCreationParameters.h:
+        * UIProcess/Cocoa/WebProcessPoolCocoa.mm:
+        (WebKit::WebProcessPool::platformInitializeWebProcess):
+        (WebKit::WebProcessPool::platformInitializeNetworkProcess):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+
</ins><span class="cx"> 2016-02-22  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Get rid of WKPluginSiteDataManager
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -175,6 +175,9 @@
</span><span class="cx"> 
</span><span class="cx"> void NetworkProcess::lowMemoryHandler(Critical critical)
</span><span class="cx"> {
</span><ins>+    if (m_suppressMemoryPressureHandler)
+        return;
+
</ins><span class="cx">     platformLowMemoryHandler(critical);
</span><span class="cx">     WTF::releaseFastMallocFreeMemory();
</span><span class="cx"> }
</span><span class="lines">@@ -185,11 +188,14 @@
</span><span class="cx"> 
</span><span class="cx">     WTF::setCurrentThreadIsUserInitiated();
</span><span class="cx"> 
</span><del>-    auto&amp; memoryPressureHandler = MemoryPressureHandler::singleton();
-    memoryPressureHandler.setLowMemoryHandler([this] (Critical critical, Synchronous) {
-        lowMemoryHandler(critical);
-    });
-    memoryPressureHandler.install();
</del><ins>+    m_suppressMemoryPressureHandler = parameters.shouldSuppressMemoryPressureHandler;
+    if (!m_suppressMemoryPressureHandler) {
+        auto&amp; memoryPressureHandler = MemoryPressureHandler::singleton();
+        memoryPressureHandler.setLowMemoryHandler([this] (Critical critical, Synchronous) {
+            lowMemoryHandler(critical);
+        });
+        memoryPressureHandler.install();
+    }
</ins><span class="cx"> 
</span><span class="cx">     m_diskCacheIsDisabledForTesting = parameters.shouldUseTestingNetworkSession;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -179,6 +179,7 @@
</span><span class="cx">     bool m_hasSetCacheModel;
</span><span class="cx">     CacheModel m_cacheModel;
</span><span class="cx">     int64_t m_diskCacheSizeOverride { -1 };
</span><ins>+    bool m_suppressMemoryPressureHandler { false };
</ins><span class="cx">     bool m_diskCacheIsDisabledForTesting;
</span><span class="cx">     bool m_canHandleHTTPSServerTrustEvaluation;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcessCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.cpp        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -64,6 +64,7 @@
</span><span class="cx">     encoder &lt;&lt; containerCachesDirectoryExtensionHandle;
</span><span class="cx">     encoder &lt;&lt; parentBundleDirectoryExtensionHandle;
</span><span class="cx"> #endif
</span><ins>+    encoder &lt;&lt; shouldSuppressMemoryPressureHandler;
</ins><span class="cx">     encoder &lt;&lt; shouldUseTestingNetworkSession;
</span><span class="cx">     encoder &lt;&lt; urlSchemesRegisteredForCustomProtocols;
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="lines">@@ -126,6 +127,8 @@
</span><span class="cx">     if (!decoder.decode(result.parentBundleDirectoryExtensionHandle))
</span><span class="cx">         return false;
</span><span class="cx"> #endif
</span><ins>+    if (!decoder.decode(result.shouldSuppressMemoryPressureHandler))
+        return false;
</ins><span class="cx">     if (!decoder.decode(result.shouldUseTestingNetworkSession))
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(result.urlSchemesRegisteredForCustomProtocols))
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcessCreationParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcessCreationParameters.h        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -73,6 +73,7 @@
</span><span class="cx">     SandboxExtension::Handle containerCachesDirectoryExtensionHandle;
</span><span class="cx">     SandboxExtension::Handle parentBundleDirectoryExtensionHandle;
</span><span class="cx"> #endif
</span><ins>+    bool shouldSuppressMemoryPressureHandler { false };
</ins><span class="cx">     bool shouldUseTestingNetworkSession;
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;String&gt; urlSchemesRegisteredForCustomProtocols;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebProcessCreationParameterscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.cpp        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -97,6 +97,7 @@
</span><span class="cx">     encoder.encodeEnum(cacheModel);
</span><span class="cx">     encoder &lt;&lt; shouldAlwaysUseComplexTextCodePath;
</span><span class="cx">     encoder &lt;&lt; shouldEnableMemoryPressureReliefLogging;
</span><ins>+    encoder &lt;&lt; shouldSuppressMemoryPressureHandler;
</ins><span class="cx">     encoder &lt;&lt; shouldUseFontSmoothing;
</span><span class="cx">     encoder &lt;&lt; fontWhitelist;
</span><span class="cx">     encoder &lt;&lt; iconDatabaseEnabled;
</span><span class="lines">@@ -215,6 +216,8 @@
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(parameters.shouldEnableMemoryPressureReliefLogging))
</span><span class="cx">         return false;
</span><ins>+    if (!decoder.decode(parameters.shouldSuppressMemoryPressureHandler))
+        return false;
</ins><span class="cx">     if (!decoder.decode(parameters.shouldUseFontSmoothing))
</span><span class="cx">         return false;
</span><span class="cx">     if (!decoder.decode(parameters.fontWhitelist))
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedWebProcessCreationParametersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit2/Shared/WebProcessCreationParameters.h        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -105,6 +105,7 @@
</span><span class="cx"> 
</span><span class="cx">     bool shouldAlwaysUseComplexTextCodePath;
</span><span class="cx">     bool shouldEnableMemoryPressureReliefLogging;
</span><ins>+    bool shouldSuppressMemoryPressureHandler { false };
</ins><span class="cx">     bool shouldUseFontSmoothing;
</span><span class="cx"> 
</span><span class="cx">     Vector&lt;String&gt; fontWhitelist;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCocoaWebProcessPoolCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/WebProcessPoolCocoa.mm        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -84,6 +84,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+static NSString * const WebKitSuppressMemoryPressureHandlerDefaultsKey = @&quot;WebKitSuppressMemoryPressureHandler&quot;;
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx"> NSString *WebKitTabSuspension = @&quot;WebKitTabSuspension&quot;;
</span><span class="cx"> #endif
</span><span class="lines">@@ -178,13 +180,16 @@
</span><span class="cx">     parameters.accessibilityEnhancedUserInterfaceEnabled = false;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
+
</ins><span class="cx"> #if PLATFORM(MAC)
</span><del>-    parameters.shouldEnableTabSuspension = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitTabSuspension];
</del><ins>+    parameters.shouldEnableTabSuspension = [defaults boolForKey:WebKitTabSuspension];
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    parameters.shouldEnableJIT = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitJSCJITEnabledDefaultsKey];
-    parameters.shouldEnableFTLJIT = [[NSUserDefaults standardUserDefaults] boolForKey:WebKitJSCFTLJITEnabledDefaultsKey];
-    parameters.shouldEnableMemoryPressureReliefLogging = [[NSUserDefaults standardUserDefaults] boolForKey:@&quot;LogMemoryJetsamDetails&quot;];
</del><ins>+    parameters.shouldEnableJIT = [defaults boolForKey:WebKitJSCJITEnabledDefaultsKey];
+    parameters.shouldEnableFTLJIT = [defaults boolForKey:WebKitJSCFTLJITEnabledDefaultsKey];
+    parameters.shouldEnableMemoryPressureReliefLogging = [defaults boolForKey:@&quot;LogMemoryJetsamDetails&quot;];
+    parameters.shouldSuppressMemoryPressureHandler = [defaults boolForKey:WebKitSuppressMemoryPressureHandlerDefaultsKey];
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     parameters.shouldRewriteConstAsVar = applicationIsIBooks();
</span><span class="lines">@@ -260,6 +265,8 @@
</span><span class="cx"> #endif
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+    parameters.shouldSuppressMemoryPressureHandler = [defaults boolForKey:WebKitSuppressMemoryPressureHandlerDefaultsKey];
+
</ins><span class="cx"> #if PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100
</span><span class="cx">     RetainPtr&lt;CFDataRef&gt; cookieStorageData = adoptCF(CFHTTPCookieStorageCreateIdentifyingData(kCFAllocatorDefault, [[NSHTTPCookieStorage sharedHTTPCookieStorage] _cookieStorage]));
</span><span class="cx">     ASSERT(parameters.uiProcessCookieStorageIdentifier.isEmpty());
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessiosWebMemoryPressureHandlerIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.mm (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.mm        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit2/UIProcess/ios/WebMemoryPressureHandlerIOS.mm        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -44,6 +44,9 @@
</span><span class="cx">     // Right now it cannot because WebKit1 and WebKit2 need to be able to coexist in the UI process,
</span><span class="cx">     // and you can only have one WebCore::MemoryPressureHandler.
</span><span class="cx"> 
</span><ins>+    if ([[NSUserDefaults standardUserDefaults] boolForKey:@&quot;WebKitSuppressMemoryPressureHandler&quot;])
+        return;
+
</ins><span class="cx">     _source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYPRESSURE, 0, DISPATCH_MEMORYPRESSURE_WARN, dispatch_get_main_queue());
</span><span class="cx">     dispatch_set_context(_source, this);
</span><span class="cx">     dispatch_source_set_event_handler(_source, ^{
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -252,7 +252,9 @@
</span><span class="cx"> 
</span><span class="cx">     WTF::setCurrentThreadIsUserInitiated();
</span><span class="cx"> 
</span><del>-    MemoryPressureHandler::singleton().install();
</del><ins>+    m_suppressMemoryPressureHandler = parameters.shouldSuppressMemoryPressureHandler;
+    if (!m_suppressMemoryPressureHandler)
+        MemoryPressureHandler::singleton().install();
</ins><span class="cx"> 
</span><span class="cx">     if (!parameters.injectedBundlePath.isEmpty())
</span><span class="cx">         m_injectedBundle = InjectedBundle::create(parameters, transformHandlesToObjects(parameters.initializationUserData.object()).get());
</span><span class="lines">@@ -1175,7 +1177,9 @@
</span><span class="cx"> 
</span><span class="cx"> void WebProcess::actualPrepareToSuspend(ShouldAcknowledgeWhenReadyToSuspend shouldAcknowledgeWhenReadyToSuspend)
</span><span class="cx"> {
</span><del>-    MemoryPressureHandler::singleton().releaseMemory(Critical::Yes, Synchronous::Yes);
</del><ins>+    if (!m_suppressMemoryPressureHandler)
+        MemoryPressureHandler::singleton().releaseMemory(Critical::Yes, Synchronous::Yes);
+
</ins><span class="cx">     setAllLayerTreeStatesFrozen(true);
</span><span class="cx"> 
</span><span class="cx">     if (markAllLayersVolatileIfPossible()) {
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.h (196942 => 196943)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.h        2016-02-22 18:22:27 UTC (rev 196942)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.h        2016-02-22 18:31:03 UTC (rev 196943)
</span><span class="lines">@@ -364,6 +364,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     ShouldAcknowledgeWhenReadyToSuspend m_shouldAcknowledgeWhenReadyToSuspend;
</span><ins>+    bool m_suppressMemoryPressureHandler { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre>
</div>
</div>

</body>
</html>