Title: [89214] trunk/Source/WebCore
Revision
89214
Author
msab...@apple.com
Date
2011-06-19 05:55:20 -0700 (Sun, 19 Jun 2011)

Log Message

2011-06-19  Michael Saboff  <msab...@apple.com>

        Reviewed by Darin Adler.

        Add notify handler to trigger MemoryPressureHandler in all builds
        https://bugs.webkit.org/show_bug.cgi?id=62679

        Removed SIGUSR2 trigger and added a notify trigger for the
        MemoryPressureHandler.  The notify trigger is enabled for all builds.

        No test added as only added new memory pressure trigger.

        * platform/mac/MemoryPressureHandlerMac.mm:
        (WebCore::MemoryPressureHandler::install):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (89213 => 89214)


--- trunk/Source/WebCore/ChangeLog	2011-06-19 10:53:03 UTC (rev 89213)
+++ trunk/Source/WebCore/ChangeLog	2011-06-19 12:55:20 UTC (rev 89214)
@@ -1,3 +1,18 @@
+2011-06-19  Michael Saboff  <msab...@apple.com>
+
+        Reviewed by Darin Adler.
+
+        Add notify handler to trigger MemoryPressureHandler in all builds
+        https://bugs.webkit.org/show_bug.cgi?id=62679
+
+        Removed SIGUSR2 trigger and added a notify trigger for the
+        MemoryPressureHandler.  The notify trigger is enabled for all builds.
+
+        No test added as only added new memory pressure trigger.
+
+        * platform/mac/MemoryPressureHandlerMac.mm:
+        (WebCore::MemoryPressureHandler::install):
+
 2011-06-19  Robert Hogan  <rob...@webkit.org>
 
         Reviewed by Alexey Proskuryakov.

Modified: trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm (89213 => 89214)


--- trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm	2011-06-19 10:53:03 UTC (rev 89213)
+++ trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm	2011-06-19 12:55:20 UTC (rev 89214)
@@ -34,6 +34,7 @@
 
 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
 #import <dispatch/dispatch.h>
+#import <notify.h>
 
 #ifndef DISPATCH_SOURCE_TYPE_VM
 #define DISPATCH_SOURCE_TYPE_VM (&_dispatch_source_type_vm)
@@ -51,12 +52,11 @@
 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
 
 static dispatch_source_t _cache_event_source = 0;
-#ifndef NDEBUG
-static dispatch_source_t _cache_event_source2 = 0;
-#endif
 
 void MemoryPressureHandler::install()
 {
+    static int notifyToken;
+
     if (m_installed)
         return;
 
@@ -69,17 +69,8 @@
         }
     });
 
-#ifndef NDEBUG
-    dispatch_async(dispatch_get_main_queue(), ^{
-        _cache_event_source2 = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGUSR2, 0, dispatch_get_main_queue());
-        if (_cache_event_source2) {
-            dispatch_set_context(_cache_event_source2, this);
-            dispatch_source_set_event_handler(_cache_event_source2, ^{ memoryPressureHandler().respondToMemoryPressure();});
-            dispatch_resume(_cache_event_source2);
-            signal((int)SIGUSR2, SIG_IGN);
-        }
-    });
-#endif
+    notify_register_dispatch("org.WebKit.lowMemory", &notifyToken,
+         dispatch_get_main_queue(), ^(int) { memoryPressureHandler().respondToMemoryPressure();});
 
     m_installed = true;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to