<!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>[212742] 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/212742">212742</a></dd>
<dt>Author</dt> <dd>akling@apple.com</dd>
<dt>Date</dt> <dd>2017-02-21 13:04:50 -0800 (Tue, 21 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>[iOS] WebKit1 should use shared memory pressure handler code.
&lt;https://webkit.org/b/168653&gt;

Reviewed by Antti Koivisto.

Source/WebCore:

Remove iOS WebKit1 specific members and code from MemoryPressureHandler in favor
of using the same code that iOS WebKit2 and macOS WebKit uses.

* page/cocoa/MemoryReleaseCocoa.mm:
(WebCore::platformReleaseMemory): Add two cleanup calls that were only in the iOS WebView code.
* platform/MemoryPressureHandler.h:
(WebCore::MemoryPressureHandler::m_releaseMemoryBlock): Deleted.
* platform/cocoa/MemoryPressureHandlerCocoa.mm:
(WebCore::respondToMemoryPressureCallback): Deleted.
(WebCore::MemoryPressureHandler::installMemoryReleaseBlock): Deleted.
(WebCore::MemoryPressureHandler::setReceivedMemoryPressure): Deleted.
(WebCore::MemoryPressureHandler::clearMemoryPressure): Deleted.
(WebCore::MemoryPressureHandler::shouldWaitForMemoryClearMessage): Deleted.
(WebCore::MemoryPressureHandler::respondToMemoryPressureIfNeeded): Deleted.

Source/WebKit/ios:

* Misc/WebUIKitSupport.mm:
(WebKitInitialize): Don't unconditionally install a memory warning handler just
because the framework is loaded.

Source/WebKit/mac:

Register a WebThread-aware memory callback with the shared MemoryPressureHandler
and get rid of the old iOS WebKit1 specific implementation. Some of it was even
dead code since MobileSafari has been using WebKit2 for quite a while.

* WebView/WebView.h:
* WebView/WebView.mm:
(WebInstallMemoryPressureHandler):
(+[WebView _handleMemoryWarning]): Deleted.
(+[WebView registerForMemoryNotifications]): Deleted.
(+[WebView releaseFastMallocMemoryOnCurrentThread]): Deleted.
(+[WebView garbageCollectNow]): Deleted.
(+[WebView purgeInactiveFontData]): Deleted.
(+[WebView drainLayerPool]): Deleted.
(+[WebView discardAllCompiledCode]): Deleted.
(+[WebView _clearMemoryPressure]): Deleted.
(+[WebView _shouldWaitForMemoryClearMessage]): Deleted.
* WebView/WebViewPrivate.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorepagecocoaMemoryReleaseCocoamm">trunk/Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm</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="#trunkSourceWebKitiosChangeLog">trunk/Source/WebKit/ios/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitiosMiscWebUIKitSupportmm">trunk/Source/WebKit/ios/Misc/WebUIKitSupport.mm</a></li>
<li><a href="#trunkSourceWebKitmacChangeLog">trunk/Source/WebKit/mac/ChangeLog</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewh">trunk/Source/WebKit/mac/WebView/WebView.h</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewmm">trunk/Source/WebKit/mac/WebView/WebView.mm</a></li>
<li><a href="#trunkSourceWebKitmacWebViewWebViewPrivateh">trunk/Source/WebKit/mac/WebView/WebViewPrivate.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (212741 => 212742)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2017-02-21 21:03:55 UTC (rev 212741)
+++ trunk/Source/WebCore/ChangeLog        2017-02-21 21:04:50 UTC (rev 212742)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2017-02-21  Andreas Kling  &lt;akling@apple.com&gt;
+
+        [iOS] WebKit1 should use shared memory pressure handler code.
+        &lt;https://webkit.org/b/168653&gt;
+
+        Reviewed by Antti Koivisto.
+
+        Remove iOS WebKit1 specific members and code from MemoryPressureHandler in favor
+        of using the same code that iOS WebKit2 and macOS WebKit uses.
+
+        * page/cocoa/MemoryReleaseCocoa.mm:
+        (WebCore::platformReleaseMemory): Add two cleanup calls that were only in the iOS WebView code.
+        * platform/MemoryPressureHandler.h:
+        (WebCore::MemoryPressureHandler::m_releaseMemoryBlock): Deleted.
+        * platform/cocoa/MemoryPressureHandlerCocoa.mm:
+        (WebCore::respondToMemoryPressureCallback): Deleted.
+        (WebCore::MemoryPressureHandler::installMemoryReleaseBlock): Deleted.
+        (WebCore::MemoryPressureHandler::setReceivedMemoryPressure): Deleted.
+        (WebCore::MemoryPressureHandler::clearMemoryPressure): Deleted.
+        (WebCore::MemoryPressureHandler::shouldWaitForMemoryClearMessage): Deleted.
+        (WebCore::MemoryPressureHandler::respondToMemoryPressureIfNeeded): Deleted.
+
</ins><span class="cx"> 2017-02-21  Anders Carlsson  &lt;andersca@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix two failing WebKit legacy tests
</span></span></pre></div>
<a id="trunkSourceWebCorepagecocoaMemoryReleaseCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm (212741 => 212742)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm        2017-02-21 21:03:55 UTC (rev 212741)
+++ trunk/Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm        2017-02-21 21:04:50 UTC (rev 212742)
</span><span class="lines">@@ -32,6 +32,12 @@
</span><span class="cx"> #import &quot;LayerPool.h&quot;
</span><span class="cx"> #import &lt;notify.h&gt;
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+#import &quot;LegacyTileCache.h&quot;
+#import &quot;TileControllerMemoryHandlerIOS.h&quot;
+#endif
+
+
</ins><span class="cx"> extern &quot;C&quot; void _sqlite3_purgeEligiblePagerCacheMemory(void);
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="lines">@@ -47,6 +53,11 @@
</span><span class="cx">     for (auto&amp; pool : LayerPool::allLayerPools())
</span><span class="cx">         pool-&gt;drain();
</span><span class="cx"> 
</span><ins>+#if PLATFORM(IOS)
+    LegacyTileCache::drainLayerPool();
+    tileControllerMemoryHandler().trimUnparentedTilesToTarget(0);
+#endif
+
</ins><span class="cx"> #if USE(IOSURFACE)
</span><span class="cx">     IOSurfacePool::sharedPool().discardAllSurfaces();
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformMemoryPressureHandlerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/MemoryPressureHandler.h (212741 => 212742)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/MemoryPressureHandler.h        2017-02-21 21:03:55 UTC (rev 212741)
+++ trunk/Source/WebCore/platform/MemoryPressureHandler.h        2017-02-21 21:04:50 UTC (rev 212742)
</span><span class="lines">@@ -36,11 +36,6 @@
</span><span class="cx"> #include &lt;wtf/Optional.h&gt;
</span><span class="cx"> #include &lt;wtf/RunLoop.h&gt;
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
-#include &lt;wtf/Lock.h&gt;
-#include &lt;wtf/ThreadingPrimitives.h&gt;
-#endif
-
</del><span class="cx"> #if USE(GLIB)
</span><span class="cx"> #include &lt;wtf/glib/GRefPtr.h&gt;
</span><span class="cx"> #endif
</span><span class="lines">@@ -47,14 +42,6 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
-enum MemoryPressureReason {
-    MemoryPressureReasonNone = 0 &lt;&lt; 0,
-    MemoryPressureReasonVMPressure = 1 &lt;&lt; 0,
-    MemoryPressureReasonVMStatus = 1 &lt;&lt; 1,
-};
-#endif
-
</del><span class="cx"> enum class MemoryUsagePolicy {
</span><span class="cx">     Unrestricted, // Allocate as much as you want
</span><span class="cx">     Conservative, // Maybe you don't cache every single thing
</span><span class="lines">@@ -95,14 +82,7 @@
</span><span class="cx">     }
</span><span class="cx">     void setUnderMemoryPressure(bool b) { m_underMemoryPressure = b; }
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
-    // FIXME: Can we share more of this with OpenSource?
-    WEBCORE_EXPORT void installMemoryReleaseBlock(void (^releaseMemoryBlock)(), bool clearPressureOnMemoryRelease = true);
-    WEBCORE_EXPORT void setReceivedMemoryPressure(MemoryPressureReason);
-    WEBCORE_EXPORT void clearMemoryPressure();
-    WEBCORE_EXPORT bool shouldWaitForMemoryClearMessage();
-    void respondToMemoryPressureIfNeeded();
-#elif OS(LINUX)
</del><ins>+#if OS(LINUX)
</ins><span class="cx">     void setMemoryPressureMonitorHandle(int fd);
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -202,14 +182,7 @@
</span><span class="cx">     WTF::Function&lt;void()&gt; m_memoryKillCallback;
</span><span class="cx">     WTF::Function&lt;bool()&gt; m_processIsEligibleForMemoryKillCallback;
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
-    // FIXME: Can we share more of this with OpenSource?
-    uint32_t m_memoryPressureReason { MemoryPressureReasonNone };
-    bool m_clearPressureOnMemoryRelease { true };
-    void (^m_releaseMemoryBlock)() { nullptr };
-    CFRunLoopObserverRef m_observer { nullptr };
-    Lock m_observerMutex;
-#elif OS(LINUX)
</del><ins>+#if OS(LINUX)
</ins><span class="cx">     std::optional&lt;int&gt; m_eventFD;
</span><span class="cx">     std::optional&lt;int&gt; m_pressureLevelFD;
</span><span class="cx">     std::unique_ptr&lt;EventFDPoller&gt; m_eventFDPoller;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformcocoaMemoryPressureHandlerCocoamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm (212741 => 212742)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm        2017-02-21 21:03:55 UTC (rev 212741)
+++ trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm        2017-02-21 21:04:50 UTC (rev 212742)
</span><span class="lines">@@ -197,73 +197,4 @@
</span><span class="cx">     return MemoryUsage {static_cast&lt;size_t&gt;(vmInfo.internal), static_cast&lt;size_t&gt;(vmInfo.phys_footprint)};
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-#if PLATFORM(IOS)
-static void respondToMemoryPressureCallback(CFRunLoopObserverRef observer, CFRunLoopActivity /*activity*/, void* /*info*/)
-{
-    MemoryPressureHandler::singleton().respondToMemoryPressureIfNeeded();
-    CFRunLoopObserverInvalidate(observer);
-    CFRelease(observer);
-}
-
-void MemoryPressureHandler::installMemoryReleaseBlock(void (^releaseMemoryBlock)(), bool clearPressureOnMemoryRelease)
-{
-    if (m_installed)
-        return;
-    m_releaseMemoryBlock = Block_copy(releaseMemoryBlock);
-    m_clearPressureOnMemoryRelease = clearPressureOnMemoryRelease;
-    m_installed = true;
-}
-
-void MemoryPressureHandler::setReceivedMemoryPressure(MemoryPressureReason reason)
-{
-    m_underMemoryPressure = true;
-
-    {
-        LockHolder locker(m_observerMutex);
-        if (!m_observer) {
-            m_observer = CFRunLoopObserverCreate(NULL, kCFRunLoopBeforeWaiting | kCFRunLoopExit, NO /* don't repeat */,
-                0, WebCore::respondToMemoryPressureCallback, NULL);
-            CFRunLoopAddObserver(WebThreadRunLoop(), m_observer, kCFRunLoopCommonModes);
-            CFRunLoopWakeUp(WebThreadRunLoop());
-        }
-        m_memoryPressureReason |= reason;
-    }
-}
-
-void MemoryPressureHandler::clearMemoryPressure()
-{
-    m_underMemoryPressure = false;
-
-    {
-        LockHolder locker(m_observerMutex);
-        m_memoryPressureReason = MemoryPressureReasonNone;
-    }
-}
-
-bool MemoryPressureHandler::shouldWaitForMemoryClearMessage()
-{
-    LockHolder locker(m_observerMutex);
-    return m_memoryPressureReason &amp; MemoryPressureReasonVMStatus;
-}
-
-void MemoryPressureHandler::respondToMemoryPressureIfNeeded()
-{
-    ASSERT(WebThreadIsLockedOrDisabled());
-
-    {
-        LockHolder locker(m_observerMutex);
-        m_observer = 0;
-    }
-
-    if (isUnderMemoryPressure()) {
-        ASSERT(m_releaseMemoryBlock);
-        LOG(MemoryPressure, &quot;Handle memory pressure at %s&quot;, __PRETTY_FUNCTION__);
-        m_releaseMemoryBlock();
-        if (m_clearPressureOnMemoryRelease)
-            clearMemoryPressure();
-    }
-}
-
-#endif
-
</del><span class="cx"> } // namespace WebCore
</span></span></pre></div>
<a id="trunkSourceWebKitiosChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/ChangeLog (212741 => 212742)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/ChangeLog        2017-02-21 21:03:55 UTC (rev 212741)
+++ trunk/Source/WebKit/ios/ChangeLog        2017-02-21 21:04:50 UTC (rev 212742)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2017-02-21  Andreas Kling  &lt;akling@apple.com&gt;
+
+        [iOS] WebKit1 should use shared memory pressure handler code.
+        &lt;https://webkit.org/b/168653&gt;
+
+        Reviewed by Antti Koivisto.
+
+        * Misc/WebUIKitSupport.mm:
+        (WebKitInitialize): Don't unconditionally install a memory warning handler just
+        because the framework is loaded.
+
</ins><span class="cx"> 2017-02-20  Alexey Proskuryakov  &lt;ap@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         List of WebCore symbols to re-export from WebKitLegacy should be built automatically
</span></span></pre></div>
<a id="trunkSourceWebKitiosMiscWebUIKitSupportmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/ios/Misc/WebUIKitSupport.mm (212741 => 212742)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/ios/Misc/WebUIKitSupport.mm        2017-02-21 21:03:55 UTC (rev 212741)
+++ trunk/Source/WebKit/ios/Misc/WebUIKitSupport.mm        2017-02-21 21:04:50 UTC (rev 212742)
</span><span class="lines">@@ -87,7 +87,6 @@
</span><span class="cx">     // We'd rather eat this cost at startup than slow down situations that need to be responsive.
</span><span class="cx">     // See &lt;rdar://problem/6776301&gt;.
</span><span class="cx">     LoadWebLocalizedStrings();
</span><del>-    [WebView registerForMemoryNotifications];
</del><span class="cx">     
</span><span class="cx">     // This needs to be called before any requests are made in the process, &lt;rdar://problem/9691871&gt;
</span><span class="cx">     WebCore::initializeHTTPConnectionSettingsOnStartup();
</span></span></pre></div>
<a id="trunkSourceWebKitmacChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/ChangeLog (212741 => 212742)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/ChangeLog        2017-02-21 21:03:55 UTC (rev 212741)
+++ trunk/Source/WebKit/mac/ChangeLog        2017-02-21 21:04:50 UTC (rev 212742)
</span><span class="lines">@@ -1,3 +1,28 @@
</span><ins>+2017-02-21  Andreas Kling  &lt;akling@apple.com&gt;
+
+        [iOS] WebKit1 should use shared memory pressure handler code.
+        &lt;https://webkit.org/b/168653&gt;
+
+        Reviewed by Antti Koivisto.
+
+        Register a WebThread-aware memory callback with the shared MemoryPressureHandler
+        and get rid of the old iOS WebKit1 specific implementation. Some of it was even
+        dead code since MobileSafari has been using WebKit2 for quite a while.
+
+        * WebView/WebView.h:
+        * WebView/WebView.mm:
+        (WebInstallMemoryPressureHandler):
+        (+[WebView _handleMemoryWarning]): Deleted.
+        (+[WebView registerForMemoryNotifications]): Deleted.
+        (+[WebView releaseFastMallocMemoryOnCurrentThread]): Deleted.
+        (+[WebView garbageCollectNow]): Deleted.
+        (+[WebView purgeInactiveFontData]): Deleted.
+        (+[WebView drainLayerPool]): Deleted.
+        (+[WebView discardAllCompiledCode]): Deleted.
+        (+[WebView _clearMemoryPressure]): Deleted.
+        (+[WebView _shouldWaitForMemoryClearMessage]): Deleted.
+        * WebView/WebViewPrivate.h:
+
</ins><span class="cx"> 2017-02-20  Aakash Jain  &lt;aakash_jain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Stop exporting interface WebCoreScrollView on iOS
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.h (212741 => 212742)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.h        2017-02-21 21:03:55 UTC (rev 212741)
+++ trunk/Source/WebKit/mac/WebView/WebView.h        2017-02-21 21:04:50 UTC (rev 212742)
</span><span class="lines">@@ -746,12 +746,6 @@
</span><span class="cx"> 
</span><span class="cx"> @interface WebView (WebViewIOS)
</span><span class="cx"> + (void)enableWebThread;
</span><del>-+ (void)garbageCollectNow;
-+ (void)purgeInactiveFontData;
-+ (void)drainLayerPool;
-+ (void)discardAllCompiledCode;
-+ (void)registerForMemoryNotifications;
-+ (void)releaseFastMallocMemoryOnCurrentThread;
</del><span class="cx"> + (BOOL)isCharacterSmartReplaceExempt:(unichar)character isPreviousCharacter:(BOOL)b;
</span><span class="cx"> 
</span><span class="cx"> /*!
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebView.mm (212741 => 212742)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebView.mm        2017-02-21 21:03:55 UTC (rev 212741)
+++ trunk/Source/WebKit/mac/WebView/WebView.mm        2017-02-21 21:04:50 UTC (rev 212742)
</span><span class="lines">@@ -1673,73 +1673,10 @@
</span><span class="cx">     return self;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-+ (void)_handleMemoryWarning
-{
-    ASSERT(WebThreadIsCurrent());
-    WebKit::MemoryMeasure totalMemory(&quot;Memory warning: Overall memory change from [WebView _handleMemoryWarning].&quot;);
-
-    // Always peform the following.
-    [WebView purgeInactiveFontData];
-
-    // Only perform the remaining if a non-simple document was created.
-    if (!didOneTimeInitialization)
-        return;
-
-    tileControllerMemoryHandler().trimUnparentedTilesToTarget(0);
-
-    [WebStorageManager closeIdleLocalStorageDatabases];
-    StorageThread::releaseFastMallocFreeMemoryInAllThreads();
-
-    [WebView _releaseMemoryNow];
-}
-
-+ (void)registerForMemoryNotifications
-{
-    BOOL shouldAutoClearPressureOnMemoryRelease = !WebCore::IOSApplication::isMobileSafari();
-
-    MemoryPressureHandler::singleton().installMemoryReleaseBlock(^{
-        [WebView _handleMemoryWarning];
-    }, shouldAutoClearPressureOnMemoryRelease);
-
-    static dispatch_source_t memoryNotificationEventSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYPRESSURE, 0, DISPATCH_MEMORYPRESSURE_WARN, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
-    dispatch_source_set_event_handler(memoryNotificationEventSource, ^{
-        // Set memory pressure flag and schedule releasing memory in web thread runloop exit.
-        MemoryPressureHandler::singleton().setReceivedMemoryPressure(WebCore::MemoryPressureReasonVMPressure);
-    });
-
-    dispatch_resume(memoryNotificationEventSource);
-
-    if (!shouldAutoClearPressureOnMemoryRelease) {
-        // Listen to memory status notification to reset the memory pressure flag.
-        static dispatch_source_t memoryStatusEventSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYPRESSURE,
-                                                                                    0,
-                                                                                    DISPATCH_MEMORYPRESSURE_WARN | DISPATCH_MEMORYPRESSURE_NORMAL,
-                                                                                    dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
-        dispatch_source_set_event_handler(memoryStatusEventSource, ^{
-            unsigned long currentStatus = dispatch_source_get_data(memoryStatusEventSource);
-            if (currentStatus == DISPATCH_MEMORYPRESSURE_NORMAL)
-                MemoryPressureHandler::singleton().clearMemoryPressure();
-            else if (currentStatus == DISPATCH_MEMORYPRESSURE_WARN)
-                MemoryPressureHandler::singleton().setReceivedMemoryPressure(WebCore::MemoryPressureReasonVMStatus);
-        });
-
-        dispatch_resume(memoryStatusEventSource);
-    }
-}
-
</del><span class="cx"> + (void)_releaseMemoryNow
</span><span class="cx"> {
</span><del>-    ASSERT(WebThreadIsCurrent());
-    [WebView discardAllCompiledCode];
-    [WebView garbageCollectNow];
-    [WebView purgeInactiveFontData];
-    [WebView drainLayerPool];
-    [WebCache emptyInMemoryResources];
-    [WebView releaseFastMallocMemoryOnCurrentThread];
-
-    dispatch_async(dispatch_get_main_queue(), ^{
-        // Clear the main thread's TCMalloc thread cache.
-        [WebView releaseFastMallocMemoryOnCurrentThread];
</del><ins>+    WebThreadRun(^{
+        WebCore::releaseMemory(Critical::Yes, Synchronous::Yes);
</ins><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1758,40 +1695,6 @@
</span><span class="cx">     });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-+ (void)releaseFastMallocMemoryOnCurrentThread
-{
-    WebKit::MemoryMeasure measurer(&quot;Memory warning: Releasing fast malloc memory to system.&quot;);
-    WTF::releaseFastMallocFreeMemory();
-}
-
-+ (void)garbageCollectNow
-{
-    ASSERT(WebThreadIsCurrent());
-    WebKit::MemoryMeasure measurer(&quot;Memory warning: Calling JavaScript GC.&quot;);
-    WebCore::GCController::singleton().garbageCollectNow();
-}
-
-+ (void)purgeInactiveFontData
-{
-    ASSERT(WebThreadIsCurrent());
-    WebKit::MemoryMeasure measurer(&quot;Memory warning: Purging inactive font data.&quot;);
-    FontCache::singleton().purgeInactiveFontData();
-}
-
-+ (void)drainLayerPool
-{
-    ASSERT(WebThreadIsCurrent());
-    WebKit::MemoryMeasure measurer(&quot;Memory warning: Draining layer pool.&quot;);
-    WebCore::LegacyTileCache::drainLayerPool();
-}
-
-+ (void)discardAllCompiledCode
-{
-    ASSERT(WebThreadIsCurrent());
-    WebKit::MemoryMeasure measurer(&quot;Memory warning: Discarding JIT'ed code.&quot;);
-    WebCore::GCController::singleton().deleteAllCode(PreventCollectionAndDeleteAllCode);
-}
-
</del><span class="cx"> + (BOOL)isCharacterSmartReplaceExempt:(unichar)character isPreviousCharacter:(BOOL)b
</span><span class="cx"> {
</span><span class="cx">     return WebCore::isCharacterSmartReplaceExempt(character, b);
</span><span class="lines">@@ -2043,16 +1946,6 @@
</span><span class="cx">     return MemoryPressureHandler::singleton().isUnderMemoryPressure();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-+ (void)_clearMemoryPressure
-{
-    MemoryPressureHandler::singleton().clearMemoryPressure();
-}
-
-+ (BOOL)_shouldWaitForMemoryClearMessage
-{
-    return MemoryPressureHandler::singleton().shouldWaitForMemoryClearMessage();
-}
-
</del><span class="cx"> #endif // PLATFORM(IOS)
</span><span class="cx"> 
</span><span class="cx"> - (void)_closePluginDatabases
</span><span class="lines">@@ -9952,7 +9845,13 @@
</span><span class="cx">         std::call_once(onceFlag, [] {
</span><span class="cx">             auto&amp; memoryPressureHandler = MemoryPressureHandler::singleton();
</span><span class="cx">             memoryPressureHandler.setLowMemoryHandler([] (Critical critical, Synchronous synchronous) {
</span><ins>+#if PLATFORM(IOS)
+                WebThreadRun(^{
+#endif
</ins><span class="cx">                 WebCore::releaseMemory(critical, synchronous);
</span><ins>+#if PLATFORM(IOS)
+                });
+#endif
</ins><span class="cx">             });
</span><span class="cx">             memoryPressureHandler.install();
</span><span class="cx">         });
</span></span></pre></div>
<a id="trunkSourceWebKitmacWebViewWebViewPrivateh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit/mac/WebView/WebViewPrivate.h (212741 => 212742)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit/mac/WebView/WebViewPrivate.h        2017-02-21 21:03:55 UTC (rev 212741)
+++ trunk/Source/WebKit/mac/WebView/WebViewPrivate.h        2017-02-21 21:04:50 UTC (rev 212742)
</span><span class="lines">@@ -441,21 +441,11 @@
</span><span class="cx"> 
</span><span class="cx"> - (NSUInteger)_renderTreeSize;
</span><span class="cx"> 
</span><del>-/*!
- * @method _handleMemoryWarning
- * @discussion Try to release memory since we got a memory warning from the system. This method is
- * also used by other internal clients. See &lt;rdar://9582500&gt;.
- */
-+ (void)_handleMemoryWarning;
-
</del><span class="cx"> - (void)_setResourceLoadSchedulerSuspended:(BOOL)suspend;
</span><span class="cx"> + (void)_setTileCacheLayerPoolCapacity:(unsigned)capacity;
</span><span class="cx"> 
</span><span class="cx"> + (void)_setAllowCookies:(BOOL)allow;
</span><span class="cx"> + (BOOL)_allowCookies;
</span><del>-+ (BOOL)_isUnderMemoryPressure;
-+ (void)_clearMemoryPressure;
-+ (BOOL)_shouldWaitForMemoryClearMessage;
</del><span class="cx"> + (void)_releaseMemoryNow;
</span><span class="cx"> 
</span><span class="cx"> - (void)_replaceCurrentHistoryItem:(WebHistoryItem *)item;
</span></span></pre>
</div>
</div>

</body>
</html>