<!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>[180225] 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/180225">180225</a></dd>
<dt>Author</dt> <dd>cdumez@apple.com</dd>
<dt>Date</dt> <dd>2015-02-17 09:30:34 -0800 (Tue, 17 Feb 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Access MemoryPressureHandler global instance via a singleton() static member function
https://bugs.webkit.org/show_bug.cgi?id=141691

Reviewed by Andreas Kling.

Access MemoryPressureHandler global instance via a singleton() static
Source/WebCore:

member function as per coding style. Also make all other member
functions non-static as callers can just use singleton() to get the
instance and access methods. This avoid having to call
MemoryPressureHandler::singleton() from member functions.

* bindings/js/ScriptController.cpp:
(WebCore::collectGarbageAfterWindowShellDestruction):
* history/PageCache.cpp:
(WebCore::PageCache::canCache):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::commitProvisionalLoad):
* page/FrameView.cpp:
(WebCore::FrameView::willPaintContents):
(WebCore::FrameView::didPaintContents):
(WebCore::FrameView::computeCoverageRect):
* platform/MemoryPressureHandler.cpp:
(WebCore::MemoryPressureHandler::singleton):
(WebCore::MemoryPressureHandler::MemoryPressureHandler):
(WebCore::MemoryPressureHandler::releaseCriticalMemory):
(WebCore::memoryPressureHandler): Deleted.
* platform/MemoryPressureHandler.h:
(WebCore::MemoryPressureHandler::setLowMemoryHandler):
* platform/cocoa/MemoryPressureHandlerCocoa.mm:
(WebCore::MemoryPressureHandler::platformReleaseMemory):
(WebCore::MemoryPressureHandler::install):
(WebCore::MemoryPressureHandler::holdOff):
(WebCore::respondToMemoryPressureCallback):
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::purgeInactiveFontDataIfNeeded):
* platform/ios/LegacyTileCache.mm:
(WebCore::LegacyTileCache::createTilesInActiveGrid):
* platform/ios/LegacyTileGrid.mm:
(WebCore::LegacyTileGrid::shouldUseMinimalTileCoverage):
* platform/ios/LegacyTileLayerPool.mm:
(WebCore::LegacyTileLayerPool::addLayer):
* platform/ios/TileControllerMemoryHandlerIOS.cpp:
(WebCore::TileControllerMemoryHandler::tileControllerGainedUnparentedTiles):
* platform/linux/MemoryPressureHandlerLinux.cpp:
(WebCore::MemoryPressureHandler::waitForMemoryPressureEvent):

Source/WebKit/mac:

member function.

* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(+[WebView registerForMemoryNotifications]):
(+[WebView _isUnderMemoryPressure]):
(+[WebView _clearMemoryPressure]):
(+[WebView _shouldWaitForMemoryClearMessage]):
(WebInstallMemoryPressureHandler):

Source/WebKit2:

member function.

