Changeset 104873 in webkit
- Timestamp:
- Jan 12, 2012 3:59:53 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r104872 r104873 1 2012-01-12 Yongjun Zhang <yongjun_zhang@apple.com> 2 3 Reviewed by Benjamin Poulain. 4 5 https://bugs.webkit.org/show_bug.cgi?id=75991 6 Make the code in MemoryPressureHandler::respondToMemoryPressure shareable. 7 8 Move memory pressure handling code inside a new function (releaseMemory) so that 9 we could shared it between mac and iOS. 10 11 * Configurations/WebCore.xcconfig: add MemoryPressureHandlerMac.mm into iOS build. 12 * platform/MemoryPressureHandler.h: 13 * platform/mac/MemoryPressureHandlerMac.mm: 14 (WebCore::MemoryPressureHandler::respondToMemoryPressure): 15 (WebCore::MemoryPressureHandler::releaseMemory): 16 1 17 2012-01-12 Eric Seidel <eric@webkit.org> 2 18 -
trunk/Source/WebCore/Configurations/WebCore.xcconfig
r103997 r104873 82 82 83 83 EXCLUDED_SOURCE_FILE_NAMES = $(EXCLUDED_SOURCE_FILE_NAMES_$(REAL_PLATFORM_NAME)) $(EXCLUDED_SOURCE_FILE_NAMES_SVG_DOM_OBJC_BINDINGS); 84 EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png Cursor.cpp CursorMac.mm EventHandlerMac.mm HTMLConverter.mm KillRingMac.mm MemoryPressureHandlerMac.mmPlatformEventFactoryMac.mm SSLKeyGeneratorMac.cpp SearchPopupMenuMac.mm WebVideoFullscreenController.mm WebVideoFullscreenHUDWindowController.mm WebWindowAnimation.mm localizedStrings.js;84 EXCLUDED_SOURCE_FILE_NAMES_iphoneos = *.tiff *Cursor.png Cursor.cpp CursorMac.mm EventHandlerMac.mm HTMLConverter.mm KillRingMac.mm PlatformEventFactoryMac.mm SSLKeyGeneratorMac.cpp SearchPopupMenuMac.mm WebVideoFullscreenController.mm WebVideoFullscreenHUDWindowController.mm WebWindowAnimation.mm localizedStrings.js; 85 85 EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(EXCLUDED_SOURCE_FILE_NAMES_iphoneos); 86 86 EXCLUDED_SOURCE_FILE_NAMES_macosx = *IOS.h *IOS.cpp *IOS.mm KillRingNone.cpp -
trunk/Source/WebCore/platform/MemoryPressureHandler.cpp
r97433 r104873 43 43 } 44 44 45 #if !PLATFORM(MAC) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) 45 #if !PLATFORM(MAC) || defined(BUILDING_ON_LEOPARD) || defined(BUILDING_ON_SNOW_LEOPARD) || PLATFORM(IOS) 46 46 void MemoryPressureHandler::install() { } 47 47 -
trunk/Source/WebCore/platform/MemoryPressureHandler.h
r97443 r104873 46 46 47 47 void respondToMemoryPressure(); 48 void releaseMemory(bool critical); 48 49 49 50 bool m_installed; -
trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm
r100681 r104873 33 33 #import <wtf/FastMalloc.h> 34 34 35 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) 35 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) && !PLATFORM(IOS) 36 36 #import "WebCoreSystemInterface.h" 37 37 #import <notify.h> … … 42 42 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD) 43 43 44 #if !PLATFORM(IOS) 44 45 static dispatch_source_t _cache_event_source = 0; 45 46 static dispatch_source_t _timer_event_source = 0; … … 115 116 holdOff(s_secondsBetweenMemoryCleanup); 116 117 118 releaseMemory(false); 119 } 120 #endif // !PLATFORM(IOS) 121 122 void MemoryPressureHandler::releaseMemory(bool critical) 123 { 117 124 int savedPageCacheCapacity = pageCache()->capacity(); 118 pageCache()->setCapacity( pageCache()->pageCount()/2);125 pageCache()->setCapacity(critical ? 0 : pageCache()->pageCount() / 2); 119 126 pageCache()->setCapacity(savedPageCacheCapacity); 120 127 pageCache()->releaseAutoreleasedPagesNow(); … … 122 129 NSURLCache *nsurlCache = [NSURLCache sharedURLCache]; 123 130 NSUInteger savedNsurlCacheMemoryCapacity = [nsurlCache memoryCapacity]; 124 [nsurlCache setMemoryCapacity: [nsurlCache currentMemoryUsage]/2];131 [nsurlCache setMemoryCapacity:critical ? 0 : [nsurlCache currentMemoryUsage] / 2]; 125 132 [nsurlCache setMemoryCapacity:savedNsurlCacheMemoryCapacity]; 126 133 127 134 fontCache()->purgeInactiveFontData(); 128 135 129 memoryCache()->pruneToPercentage( 0.5f);136 memoryCache()->pruneToPercentage(critical ? 0 : 0.5f); 130 137 131 138 gcController().garbageCollectNow();
Note: See TracChangeset
for help on using the changeset viewer.