Changeset 89214 in webkit


Ignore:
Timestamp:
Jun 19, 2011 5:55:20 AM (13 years ago)
Author:
msaboff@apple.com
Message:

2011-06-19 Michael Saboff <msaboff@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):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r89213 r89214  
     12011-06-19  Michael Saboff  <msaboff@apple.com>
     2
     3        Reviewed by Darin Adler.
     4
     5        Add notify handler to trigger MemoryPressureHandler in all builds
     6        https://bugs.webkit.org/show_bug.cgi?id=62679
     7
     8        Removed SIGUSR2 trigger and added a notify trigger for the
     9        MemoryPressureHandler.  The notify trigger is enabled for all builds.
     10
     11        No test added as only added new memory pressure trigger.
     12
     13        * platform/mac/MemoryPressureHandlerMac.mm:
     14        (WebCore::MemoryPressureHandler::install):
     15
    1162011-06-19  Robert Hogan  <robert@webkit.org>
    217
  • trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm

    r88871 r89214  
    3535#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
    3636#import <dispatch/dispatch.h>
     37#import <notify.h>
    3738
    3839#ifndef DISPATCH_SOURCE_TYPE_VM
     
    5253
    5354static dispatch_source_t _cache_event_source = 0;
    54 #ifndef NDEBUG
    55 static dispatch_source_t _cache_event_source2 = 0;
    56 #endif
    5755
    5856void MemoryPressureHandler::install()
    5957{
     58    static int notifyToken;
     59
    6060    if (m_installed)
    6161        return;
     
    7070    });
    7171
    72 #ifndef NDEBUG
    73     dispatch_async(dispatch_get_main_queue(), ^{
    74         _cache_event_source2 = dispatch_source_create(DISPATCH_SOURCE_TYPE_SIGNAL, SIGUSR2, 0, dispatch_get_main_queue());
    75         if (_cache_event_source2) {
    76             dispatch_set_context(_cache_event_source2, this);
    77             dispatch_source_set_event_handler(_cache_event_source2, ^{ memoryPressureHandler().respondToMemoryPressure();});
    78             dispatch_resume(_cache_event_source2);
    79             signal((int)SIGUSR2, SIG_IGN);
    80         }
    81     });
    82 #endif
     72    notify_register_dispatch("org.WebKit.lowMemory", &notifyToken,
     73         dispatch_get_main_queue(), ^(int) { memoryPressureHandler().respondToMemoryPressure();});
    8374
    8475    m_installed = true;
Note: See TracChangeset for help on using the changeset viewer.