[webkit-reviews] review granted: [Bug 75991] make the code in MemoryPressureHandler::respondToMemoryPressure shareable. : [Attachment 121913] Move memory pressure handling code inside a new function (releaseMemory) so that we could shared it between mac and iOS.
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Wed Jan 11 19:08:31 PST 2012
Benjamin Poulain <benjamin at webkit.org> has granted Yongjun Zhang
<yongjun_zhang at apple.com>'s request for review:
Bug 75991: make the code in MemoryPressureHandler::respondToMemoryPressure
shareable.
https://bugs.webkit.org/show_bug.cgi?id=75991
Attachment 121913: Move memory pressure handling code inside a new function
(releaseMemory) so that we could shared it between mac and iOS.
https://bugs.webkit.org/attachment.cgi?id=121913&action=review
------- Additional Comments from Benjamin Poulain <benjamin at webkit.org>
View in context: https://bugs.webkit.org/attachment.cgi?id=121913&action=review
> Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm:118
> + releaseMemory(false);
This boolean should ideally be an enum:
releaseMemory(Normal)
releaseMemory(Critical)
> Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm:123
> +void MemoryPressureHandler::releaseMemory(bool critical)
> +{
What do you think about moving this to a separate common file? As it is, 90% of
this file is blacklisted for iOS. Separate files are easier to maintain that
#ifdef imho (although the file would be very simple in this case).
If you choose the #ifdef, do not forget to add || PLATFORM(IOS) to
MemoryPressureHandler.cpp.
> Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm:125
> - pageCache()->setCapacity(pageCache()->pageCount()/2);
> + pageCache()->setCapacity(critical ? 0 : pageCache()->pageCount()/2);
Spaces around operator.
> Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm:131
> + [nsurlCache setMemoryCapacity:critical ? 0 : [nsurlCache
currentMemoryUsage]/2];
Spaces around operator.
More information about the webkit-reviews
mailing list