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):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@180225 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index 05c8206..1fb3715 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -1748,7 +1748,7 @@
// page cache. We could still preemptively prune the page cache while navigating to a cached page if capacity > 1.
// See <rdar://problem/11779846> for more details.
if (!cachedPage) {
- if (memoryPressureHandler().isUnderMemoryPressure()) {
+ if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) {
LOG(MemoryPressure, "Pruning page cache because under memory pressure at: %s", __PRETTY_FUNCTION__);
LOG(PageCache, "Pruning page cache to 0 due to memory pressure");
// Don't cache any page if we are under memory pressure.