* NetworkProcess/NetworkProcess.cpp:
(WebKit::NetworkProcess::initializeNetworkProcess):
(WebKit::NetworkProcess::lowMemoryHandler): Deleted.
* NetworkProcess/NetworkProcess.h:
* PluginProcess/PluginProcess.cpp:
(WebKit::PluginProcess::initializeProcess):
(WebKit::PluginProcess::lowMemoryHandler): Deleted.
* PluginProcess/PluginProcess.h:
* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects):
* WebProcess/WebProcess.cpp:
(WebKit::WebProcess::initializeWebProcess):
(WebKit::WebProcess::processWillSuspend):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorebindingsjsScriptControllercpp">trunk/Source/WebCore/bindings/js/ScriptController.cpp</a></li>
<li><a href="#trunkSourceWebCorehistoryPageCachecpp">trunk/Source/WebCore/history/PageCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreloaderFrameLoadercpp">trunk/Source/WebCore/loader/FrameLoader.cpp</a></li>
<li><a href="#trunkSourceWebCorepageFrameViewcpp">trunk/Source/WebCore/page/FrameView.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformMemoryPressureHandlercpp">trunk/Source/WebCore/platform/MemoryPressureHandler.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformMemoryPressureHandlerh">trunk/Source/WebCore/platform/MemoryPressureHandler.h</a></li>
<li><a href="#trunkSourceWebCoreplatformcocoaMemoryPressureHandlerCocoamm">trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicsFontCachecpp">trunk/Source/WebCore/platform/graphics/FontCache.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileCachemm">trunk/Source/WebCore/platform/ios/LegacyTileCache.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileGridmm">trunk/Source/WebCore/platform/ios/LegacyTileGrid.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosLegacyTileLayerPoolmm">trunk/Source/WebCore/platform/ios/LegacyTileLayerPool.mm</a></li>
<li><a href="#trunkSourceWebCoreplatformiosTileControllerMemoryHandlerIOScpp">trunk/Source/WebCore/platform/ios/TileControllerMemoryHandlerIOS.cpp</a></li>
<li><a href="#trunkSourceWebCoreplatformlinuxMemoryPressureHandlerLinuxcpp">trunk/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp</a></li>
<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="#trunkSourceWebKit2PluginProcessPluginProcesscpp">trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp</a></li>
<li><a href="#trunkSourceWebKit2PluginProcessPluginProcessh">trunk/Source/WebKit2/PluginProcess/PluginProcess.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm">trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebProcesscpp">trunk/Source/WebKit2/WebProcess/WebProcess.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/ChangeLog        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2015-02-17  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Access MemoryPressureHandler global instance via a singleton() static member function
+        https://bugs.webkit.org/show_bug.cgi?id=141691
+
+        Reviewed by Andreas Kling.
+
+        Access MemoryPressureHandler global instance via a singleton() static
+        member function as per coding style. Also make all other member
+        functions non-static as callers can just use singleton() to get the
+        instance and access methods. This avoid having to call
+        MemoryPressureHandler::singleton() from member functions.
+
+        * bindings/js/ScriptController.cpp:
+        (WebCore::collectGarbageAfterWindowShellDestruction):
+        * history/PageCache.cpp:
+        (WebCore::PageCache::canCache):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::commitProvisionalLoad):
+        * page/FrameView.cpp:
+        (WebCore::FrameView::willPaintContents):
+        (WebCore::FrameView::didPaintContents):
+        (WebCore::FrameView::computeCoverageRect):
+        * platform/MemoryPressureHandler.cpp:
+        (WebCore::MemoryPressureHandler::singleton):
+        (WebCore::MemoryPressureHandler::MemoryPressureHandler):
+        (WebCore::MemoryPressureHandler::releaseCriticalMemory):
+        (WebCore::memoryPressureHandler): Deleted.
+        * platform/MemoryPressureHandler.h:
+        (WebCore::MemoryPressureHandler::setLowMemoryHandler):
+        * platform/cocoa/MemoryPressureHandlerCocoa.mm:
+        (WebCore::MemoryPressureHandler::platformReleaseMemory):
+        (WebCore::MemoryPressureHandler::install):
+        (WebCore::MemoryPressureHandler::holdOff):
+        (WebCore::respondToMemoryPressureCallback):
+        * platform/graphics/FontCache.cpp:
+        (WebCore::FontCache::purgeInactiveFontDataIfNeeded):
+        * platform/ios/LegacyTileCache.mm:
+        (WebCore::LegacyTileCache::createTilesInActiveGrid):
+        * platform/ios/LegacyTileGrid.mm:
+        (WebCore::LegacyTileGrid::shouldUseMinimalTileCoverage):
+        * platform/ios/LegacyTileLayerPool.mm:
+        (WebCore::LegacyTileLayerPool::addLayer):
+        * platform/ios/TileControllerMemoryHandlerIOS.cpp:
+        (WebCore::TileControllerMemoryHandler::tileControllerGainedUnparentedTiles):
+        * platform/linux/MemoryPressureHandlerLinux.cpp:
+        (WebCore::MemoryPressureHandler::waitForMemoryPressureEvent):
+
</ins><span class="cx"> 2015-02-17  Alex Christensen  &lt;achristensen@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove WebCore.exp.in and clean up.
</span></span></pre></div>
<a id="trunkSourceWebCorebindingsjsScriptControllercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/bindings/js/ScriptController.cpp        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -65,7 +65,7 @@
</span><span class="cx"> {
</span><span class="cx">     // Make sure to GC Extra Soon(tm) during memory pressure conditions
</span><span class="cx">     // to soften high peaks of memory usage during navigation.
</span><del>-    if (memoryPressureHandler().isUnderMemoryPressure()) {
</del><ins>+    if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) {
</ins><span class="cx">         // NOTE: We do the collection on next runloop to ensure that there's no pointer
</span><span class="cx">         //       to the window object on the stack.
</span><span class="cx">         gcController().garbageCollectOnNextRunLoop();
</span></span></pre></div>
<a id="trunkSourceWebCorehistoryPageCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/history/PageCache.cpp (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/history/PageCache.cpp        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/history/PageCache.cpp        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -337,7 +337,7 @@
</span><span class="cx">     
</span><span class="cx">     logCanCachePageDecision(*page);
</span><span class="cx"> 
</span><del>-    if (memoryPressureHandler().isUnderMemoryPressure())
</del><ins>+    if (MemoryPressureHandler::singleton().isUnderMemoryPressure())
</ins><span class="cx">         return false;
</span><span class="cx"> 
</span><span class="cx">     // Cache the page, if possible.
</span></span></pre></div>
<a id="trunkSourceWebCoreloaderFrameLoadercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/loader/FrameLoader.cpp        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -1748,7 +1748,7 @@
</span><span class="cx">     // page cache. We could still preemptively prune the page cache while navigating to a cached page if capacity &gt; 1.
</span><span class="cx">     // See &lt;rdar://problem/11779846&gt; for more details.
</span><span class="cx">     if (!cachedPage) {
</span><del>-        if (memoryPressureHandler().isUnderMemoryPressure()) {
</del><ins>+        if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) {
</ins><span class="cx">             LOG(MemoryPressure, &quot;Pruning page cache because under memory pressure at: %s&quot;, __PRETTY_FUNCTION__);
</span><span class="cx">             LOG(PageCache, &quot;Pruning page cache to 0 due to memory pressure&quot;);
</span><span class="cx">             // Don't cache any page if we are under memory pressure.
</span></span></pre></div>
<a id="trunkSourceWebCorepageFrameViewcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/FrameView.cpp (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/FrameView.cpp        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/page/FrameView.cpp        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -3784,7 +3784,7 @@
</span><span class="cx"> 
</span><span class="cx">     paintingState.isTopLevelPainter = !sCurrentPaintTimeStamp;
</span><span class="cx"> 
</span><del>-    if (paintingState.isTopLevelPainter &amp;&amp; memoryPressureHandler().isUnderMemoryPressure()) {
</del><ins>+    if (paintingState.isTopLevelPainter &amp;&amp; MemoryPressureHandler::singleton().isUnderMemoryPressure()) {
</ins><span class="cx">         LOG(MemoryPressure, &quot;Under memory pressure: %s&quot;, WTF_PRETTY_FUNCTION);
</span><span class="cx"> 
</span><span class="cx">         // To avoid unnecessary image decoding, we don't prune recently-decoded live resources here since
</span><span class="lines">@@ -3828,7 +3828,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Painting can lead to decoding of large amounts of bitmaps
</span><span class="cx">     // If we are low on memory, wipe them out after the paint.
</span><del>-    if (paintingState.isTopLevelPainter &amp;&amp; memoryPressureHandler().isUnderMemoryPressure())
</del><ins>+    if (paintingState.isTopLevelPainter &amp;&amp; MemoryPressureHandler::singleton().isUnderMemoryPressure())
</ins><span class="cx">         MemoryCache::singleton().pruneLiveResources(true);
</span><span class="cx"> 
</span><span class="cx">     // Regions may have changed as a result of the visibility/z-index of element changing.
</span><span class="lines">@@ -4505,7 +4505,7 @@
</span><span class="cx"> FloatRect FrameView::computeCoverageRect(double horizontalMargin, double verticalMargin) const
</span><span class="cx"> {
</span><span class="cx">     FloatRect exposedContentRect = this-&gt;exposedContentRect();
</span><del>-    if (!m_speculativeTilingEnabled || memoryPressureHandler().isUnderMemoryPressure())
</del><ins>+    if (!m_speculativeTilingEnabled || MemoryPressureHandler::singleton().isUnderMemoryPressure())
</ins><span class="cx">         return exposedContentRect;
</span><span class="cx"> 
</span><span class="cx">     double currentTime = monotonicallyIncreasingTime();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMemoryPressureHandlercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MemoryPressureHandler.cpp (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MemoryPressureHandler.cpp        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/platform/MemoryPressureHandler.cpp        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -46,16 +46,16 @@
</span><span class="cx"> 
</span><span class="cx"> WEBCORE_EXPORT bool MemoryPressureHandler::ReliefLogger::s_loggingEnabled = false;
</span><span class="cx"> 
</span><del>-MemoryPressureHandler&amp; memoryPressureHandler()
</del><ins>+MemoryPressureHandler&amp; MemoryPressureHandler::singleton()
</ins><span class="cx"> {
</span><del>-    DEPRECATED_DEFINE_STATIC_LOCAL(MemoryPressureHandler, staticMemoryPressureHandler, ());
-    return staticMemoryPressureHandler;
</del><ins>+    static NeverDestroyed&lt;MemoryPressureHandler&gt; memoryPressureHandler;
+    return memoryPressureHandler;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> MemoryPressureHandler::MemoryPressureHandler() 
</span><span class="cx">     : m_installed(false)
</span><span class="cx">     , m_lastRespondTime(0)
</span><del>-    , m_lowMemoryHandler(releaseMemory)
</del><ins>+    , m_lowMemoryHandler([this] (bool critical) { releaseMemory(critical); })
</ins><span class="cx">     , m_underMemoryPressure(false)
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx">     // FIXME: Can we share more of this with OpenSource?
</span><span class="lines">@@ -101,7 +101,7 @@
</span><span class="cx">     {
</span><span class="cx">         ReliefLogger log(&quot;Empty the PageCache&quot;);
</span><span class="cx">         // Right now, the only reason we call release critical memory while not under memory pressure is if the process is about to be suspended.
</span><del>-        PruningReason pruningReason = memoryPressureHandler().isUnderMemoryPressure() ? PruningReason::MemoryPressure : PruningReason::ProcessSuspended;
</del><ins>+        PruningReason pruningReason = isUnderMemoryPressure() ? PruningReason::MemoryPressure : PruningReason::ProcessSuspended;
</ins><span class="cx">         PageCache::singleton().pruneToSizeNow(0, pruningReason);
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMemoryPressureHandlerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MemoryPressureHandler.h (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MemoryPressureHandler.h        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/platform/MemoryPressureHandler.h        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -28,8 +28,10 @@
</span><span class="cx"> #define MemoryPressureHandler_h
</span><span class="cx"> 
</span><span class="cx"> #include &lt;atomic&gt;
</span><del>-#include &lt;time.h&gt;
</del><ins>+#include &lt;ctime&gt;
+#include &lt;functional&gt;
</ins><span class="cx"> #include &lt;wtf/FastMalloc.h&gt;
</span><ins>+#include &lt;wtf/Forward.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> #include &lt;wtf/ThreadingPrimitives.h&gt;
</span><span class="lines">@@ -47,12 +49,13 @@
</span><span class="cx"> };
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-typedef void (*LowMemoryHandler)(bool critical);
</del><ins>+typedef std::function&lt;void(bool critical)&gt; LowMemoryHandler;
</ins><span class="cx"> 
</span><span class="cx"> class MemoryPressureHandler {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><ins>+    friend class WTF::NeverDestroyed&lt;MemoryPressureHandler&gt;;
</ins><span class="cx"> public:
</span><del>-    friend MemoryPressureHandler&amp; memoryPressureHandler();
</del><ins>+    WEBCORE_EXPORT static MemoryPressureHandler&amp; singleton();
</ins><span class="cx"> 
</span><span class="cx">     WEBCORE_EXPORT void install();
</span><span class="cx"> 
</span><span class="lines">@@ -104,21 +107,21 @@
</span><span class="cx">         static bool s_loggingEnabled;
</span><span class="cx">     };
</span><span class="cx"> 
</span><del>-    WEBCORE_EXPORT static void releaseMemory(bool critical);
</del><ins>+    WEBCORE_EXPORT void releaseMemory(bool critical);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><del>-    static void releaseNoncriticalMemory();
-    static void releaseCriticalMemory();
</del><ins>+    void releaseNoncriticalMemory();
+    void releaseCriticalMemory();
</ins><span class="cx"> 
</span><span class="cx">     void uninstall();
</span><span class="cx"> 
</span><span class="cx">     void holdOff(unsigned);
</span><span class="cx"> 
</span><span class="cx">     MemoryPressureHandler();
</span><del>-    ~MemoryPressureHandler();
</del><ins>+    ~MemoryPressureHandler() = delete;
</ins><span class="cx"> 
</span><span class="cx">     void respondToMemoryPressure(bool critical);
</span><del>-    static void platformReleaseMemory(bool critical);
</del><ins>+    void platformReleaseMemory(bool critical);
</ins><span class="cx"> 
</span><span class="cx">     bool m_installed;
</span><span class="cx">     time_t m_lastRespondTime;
</span><span class="lines">@@ -142,9 +145,6 @@
</span><span class="cx"> #endif
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-// Function to obtain the global memory pressure object.
-WEBCORE_EXPORT MemoryPressureHandler&amp; memoryPressureHandler();
-
</del><span class="cx"> } // namespace WebCore
</span><span class="cx"> 
</span><span class="cx"> #endif // MemoryPressureHandler_h
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaMemoryPressureHandlerCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -61,7 +61,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-    if (memoryPressureHandler().isUnderMemoryPressure()) {
</del><ins>+    if (isUnderMemoryPressure()) {
</ins><span class="cx">         gcController().garbageCollectSoon();
</span><span class="cx">     } else {
</span><span class="cx">         // If we're not under memory pressure, that means we're here due to impending process suspension.
</span><span class="lines">@@ -107,8 +107,9 @@
</span><span class="cx"> #if PLATFORM(IOS) &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 80000
</span><span class="cx">                 unsigned long status = dispatch_source_get_data(_cache_event_source);
</span><span class="cx">                 critical = status == DISPATCH_MEMORYPRESSURE_CRITICAL;
</span><del>-                bool wasCritical = memoryPressureHandler().isUnderMemoryPressure();
-                memoryPressureHandler().setUnderMemoryPressure(critical);
</del><ins>+                auto&amp; memoryPressureHandler = MemoryPressureHandler::singleton();
+                bool wasCritical = memoryPressureHandler.isUnderMemoryPressure();
+                memoryPressureHandler.setUnderMemoryPressure(critical);
</ins><span class="cx">                 if (status == DISPATCH_MEMORYSTATUS_PRESSURE_NORMAL) {
</span><span class="cx">                     if (ReliefLogger::loggingEnabled())
</span><span class="cx">                         NSLog(@&quot;System is no longer under (%s) memory pressure.&quot;, wasCritical ? &quot;critical&quot; : &quot;non-critical&quot;);
</span><span class="lines">@@ -118,7 +119,7 @@
</span><span class="cx">                 if (ReliefLogger::loggingEnabled())
</span><span class="cx">                     NSLog(@&quot;Got memory pressure notification (%s)&quot;, critical ? &quot;critical&quot; : &quot;non-critical&quot;);
</span><span class="cx"> #endif
</span><del>-                memoryPressureHandler().respondToMemoryPressure(critical);
</del><ins>+                MemoryPressureHandler::singleton().respondToMemoryPressure(critical);
</ins><span class="cx">             });
</span><span class="cx">             dispatch_resume(_cache_event_source);
</span><span class="cx">         }
</span><span class="lines">@@ -126,7 +127,7 @@
</span><span class="cx"> 
</span><span class="cx">     // Allow simulation of memory pressure with &quot;notifyutil -p org.WebKit.lowMemory&quot;
</span><span class="cx">     notify_register_dispatch(&quot;org.WebKit.lowMemory&quot;, &amp;_notifyToken, dispatch_get_main_queue(), ^(int) {
</span><del>-        memoryPressureHandler().respondToMemoryPressure(true);
</del><ins>+        MemoryPressureHandler::singleton().respondToMemoryPressure(true);
</ins><span class="cx"> 
</span><span class="cx">         // We only do a synchronous GC when *simulating* memory pressure.
</span><span class="cx">         // This gives us a more consistent picture of live objects at the end of testing.
</span><span class="lines">@@ -180,7 +181,7 @@
</span><span class="cx">                     dispatch_release(_timer_event_source);
</span><span class="cx">                     _timer_event_source = 0;
</span><span class="cx">                 }
</span><del>-                memoryPressureHandler().install();
</del><ins>+                MemoryPressureHandler::singleton().install();
</ins><span class="cx">             });
</span><span class="cx">             dispatch_resume(_timer_event_source);
</span><span class="cx">         }
</span><span class="lines">@@ -238,7 +239,7 @@
</span><span class="cx"> #if PLATFORM(IOS)
</span><span class="cx"> static void respondToMemoryPressureCallback(CFRunLoopObserverRef observer, CFRunLoopActivity /*activity*/, void* /*info*/)
</span><span class="cx"> {
</span><del>-    memoryPressureHandler().respondToMemoryPressureIfNeeded();
</del><ins>+    MemoryPressureHandler::singleton().respondToMemoryPressureIfNeeded();
</ins><span class="cx">     CFRunLoopObserverInvalidate(observer);
</span><span class="cx">     CFRelease(observer);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicsFontCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/FontCache.cpp (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/FontCache.cpp        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/platform/graphics/FontCache.cpp        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -411,7 +411,7 @@
</span><span class="cx"> 
</span><span class="cx"> void FontCache::purgeInactiveFontDataIfNeeded()
</span><span class="cx"> {
</span><del>-    bool underMemoryPressure = memoryPressureHandler().isUnderMemoryPressure();
</del><ins>+    bool underMemoryPressure = MemoryPressureHandler::singleton().isUnderMemoryPressure();
</ins><span class="cx">     int inactiveFontDataLimit = underMemoryPressure ? cMaxUnderMemoryPressureInactiveFontData : cMaxInactiveFontData;
</span><span class="cx"> 
</span><span class="cx">     if (cachedFonts().size() &lt; inactiveFontDataLimit)
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileCachemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/LegacyTileCache.mm (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileCache.mm        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/platform/ios/LegacyTileCache.mm        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -425,7 +425,7 @@
</span><span class="cx"> 
</span><span class="cx"> void LegacyTileCache::createTilesInActiveGrid(SynchronousTileCreationMode mode)
</span><span class="cx"> {
</span><del>-    if (memoryPressureHandler().isUnderMemoryPressure()) {
</del><ins>+    if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) {
</ins><span class="cx">         LOG(MemoryPressure, &quot;Under memory pressure at: %s&quot;, __PRETTY_FUNCTION__);
</span><span class="cx">         removeAllNonVisibleTilesInternal();
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileGridmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/LegacyTileGrid.mm (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileGrid.mm        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/platform/ios/LegacyTileGrid.mm        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -390,7 +390,7 @@
</span><span class="cx"> {
</span><span class="cx">     return m_tileCache-&gt;tilingMode() == LegacyTileCache::Minimal
</span><span class="cx">         || !m_tileCache-&gt;isSpeculativeTileCreationEnabled()
</span><del>-        || memoryPressureHandler().isUnderMemoryPressure();
</del><ins>+        || MemoryPressureHandler::singleton().isUnderMemoryPressure();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> IntRect LegacyTileGrid::adjustCoverRectForPageBounds(const IntRect&amp; rect) const
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosLegacyTileLayerPoolmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/LegacyTileLayerPool.mm (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/LegacyTileLayerPool.mm        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/platform/ios/LegacyTileLayerPool.mm        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -79,7 +79,7 @@
</span><span class="cx">     if (!canReuseLayerWithSize(layerSize))
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    if (memoryPressureHandler().isUnderMemoryPressure()) {
</del><ins>+    if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) {
</ins><span class="cx">         LOG(MemoryPressure, &quot;Under memory pressure: %s, totalBytes: %d&quot;, __PRETTY_FUNCTION__, m_totalBytes);
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformiosTileControllerMemoryHandlerIOScpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/ios/TileControllerMemoryHandlerIOS.cpp (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/ios/TileControllerMemoryHandlerIOS.cpp        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/platform/ios/TileControllerMemoryHandlerIOS.cpp        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -54,7 +54,7 @@
</span><span class="cx">     m_tileControllers.appendOrMoveToLast(controller);
</span><span class="cx"> 
</span><span class="cx">     // If we are under memory pressure, remove all unparented tiles now.
</span><del>-    if (memoryPressureHandler().isUnderMemoryPressure()) {
</del><ins>+    if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) {
</ins><span class="cx">         trimUnparentedTilesToTarget(0);
</span><span class="cx">         return;
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformlinuxMemoryPressureHandlerLinuxcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -77,15 +77,10 @@
</span><span class="cx">     return String(buffer);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-MemoryPressureHandler::~MemoryPressureHandler()
-{
-    uninstall();
-}
-
</del><span class="cx"> void MemoryPressureHandler::waitForMemoryPressureEvent(void*)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!isMainThread());
</span><del>-    int eventFD = memoryPressureHandler().m_eventFD;
</del><ins>+    int eventFD = MemoryPressureHandler::singleton().m_eventFD;
</ins><span class="cx">     if (!eventFD) {
</span><span class="cx">         LOG(MemoryPressure, &quot;Invalidate eventfd.&quot;);
</span><span class="cx">         return;
</span><span class="lines">@@ -104,9 +99,9 @@
</span><span class="cx">     if (ReliefLogger::loggingEnabled())
</span><span class="cx">         LOG(MemoryPressure, &quot;Got memory pressure notification (%s)&quot;, critical ? &quot;critical&quot; : &quot;non-critical&quot;);
</span><span class="cx"> 
</span><del>-    memoryPressureHandler().setUnderMemoryPressure(critical);
</del><ins>+    MemoryPressureHandler::singleton().setUnderMemoryPressure(critical);
</ins><span class="cx">     callOnMainThread([critical] {
</span><del>-        memoryPressureHandler().respondToMemoryPressure(critical);
</del><ins>+        MemoryPressureHandler::singleton().respondToMemoryPressure(critical);
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebKit/mac/ChangeLog        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -1,3 +1,21 @@
</span><ins>+2015-02-17  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Access MemoryPressureHandler global instance via a singleton() static member function
+        https://bugs.webkit.org/show_bug.cgi?id=141691
+
+        Reviewed by Andreas Kling.
+
+        Access MemoryPressureHandler global instance via a singleton() static
+        member function.
+
+        * WebView/WebView.mm:
+        (-[WebView _commonInitializationWithFrameName:groupName:]):
+        (+[WebView registerForMemoryNotifications]):
+        (+[WebView _isUnderMemoryPressure]):
+        (+[WebView _clearMemoryPressure]):
+        (+[WebView _shouldWaitForMemoryClearMessage]):
+        (WebInstallMemoryPressureHandler):
+
</ins><span class="cx"> 2015-02-15  Sam Weinig  &lt;sam@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Add experimental &lt;attachment&gt; element support
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -1054,7 +1054,7 @@
</span><span class="cx">     _private-&gt;page-&gt;settings().setFontFallbackPrefersPictographs(true);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    memoryPressureHandler().install();
</del><ins>+    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">@@ -1263,14 +1263,14 @@
</span><span class="cx"> {
</span><span class="cx">     BOOL shouldAutoClearPressureOnMemoryRelease = !WebCore::applicationIsMobileSafari();
</span><span class="cx"> 
</span><del>-    memoryPressureHandler().installMemoryReleaseBlock(^{
</del><ins>+    MemoryPressureHandler::singleton().installMemoryReleaseBlock(^{
</ins><span class="cx">         [WebView _handleMemoryWarning];
</span><span class="cx">     }, shouldAutoClearPressureOnMemoryRelease);
</span><span class="cx"> 
</span><span class="cx">     static dispatch_source_t memoryNotificationEventSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYSTATUS, 0, DISPATCH_MEMORYSTATUS_PRESSURE_WARN, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
</span><span class="cx">     dispatch_source_set_event_handler(memoryNotificationEventSource, ^{
</span><span class="cx">         // Set memory pressure flag and schedule releasing memory in web thread runloop exit.
</span><del>-        memoryPressureHandler().setReceivedMemoryPressure(WebCore::MemoryPressureReasonVMPressure);
</del><ins>+        MemoryPressureHandler::singleton().setReceivedMemoryPressure(WebCore::MemoryPressureReasonVMPressure);
</ins><span class="cx">     });
</span><span class="cx"> 
</span><span class="cx">     dispatch_resume(memoryNotificationEventSource);
</span><span class="lines">@@ -1284,9 +1284,9 @@
</span><span class="cx">         dispatch_source_set_event_handler(memoryStatusEventSource, ^{
</span><span class="cx">             unsigned long currentStatus = dispatch_source_get_data(memoryStatusEventSource);
</span><span class="cx">             if (currentStatus == DISPATCH_MEMORYSTATUS_PRESSURE_NORMAL)
</span><del>-                memoryPressureHandler().clearMemoryPressure();
</del><ins>+                MemoryPressureHandler::singleton().clearMemoryPressure();
</ins><span class="cx">             else if (currentStatus == DISPATCH_MEMORYSTATUS_PRESSURE_WARN)
</span><del>-                memoryPressureHandler().setReceivedMemoryPressure(WebCore::MemoryPressureReasonVMStatus);
</del><ins>+                MemoryPressureHandler::singleton().setReceivedMemoryPressure(WebCore::MemoryPressureReasonVMStatus);
</ins><span class="cx">         });
</span><span class="cx"> 
</span><span class="cx">         dispatch_resume(memoryStatusEventSource);
</span><span class="lines">@@ -1610,17 +1610,17 @@
</span><span class="cx"> 
</span><span class="cx"> + (BOOL)_isUnderMemoryPressure
</span><span class="cx"> {
</span><del>-    return memoryPressureHandler().isUnderMemoryPressure();
</del><ins>+    return MemoryPressureHandler::singleton().isUnderMemoryPressure();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (void)_clearMemoryPressure
</span><span class="cx"> {
</span><del>-    memoryPressureHandler().clearMemoryPressure();
</del><ins>+    MemoryPressureHandler::singleton().clearMemoryPressure();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> + (BOOL)_shouldWaitForMemoryClearMessage
</span><span class="cx"> {
</span><del>-    return memoryPressureHandler().shouldWaitForMemoryClearMessage();
</del><ins>+    return MemoryPressureHandler::singleton().shouldWaitForMemoryClearMessage();
</ins><span class="cx"> }
</span><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="lines">@@ -8813,5 +8813,5 @@
</span><span class="cx"> 
</span><span class="cx"> void WebInstallMemoryPressureHandler(void)
</span><span class="cx"> {
</span><del>-    memoryPressureHandler().install();
</del><ins>+    MemoryPressureHandler::singleton().install();
</ins><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebKit2/ChangeLog        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-02-17  Chris Dumez  &lt;cdumez@apple.com&gt;
+
+        Access MemoryPressureHandler global instance via a singleton() static member function
+        https://bugs.webkit.org/show_bug.cgi?id=141691
+
+        Reviewed by Andreas Kling.
+
+        Access MemoryPressureHandler global instance via a singleton() static
+        member function.
+
+        * NetworkProcess/NetworkProcess.cpp:
+        (WebKit::NetworkProcess::initializeNetworkProcess):
+        (WebKit::NetworkProcess::lowMemoryHandler): Deleted.
+        * NetworkProcess/NetworkProcess.h:
+        * PluginProcess/PluginProcess.cpp:
+        (WebKit::PluginProcess::initializeProcess):
+        (WebKit::PluginProcess::lowMemoryHandler): Deleted.
+        * PluginProcess/PluginProcess.h:
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::updateVisibleContentRects):
+        * WebProcess/WebProcess.cpp:
+        (WebKit::WebProcess::initializeWebProcess):
+        (WebKit::WebProcess::processWillSuspend):
+
</ins><span class="cx"> 2015-02-16  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] WebKitFrame objects are never released
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.cpp        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -161,8 +161,12 @@
</span><span class="cx"> 
</span><span class="cx">     WTF::setCurrentThreadIsUserInitiated();
</span><span class="cx"> 
</span><del>-    memoryPressureHandler().setLowMemoryHandler(lowMemoryHandler);
-    memoryPressureHandler().install();
</del><ins>+    auto&amp; memoryPressureHandler = MemoryPressureHandler::singleton();
+    memoryPressureHandler.setLowMemoryHandler([this] (bool critical) {
+        platformLowMemoryHandler(critical);
+        WTF::releaseFastMallocFreeMemory();
+    });
+    memoryPressureHandler.install();
</ins><span class="cx"> 
</span><span class="cx">     m_diskCacheIsDisabledForTesting = parameters.shouldUseTestingNetworkSession;
</span><span class="cx">     setCacheModel(static_cast&lt;uint32_t&gt;(parameters.cacheModel));
</span><span class="lines">@@ -322,12 +326,6 @@
</span><span class="cx">     ChildProcess::terminate();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void NetworkProcess::lowMemoryHandler(bool critical)
-{
-    platformLowMemoryHandler(critical);
-    WTF::releaseFastMallocFreeMemory();
-}
-
</del><span class="cx"> #if !PLATFORM(COCOA)
</span><span class="cx"> void NetworkProcess::initializeProcess(const ChildProcessInitializationParameters&amp;)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceWebKit2NetworkProcessNetworkProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkProcess.h        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -90,8 +90,7 @@
</span><span class="cx">     virtual void terminate() override;
</span><span class="cx">     void platformTerminate();
</span><span class="cx"> 
</span><del>-    static void lowMemoryHandler(bool critical);
-    static void platformLowMemoryHandler(bool critical);
</del><ins>+    void platformLowMemoryHandler(bool critical);
</ins><span class="cx"> 
</span><span class="cx">     // ChildProcess
</span><span class="cx">     virtual void initializeProcess(const ChildProcessInitializationParameters&amp;) override;
</span></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessPluginProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebKit2/PluginProcess/PluginProcess.cpp        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -67,21 +67,17 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void PluginProcess::lowMemoryHandler(bool critical)
-{
-    UNUSED_PARAM(critical);
-    auto&amp; pluginProcess = PluginProcess::singleton();
-    if (pluginProcess.shouldTerminate())
-        pluginProcess.terminate();
-}
-
</del><span class="cx"> void PluginProcess::initializeProcess(const ChildProcessInitializationParameters&amp; parameters)
</span><span class="cx"> {
</span><span class="cx">     m_pluginPath = parameters.extraInitializationData.get(&quot;plugin-path&quot;);
</span><span class="cx">     platformInitializeProcess(parameters);
</span><span class="cx"> 
</span><del>-    memoryPressureHandler().setLowMemoryHandler(lowMemoryHandler);
-    memoryPressureHandler().install();
</del><ins>+    auto&amp; memoryPressureHandler = MemoryPressureHandler::singleton();
+    memoryPressureHandler.setLowMemoryHandler([this] (bool) {
+        if (shouldTerminate())
+            terminate();
+    });
+    memoryPressureHandler.install();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void PluginProcess::removeWebProcessConnection(WebProcessConnection* webProcessConnection)
</span></span></pre></div>
<a id="trunkSourceWebKit2PluginProcessPluginProcessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PluginProcess/PluginProcess.h (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PluginProcess/PluginProcess.h        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebKit2/PluginProcess/PluginProcess.h        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -134,7 +134,6 @@
</span><span class="cx">     String m_nsurlCacheDirectory;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><del>-    static void lowMemoryHandler(bool critical);
</del><span class="cx">     CountedUserActivity m_connectionActivity;
</span><span class="cx"> 
</span><span class="cx">     RefPtr&lt;WebCore::AudioHardwareListener&gt; m_audioHardwareListener;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageiosWebPageIOSmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -2648,7 +2648,7 @@
</span><span class="cx">     double boundedScale = std::min(m_viewportConfiguration.maximumScale(), std::max(m_viewportConfiguration.minimumScale(), filteredScale));
</span><span class="cx"> 
</span><span class="cx">     // Skip progressively redrawing tiles if pinch-zooming while the system is under memory pressure.
</span><del>-    if (boundedScale != currentScale &amp;&amp; !m_isInStableState &amp;&amp; memoryPressureHandler().isUnderMemoryPressure())
</del><ins>+    if (boundedScale != currentScale &amp;&amp; !m_isInStableState &amp;&amp; MemoryPressureHandler::singleton().isUnderMemoryPressure())
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><span class="cx">     if (m_isInStableState)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebProcesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebProcess.cpp (180224 => 180225)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2015-02-17 17:23:54 UTC (rev 180224)
+++ trunk/Source/WebKit2/WebProcess/WebProcess.cpp        2015-02-17 17:30:34 UTC (rev 180225)
</span><span class="lines">@@ -284,7 +284,7 @@
</span><span class="cx"> 
</span><span class="cx">     WTF::setCurrentThreadIsUserInitiated();
</span><span class="cx"> 
</span><del>-    memoryPressureHandler().install();
</del><ins>+    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">@@ -1163,7 +1163,7 @@
</span><span class="cx">     
</span><span class="cx"> void WebProcess::processWillSuspend()
</span><span class="cx"> {
</span><del>-    memoryPressureHandler().releaseMemory(true);
</del><ins>+    MemoryPressureHandler::singleton().releaseMemory(true);
</ins><span class="cx">     setAllLayerTreeStatesFrozen(true);
</span><span class="cx"> 
</span><span class="cx">     if (!markAllLayersVolatileIfPossible())
</span></span></pre>
</div>
</div>

</body>
</html>