Title: [167338] trunk/Source/WebCore
- Revision
- 167338
- Author
- akl...@apple.com
- Date
- 2014-04-15 17:01:33 -0700 (Tue, 15 Apr 2014)
Log Message
[iOS WebKit2] Listen for system memory pressure notifications.
<https://webkit.org/b/131653>
<rdar://problem/16208123>
Reviewed by Antti Koivisto.
* platform/cocoa/MemoryPressureHandlerCocoa.mm:
(WebCore::MemoryPressureHandler::install):
Use the right invocation to summon the memory pressure handler.
(WebCore::MemoryPressureHandler::install):
(WebCore::MemoryPressureHandler::uninstall):
(WebCore::MemoryPressureHandler::holdOff):
(WebCore::MemoryPressureHandler::respondToMemoryPressure):
Make stubbed out functions !PLATFORM(COCOA)
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (167337 => 167338)
--- trunk/Source/WebCore/ChangeLog 2014-04-16 00:01:06 UTC (rev 167337)
+++ trunk/Source/WebCore/ChangeLog 2014-04-16 00:01:33 UTC (rev 167338)
@@ -1,3 +1,23 @@
+2014-04-15 Andreas Kling <akl...@apple.com>
+
+ [iOS WebKit2] Listen for system memory pressure notifications.
+ <https://webkit.org/b/131653>
+ <rdar://problem/16208123>
+
+ Reviewed by Antti Koivisto.
+
+ * platform/cocoa/MemoryPressureHandlerCocoa.mm:
+ (WebCore::MemoryPressureHandler::install):
+
+ Use the right invocation to summon the memory pressure handler.
+
+ (WebCore::MemoryPressureHandler::install):
+ (WebCore::MemoryPressureHandler::uninstall):
+ (WebCore::MemoryPressureHandler::holdOff):
+ (WebCore::MemoryPressureHandler::respondToMemoryPressure):
+
+ Make stubbed out functions !PLATFORM(COCOA)
+
2014-04-14 Morten Stenshorne <msten...@opera.com>
[New Multicolumn] Add support for column-span:all
Modified: trunk/Source/WebCore/platform/MemoryPressureHandler.cpp (167337 => 167338)
--- trunk/Source/WebCore/platform/MemoryPressureHandler.cpp 2014-04-16 00:01:06 UTC (rev 167337)
+++ trunk/Source/WebCore/platform/MemoryPressureHandler.cpp 2014-04-16 00:01:33 UTC (rev 167338)
@@ -95,14 +95,11 @@
WTF::releaseFastMallocFreeMemory();
}
-#if !PLATFORM(MAC)
+#if !PLATFORM(COCOA)
void MemoryPressureHandler::install() { }
void MemoryPressureHandler::uninstall() { }
void MemoryPressureHandler::holdOff(unsigned) { }
void MemoryPressureHandler::respondToMemoryPressure() { }
-#endif
-
-#if !PLATFORM(COCOA)
void MemoryPressureHandler::platformReleaseMemory(bool) { }
#endif
Modified: trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm (167337 => 167338)
--- trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm 2014-04-16 00:01:06 UTC (rev 167337)
+++ trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm 2014-04-16 00:01:33 UTC (rev 167338)
@@ -38,6 +38,7 @@
#if PLATFORM(IOS)
#import "SystemMemory.h"
#import "WebCoreThread.h"
+#import <dispatch/private.h>
#endif
namespace WebCore {
@@ -52,8 +53,6 @@
#endif
}
-#if PLATFORM(MAC)
-
static dispatch_source_t _cache_event_source = 0;
static dispatch_source_t _timer_event_source = 0;
static int _notifyToken;
@@ -73,14 +72,18 @@
return;
dispatch_async(dispatch_get_main_queue(), ^{
-#if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
+#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
+ _cache_event_source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYSTATUS, 0, DISPATCH_MEMORYSTATUS_PRESSURE_WARN, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
+#elif PLATFORM(MAC) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
_cache_event_source = wkCreateMemoryStatusPressureCriticalDispatchOnMainQueue();
#else
_cache_event_source = wkCreateVMPressureDispatchOnMainQueue();
#endif
if (_cache_event_source) {
dispatch_set_context(_cache_event_source, this);
- dispatch_source_set_event_handler(_cache_event_source, ^{ memoryPressureHandler().respondToMemoryPressure();});
+ dispatch_source_set_event_handler(_cache_event_source, ^{
+ memoryPressureHandler().respondToMemoryPressure();
+ });
dispatch_resume(_cache_event_source);
}
});
@@ -156,8 +159,7 @@
holdOff(std::max(holdOffTime, s_minimumHoldOffTime));
}
-#else // !PLATFORM(MAC)
-
+#if PLATFORM(IOS)
static void respondToMemoryPressureCallback(CFRunLoopObserverRef observer, CFRunLoopActivity /*activity*/, void* /*info*/)
{
memoryPressureHandler().respondToMemoryPressureIfNeeded();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes