Changeset 208534 in webkit
- Timestamp:
- Nov 10, 2016 6:24:26 AM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 3 added
- 17 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r208486 r208534 2041 2041 page/Location.cpp 2042 2042 page/MainFrame.cpp 2043 page/MemoryRelease.cpp 2043 2044 page/MouseEventWithHitTestResults.cpp 2044 2045 page/Navigator.cpp -
trunk/Source/WebCore/ChangeLog
r208531 r208534 1 2016-10-14 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 MemoryPressureHandler shouldn't know how to release WebCore memory 4 https://bugs.webkit.org/show_bug.cgi?id=160497 5 6 Reviewed by Michael Catanzaro. 7 8 All processes should set their own low memory handler, instead of leaving the web process using the default one 9 that needs to access APIs that are not in platform layer. This patch fixes all the layering violations in the 10 MemoryPressureHandler. Since the default implementation, that releases the WebCore memory, is shared by the 11 WebProcess in WebKit2 and WebKit1 ports, it has been moved to its own file to the WebCore layer. 12 13 * CMakeLists.txt: Add new files to compilation. 14 * PlatformMac.cmake: Ditto. 15 * WebCore.xcodeproj/project.pbxproj: Ditto. 16 * loader/FrameLoader.cpp: 17 (WebCore::FrameLoader::commitProvisionalLoad): Use WebCore::jettisonExpensiveObjectsOnTopLevelNavigation(). 18 * page/MemoryRelease.cpp: Added. 19 (WebCore::releaseNoncriticalMemory): 20 (WebCore::releaseCriticalMemory): 21 (WebCore::releaseMemory): 22 (WebCore::platformReleaseMemory): 23 (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation): 24 (WebCore::registerMemoryReleaseNotifyCallbacks): 25 * page/MemoryRelease.h: Added. 26 * page/cocoa/MemoryReleaseCocoa.mm: Added. 27 (WebCore::platformReleaseMemory): 28 (WebCore::jettisonExpensiveObjectsOnTopLevelNavigation): 29 (WebCore::registerMemoryReleaseNotifyCallbacks): 30 * platform/MemoryPressureHandler.cpp: 31 (WebCore::MemoryPressureHandler::MemoryPressureHandler): 32 (WebCore::MemoryPressureHandler::beginSimulatedMemoryPressure): 33 (WebCore::MemoryPressureHandler::releaseMemory): Use the current handler if it has been set. 34 (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted. 35 * platform/MemoryPressureHandler.h: 36 (WebCore::MemoryPressureHandler::setLowMemoryHandler): 37 (WebCore::MemoryPressureHandler::m_releaseMemoryBlock): 38 * platform/cocoa/MemoryPressureHandlerCocoa.mm: 39 (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly. 40 (WebCore::MemoryPressureHandler::platformReleaseMemory): Deleted. 41 * platform/linux/MemoryPressureHandlerLinux.cpp: 42 * platform/win/MemoryPressureHandlerWin.cpp: 43 (WebCore::MemoryPressureHandler::respondToMemoryPressure): Call releaseMemory() instead of using the handler directly. 44 1 45 2016-11-08 Sergio Villar Senin <svillar@igalia.com> 2 46 -
trunk/Source/WebCore/PlatformMac.cmake
r208433 r208534 261 261 page/PageDebuggable.cpp 262 262 263 page/cocoa/MemoryReleaseCocoa.mm 263 264 page/cocoa/UserAgent.mm 264 265 page/cocoa/ResourceUsageOverlayCocoa.mm -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r208491 r208534 1546 1546 4138F8581D253F0E001CB61E /* JSDOMIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = 4138F8561D253EEE001CB61E /* JSDOMIterator.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1547 1547 413C2C341BC29A8F0075204C /* JSDOMConstructor.h in Headers */ = {isa = PBXBuildFile; fileRef = 413C2C331BC29A7B0075204C /* JSDOMConstructor.h */; }; 1548 413E00791DB0E4F2002341D2 /* MemoryRelease.h in Headers */ = {isa = PBXBuildFile; fileRef = 413E00781DB0E4DE002341D2 /* MemoryRelease.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1549 413E007A1DB0E4F9002341D2 /* MemoryRelease.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 413E00771DB0E4DE002341D2 /* MemoryRelease.cpp */; }; 1550 413E007C1DB0E70A002341D2 /* MemoryReleaseCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 413E007B1DB0E707002341D2 /* MemoryReleaseCocoa.mm */; }; 1548 1551 4147E2B71C89912C00A7E715 /* FetchLoader.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4147E2B41C89912600A7E715 /* FetchLoader.cpp */; }; 1549 1552 4147E2B81C89912F00A7E715 /* FetchBodyOwner.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4147E2B31C89912600A7E715 /* FetchBodyOwner.cpp */; }; … … 8605 8608 4138F8561D253EEE001CB61E /* JSDOMIterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMIterator.h; sourceTree = "<group>"; }; 8606 8609 413C2C331BC29A7B0075204C /* JSDOMConstructor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMConstructor.h; sourceTree = "<group>"; }; 8610 413E00771DB0E4DE002341D2 /* MemoryRelease.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryRelease.cpp; sourceTree = "<group>"; }; 8611 413E00781DB0E4DE002341D2 /* MemoryRelease.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryRelease.h; sourceTree = "<group>"; }; 8612 413E007B1DB0E707002341D2 /* MemoryReleaseCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = MemoryReleaseCocoa.mm; sourceTree = "<group>"; }; 8607 8613 4147E2B21C88337F00A7E715 /* FetchBodyOwner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FetchBodyOwner.h; sourceTree = "<group>"; }; 8608 8614 4147E2B31C89912600A7E715 /* FetchBodyOwner.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FetchBodyOwner.cpp; sourceTree = "<group>"; }; … … 17183 17189 isa = PBXGroup; 17184 17190 children = ( 17191 413E007B1DB0E707002341D2 /* MemoryReleaseCocoa.mm */, 17185 17192 ADFE2B541BD5F41200DAB457 /* ResourceUsageOverlayCocoa.mm */, 17186 17193 A5071E881C56D4FA009951BE /* ResourceUsageThreadCocoa.mm */, … … 17739 17746 931BCC601124DFCB00BE70DD /* MediaCanStartListener.h */, 17740 17747 52E2CAFB19FF0207001EEB4F /* MediaProducer.h */, 17748 413E00771DB0E4DE002341D2 /* MemoryRelease.cpp */, 17749 413E00781DB0E4DE002341D2 /* MemoryRelease.h */, 17741 17750 93EB355E09E37FD600F43799 /* MouseEventWithHitTestResults.cpp */, 17742 17751 935C476209AC4CE600A6AAB4 /* MouseEventWithHitTestResults.h */, … … 25230 25239 416E6FE81BBD12DF000A6023 /* FetchInternalsBuiltins.h in Headers */, 25231 25240 41AD753A1CEF6BD100A31486 /* FetchOptions.h in Headers */, 25241 413E00791DB0E4F2002341D2 /* MemoryRelease.h in Headers */, 25232 25242 84730D8B1248F0B300D3A9C9 /* FETile.h in Headers */, 25233 25243 84730D8D1248F0B300D3A9C9 /* FETurbulence.h in Headers */, … … 28541 28551 CDCA98EB18B2C8EB00C12FF9 /* CDMPrivateMediaPlayer.cpp in Sources */, 28542 28552 CD318622199F1E2A0030A0F7 /* CDMPrivateMediaSourceAVFObjC.mm in Sources */, 28553 413E007C1DB0E70A002341D2 /* MemoryReleaseCocoa.mm in Sources */, 28543 28554 CDE595951BF16DF300A1CBE8 /* CDMSessionAVContentKeySession.mm in Sources */, 28544 28555 CDDE02ED18B3ED6D00CF7FF1 /* CDMSessionAVFoundationObjC.mm in Sources */, … … 30275 30286 07FFDE68181AED420072D409 /* MediaStreamTrackPrivate.cpp in Sources */, 30276 30287 CD641EBF1819B36000EE4C41 /* MediaTimeAVFoundation.cpp in Sources */, 30288 413E007A1DB0E4F9002341D2 /* MemoryRelease.cpp in Sources */, 30277 30289 CD60C0C6193E87C7003C656B /* MediaTimeQTKit.mm in Sources */, 30278 30290 0705853A17FE0770005F2BCB /* MediaTrackConstraint.cpp in Sources */, -
trunk/Source/WebCore/loader/FrameLoader.cpp
r208329 r208534 86 86 #include "MainFrame.h" 87 87 #include "MemoryCache.h" 88 #include "MemoryRelease.h" 88 89 #include "Page.h" 89 90 #include "PageCache.h" … … 134 135 #if PLATFORM(IOS) 135 136 #include "DocumentType.h" 136 #include "MemoryPressureHandler.h"137 137 #include "ResourceLoader.h" 138 138 #include "RuntimeApplicationChecks.h" … … 1776 1776 PageCache::singleton().addIfCacheable(*history().currentItem(), m_frame.page()); 1777 1777 1778 MemoryPressureHandler::singleton().jettisonExpensiveObjectsOnTopLevelNavigation();1778 WebCore::jettisonExpensiveObjectsOnTopLevelNavigation(); 1779 1779 } 1780 1780 -
trunk/Source/WebCore/platform/MemoryPressureHandler.cpp
r207339 r208534 27 27 #include "MemoryPressureHandler.h" 28 28 29 #include "CSSValuePool.h"30 #include "Chrome.h"31 #include "ChromeClient.h"32 #include "Document.h"33 #include "FontCache.h"34 #include "GCController.h"35 #include "HTMLMediaElement.h"36 #include "InlineStyleSheetOwner.h"37 #include "InspectorInstrumentation.h"38 29 #include "Logging.h" 39 #include "MemoryCache.h"40 #include "Page.h"41 #include "PageCache.h"42 #include "ScrollingThread.h"43 #include "StyleScope.h"44 #include "StyledElement.h"45 #include "WorkerThread.h"46 #include <JavaScriptCore/IncrementalSweeper.h>47 #include <chrono>48 #include <wtf/CurrentTime.h>49 #include <wtf/FastMalloc.h>50 #include <wtf/StdLibExtras.h>51 30 52 31 namespace WebCore { … … 60 39 } 61 40 62 MemoryPressureHandler::MemoryPressureHandler() 63 : m_installed(false) 64 , m_lastRespondTime(0) 65 , m_lowMemoryHandler([this] (Critical critical, Synchronous synchronous) { releaseMemory(critical, synchronous); }) 66 , m_underMemoryPressure(false) 67 #if PLATFORM(IOS) 68 // FIXME: Can we share more of this with OpenSource? 69 , m_memoryPressureReason(MemoryPressureReasonNone) 70 , m_clearPressureOnMemoryRelease(true) 71 , m_releaseMemoryBlock(0) 72 , m_observer(0) 73 #elif OS(LINUX) 74 , m_holdOffTimer(RunLoop::main(), this, &MemoryPressureHandler::holdOffTimerFired) 41 MemoryPressureHandler::MemoryPressureHandler() 42 #if OS(LINUX) 43 : m_holdOffTimer(RunLoop::main(), this, &MemoryPressureHandler::holdOffTimerFired) 75 44 #endif 76 45 { 77 platformInitialize();78 }79 80 void MemoryPressureHandler::releaseNoncriticalMemory()81 {82 {83 ReliefLogger log("Purge inactive FontData");84 FontCache::singleton().purgeInactiveFontData();85 }86 87 {88 ReliefLogger log("Clear WidthCaches");89 clearWidthCaches();90 }91 92 {93 ReliefLogger log("Discard Selector Query Cache");94 for (auto* document : Document::allDocuments())95 document->clearSelectorQueryCache();96 }97 98 {99 ReliefLogger log("Prune MemoryCache dead resources");100 MemoryCache::singleton().pruneDeadResourcesToSize(0);101 }102 103 {104 ReliefLogger log("Prune presentation attribute cache");105 StyledElement::clearPresentationAttributeCache();106 }107 108 {109 ReliefLogger log("Clear inline stylesheet cache");110 InlineStyleSheetOwner::clearCache();111 }112 }113 114 void MemoryPressureHandler::releaseCriticalMemory(Synchronous synchronous)115 {116 {117 ReliefLogger log("Empty the PageCache");118 // Right now, the only reason we call release critical memory while not under memory pressure is if the process is about to be suspended.119 PruningReason pruningReason = isUnderMemoryPressure() ? PruningReason::MemoryPressure : PruningReason::ProcessSuspended;120 PageCache::singleton().pruneToSizeNow(0, pruningReason);121 }122 123 {124 ReliefLogger log("Prune MemoryCache live resources");125 MemoryCache::singleton().pruneLiveResourcesToSize(0, /*shouldDestroyDecodedDataForAllLiveResources*/ true);126 }127 128 {129 ReliefLogger log("Drain CSSValuePool");130 CSSValuePool::singleton().drain();131 }132 133 {134 ReliefLogger log("Discard StyleResolvers");135 Vector<RefPtr<Document>> documents;136 copyToVector(Document::allDocuments(), documents);137 for (auto& document : documents)138 document->styleScope().clearResolver();139 }140 141 {142 ReliefLogger log("Discard all JIT-compiled code");143 GCController::singleton().deleteAllCode();144 }145 146 #if ENABLE(VIDEO)147 {148 ReliefLogger log("Dropping buffered data from paused media elements");149 for (auto* mediaElement: HTMLMediaElement::allMediaElements()) {150 if (mediaElement->paused())151 mediaElement->purgeBufferedDataIfPossible();152 }153 }154 #endif155 156 if (synchronous == Synchronous::Yes) {157 ReliefLogger log("Collecting JavaScript garbage");158 GCController::singleton().garbageCollectNow();159 } else160 GCController::singleton().garbageCollectNowIfNotDoneRecently();161 162 // We reduce tiling coverage while under memory pressure, so make sure to drop excess tiles ASAP.163 Page::forEachPage([](Page& page) {164 page.chrome().client().scheduleCompositingLayerFlush();165 });166 }167 168 void MemoryPressureHandler::jettisonExpensiveObjectsOnTopLevelNavigation()169 {170 #if PLATFORM(IOS)171 // Protect against doing excessive jettisoning during repeated navigations.172 const auto minimumTimeSinceNavigation = 2s;173 174 static auto timeOfLastNavigation = std::chrono::steady_clock::now();175 auto now = std::chrono::steady_clock::now();176 bool shouldJettison = now - timeOfLastNavigation >= minimumTimeSinceNavigation;177 timeOfLastNavigation = now;178 179 if (!shouldJettison)180 return;181 182 // Throw away linked JS code. Linked code is tied to a global object and is not reusable.183 // The immediate memory savings outweigh the cost of recompilation in case we go back again.184 GCController::singleton().deleteAllLinkedCode();185 #endif186 46 } 187 47 … … 189 49 { 190 50 m_isSimulatingMemoryPressure = true; 191 MemoryPressureHandler::singleton().respondToMemoryPressure(Critical::Yes, Synchronous::Yes);51 respondToMemoryPressure(Critical::Yes, Synchronous::Yes); 192 52 } 193 53 … … 199 59 void MemoryPressureHandler::releaseMemory(Critical critical, Synchronous synchronous) 200 60 { 201 if ( critical == Critical::Yes)202 re leaseCriticalMemory(synchronous);61 if (!m_lowMemoryHandler) 62 return; 203 63 204 releaseNoncriticalMemory(); 205 64 m_lowMemoryHandler(critical, synchronous); 206 65 platformReleaseMemory(critical); 207 208 {209 ReliefLogger log("Release free FastMalloc memory");210 // FastMalloc has lock-free thread specific caches that can only be cleared from the thread itself.211 WorkerThread::releaseFastMallocFreeMemoryInAllThreads();212 #if ENABLE(ASYNC_SCROLLING) && !PLATFORM(IOS)213 ScrollingThread::dispatch([]() {214 WTF::releaseFastMallocFreeMemory();215 });216 #endif217 WTF::releaseFastMallocFreeMemory();218 }219 220 #if ENABLE(RESOURCE_USAGE)221 Page::forEachPage([&](Page& page) {222 InspectorInstrumentation::didHandleMemoryPressure(page, critical);223 });224 #endif225 66 } 226 67 … … 250 91 } 251 92 252 #if !PLATFORM(COCOA)253 void MemoryPressureHandler::platformInitialize() { }254 #endif255 256 93 #if !PLATFORM(COCOA) && !OS(LINUX) && !PLATFORM(WIN) 257 94 void MemoryPressureHandler::install() { } -
trunk/Source/WebCore/platform/MemoryPressureHandler.h
r204472 r208534 33 33 #include <wtf/FastMalloc.h> 34 34 #include <wtf/Forward.h> 35 #include <wtf/NeverDestroyed.h> 35 36 36 37 #if PLATFORM(IOS) … … 67 68 WEBCORE_EXPORT void install(); 68 69 69 void setLowMemoryHandler(LowMemoryHandler handler)70 void setLowMemoryHandler(LowMemoryHandler&& handler) 70 71 { 71 72 ASSERT(!m_installed); 72 m_lowMemoryHandler = handler;73 m_lowMemoryHandler = WTFMove(handler); 73 74 } 74 75 void jettisonExpensiveObjectsOnTopLevelNavigation();76 75 77 76 bool isUnderMemoryPressure() const { return m_underMemoryPressure || m_isSimulatingMemoryPressure; } … … 131 130 132 131 private: 133 void platformInitialize();134 void releaseNoncriticalMemory();135 void releaseCriticalMemory(Synchronous);136 137 132 void uninstall(); 138 133 … … 165 160 #endif 166 161 167 bool m_installed ;168 time_t m_lastRespondTime ;162 bool m_installed { false }; 163 time_t m_lastRespondTime { 0 }; 169 164 LowMemoryHandler m_lowMemoryHandler; 170 165 … … 173 168 174 169 #if PLATFORM(IOS) 175 uint32_t m_memoryPressureReason; 176 bool m_clearPressureOnMemoryRelease; 177 void (^m_releaseMemoryBlock)(); 178 CFRunLoopObserverRef m_observer; 170 // FIXME: Can we share more of this with OpenSource? 171 uint32_t m_memoryPressureReason { MemoryPressureReasonNone }; 172 bool m_clearPressureOnMemoryRelease { true }; 173 void (^m_releaseMemoryBlock)() { nullptr }; 174 CFRunLoopObserverRef m_observer { nullptr }; 179 175 Lock m_observerMutex; 180 176 #elif OS(LINUX) -
trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm
r203379 r208534 27 27 #import "MemoryPressureHandler.h" 28 28 29 #import "GCController.h"30 #import "IOSurfacePool.h"31 #import "LayerPool.h"32 29 #import "Logging.h" 33 #import "ResourceUsageThread.h"34 30 #import <mach/mach.h> 35 31 #import <mach/task_info.h> 36 32 #import <malloc/malloc.h> 37 33 #import <notify.h> 34 #import <wtf/CurrentTime.h> 38 35 39 36 #if PLATFORM(IOS) … … 45 42 46 43 extern "C" void cache_simulate_memory_warning_event(uint64_t); 47 extern "C" void _sqlite3_purgeEligiblePagerCacheMemory(void);48 44 49 45 namespace WebCore { 50 46 51 void MemoryPressureHandler::platformInitialize()52 {53 int dummy;54 notify_register_dispatch("com.apple.WebKit.fullGC", &dummy, dispatch_get_main_queue(), ^(int) {55 GCController::singleton().garbageCollectNow();56 });57 notify_register_dispatch("com.apple.WebKit.deleteAllCode", &dummy, dispatch_get_main_queue(), ^(int) {58 GCController::singleton().deleteAllCode();59 GCController::singleton().garbageCollectNow();60 });61 }62 63 47 void MemoryPressureHandler::platformReleaseMemory(Critical critical) 64 48 { 65 {66 ReliefLogger log("Purging SQLite caches");67 _sqlite3_purgeEligiblePagerCacheMemory();68 }69 70 {71 ReliefLogger log("Drain LayerPools");72 for (auto& pool : LayerPool::allLayerPools())73 pool->drain();74 }75 #if USE(IOSURFACE)76 {77 ReliefLogger log("Drain IOSurfacePool");78 IOSurfacePool::sharedPool().discardAllSurfaces();79 }80 #endif81 82 49 if (critical == Critical::Yes && (!isUnderMemoryPressure() || m_isSimulatingMemoryPressure)) { 83 50 // libcache listens to OS memory notifications, but for process suspension … … 212 179 #endif 213 180 214 m_lowMemoryHandler(critical, synchronous);181 releaseMemory(critical, synchronous); 215 182 216 183 #if !PLATFORM(IOS) -
trunk/Source/WebCore/platform/linux/MemoryPressureHandlerLinux.cpp
r203342 r208534 299 299 300 300 double startTime = monotonicallyIncreasingTime(); 301 m_lowMemoryHandler(critical, synchronous);301 releaseMemory(critical, synchronous); 302 302 unsigned holdOffTime = (monotonicallyIncreasingTime() - startTime) * s_holdOffMultiplier; 303 303 holdOff(std::max(holdOffTime, s_minimumHoldOffTime)); -
trunk/Source/WebCore/platform/win/MemoryPressureHandlerWin.cpp
r197728 r208534 121 121 uninstall(); 122 122 123 m_lowMemoryHandler(critical, synchronous);123 releaseMemory(critical, synchronous); 124 124 } 125 125 -
trunk/Source/WebKit/mac/ChangeLog
r208527 r208534 1 2016-10-14 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 MemoryPressureHandler shouldn't know how to release WebCore memory 4 https://bugs.webkit.org/show_bug.cgi?id=160497 5 6 Reviewed by Michael Catanzaro. 7 8 Set the low memory handler before installing the memory pressure handler. 9 10 * WebView/WebView.mm: 11 (-[WebView _commonInitializationWithFrameName:groupName:]): 12 1 13 2016-11-09 Ryosuke Niwa <rniwa@webkit.org> 2 14 -
trunk/Source/WebKit/mac/WebView/WebView.mm
r208509 r208534 162 162 #import <WebCore/MainFrame.h> 163 163 #import <WebCore/MemoryCache.h> 164 #import <WebCore/Memory PressureHandler.h>164 #import <WebCore/MemoryRelease.h> 165 165 #import <WebCore/NSSpellCheckerSPI.h> 166 166 #import <WebCore/NSTouchBarSPI.h> … … 1431 1431 #endif 1432 1432 1433 if (![[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitSuppressMemoryPressureHandler"]) 1434 MemoryPressureHandler::singleton().install(); 1433 if (![[NSUserDefaults standardUserDefaults] boolForKey:@"WebKitSuppressMemoryPressureHandler"]) { 1434 WebCore::registerMemoryReleaseNotifyCallbacks(); 1435 1436 static std::once_flag onceFlag; 1437 std::call_once(onceFlag, [] { 1438 auto& memoryPressureHandler = MemoryPressureHandler::singleton(); 1439 memoryPressureHandler.setLowMemoryHandler([] (Critical critical, Synchronous synchronous) { 1440 WebCore::releaseMemory(critical, synchronous); 1441 }); 1442 memoryPressureHandler.install(); 1443 }); 1444 } 1435 1445 1436 1446 if (!WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_LOCAL_RESOURCE_SECURITY_RESTRICTION)) { -
trunk/Source/WebKit/win/ChangeLog
r208505 r208534 1 2016-10-14 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 MemoryPressureHandler shouldn't know how to release WebCore memory 4 https://bugs.webkit.org/show_bug.cgi?id=160497 5 6 Reviewed by Michael Catanzaro. 7 8 Set the low memory handler before installing the memory pressure handler. 9 10 * WebView.cpp: 11 (WebView::initWithFrame): 12 1 13 2016-11-09 Alex Christensen <achristensen@webkit.org> 2 14 -
trunk/Source/WebKit/win/WebView.cpp
r208479 r208534 128 128 #include <WebCore/MainFrame.h> 129 129 #include <WebCore/MemoryCache.h> 130 #include <WebCore/Memory PressureHandler.h>130 #include <WebCore/MemoryRelease.h> 131 131 #include <WebCore/NotImplemented.h> 132 132 #include <WebCore/Page.h> … … 3085 3085 WebKitInitializeWebDatabasesIfNecessary(); 3086 3086 3087 MemoryPressureHandler::singleton().install(); 3087 auto& memoryPressureHandler = MemoryPressureHandler::singleton(); 3088 memoryPressureHandler.setLowMemoryHandler([] (Critical critical, Synchronous synchronous) { 3089 WebCore::releaseMemory(critical, synchronous); 3090 }); 3091 memoryPressureHandler.install(); 3088 3092 3089 3093 didOneTimeInitialization = true; -
trunk/Source/WebKit2/ChangeLog
r208532 r208534 1 2016-10-14 Carlos Garcia Campos <cgarcia@igalia.com> 2 3 MemoryPressureHandler shouldn't know how to release WebCore memory 4 https://bugs.webkit.org/show_bug.cgi?id=160497 5 6 Reviewed by Michael Catanzaro. 7 8 Set the low memory handler before installing the memory pressure handler. 9 10 * WebProcess/WebProcess.cpp: 11 (WebKit::WebProcess::initializeWebProcess): 12 * WebProcess/cocoa/WebProcessCocoa.mm: 13 (WebKit::WebProcess::platformInitializeWebProcess): 14 1 15 2016-10-27 Sergio Villar Senin <svillar@igalia.com> 2 16 -
trunk/Source/WebKit2/WebProcess/WebProcess.cpp
r208307 r208534 89 89 #include <WebCore/MainFrame.h> 90 90 #include <WebCore/MemoryCache.h> 91 #include <WebCore/Memory PressureHandler.h>91 #include <WebCore/MemoryRelease.h> 92 92 #include <WebCore/NetworkStorageSession.h> 93 93 #include <WebCore/Page.h> … … 274 274 275 275 m_suppressMemoryPressureHandler = parameters.shouldSuppressMemoryPressureHandler; 276 if (!m_suppressMemoryPressureHandler) 277 MemoryPressureHandler::singleton().install(); 276 if (!m_suppressMemoryPressureHandler) { 277 auto& memoryPressureHandler = MemoryPressureHandler::singleton(); 278 memoryPressureHandler.setLowMemoryHandler([] (Critical critical, Synchronous synchronous) { 279 WebCore::releaseMemory(critical, synchronous); 280 }); 281 memoryPressureHandler.install(); 282 } 278 283 279 284 if (!parameters.injectedBundlePath.isEmpty()) -
trunk/Source/WebKit2/WebProcess/cocoa/WebProcessCocoa.mm
r207769 r208534 50 50 #import <WebCore/FontCascade.h> 51 51 #import <WebCore/LocalizedStrings.h> 52 #import <WebCore/Memory PressureHandler.h>52 #import <WebCore/MemoryRelease.h> 53 53 #import <WebCore/NSAccessibilitySPI.h> 54 54 #import <WebCore/RuntimeApplicationChecks.h> … … 121 121 m_presenterApplicationPid = parameters.presenterApplicationPid; 122 122 123 WebCore::registerMemoryReleaseNotifyCallbacks(); 123 124 MemoryPressureHandler::ReliefLogger::setLoggingEnabled(parameters.shouldEnableMemoryPressureReliefLogging); 124 125
Note: See TracChangeset
for help on using the changeset viewer.