Changeset 167338 in webkit


Ignore:
Timestamp:
Apr 15, 2014 5:01:33 PM (10 years ago)
Author:
akling@apple.com
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)

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r167335 r167338  
     12014-04-15  Andreas Kling  <akling@apple.com>
     2
     3        [iOS WebKit2] Listen for system memory pressure notifications.
     4        <https://webkit.org/b/131653>
     5        <rdar://problem/16208123>
     6
     7        Reviewed by Antti Koivisto.
     8
     9        * platform/cocoa/MemoryPressureHandlerCocoa.mm:
     10        (WebCore::MemoryPressureHandler::install):
     11
     12            Use the right invocation to summon the memory pressure handler.
     13
     14        (WebCore::MemoryPressureHandler::install):
     15        (WebCore::MemoryPressureHandler::uninstall):
     16        (WebCore::MemoryPressureHandler::holdOff):
     17        (WebCore::MemoryPressureHandler::respondToMemoryPressure):
     18
     19            Make stubbed out functions !PLATFORM(COCOA)
     20
    1212014-04-14  Morten Stenshorne  <mstensho@opera.com>
    222
  • trunk/Source/WebCore/platform/MemoryPressureHandler.cpp

    r167277 r167338  
    9696}
    9797
    98 #if !PLATFORM(MAC)
     98#if !PLATFORM(COCOA)
    9999void MemoryPressureHandler::install() { }
    100100void MemoryPressureHandler::uninstall() { }
    101101void MemoryPressureHandler::holdOff(unsigned) { }
    102102void MemoryPressureHandler::respondToMemoryPressure() { }
    103 #endif
    104 
    105 #if !PLATFORM(COCOA)
    106103void MemoryPressureHandler::platformReleaseMemory(bool) { }
    107104#endif
  • trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm

    r167277 r167338  
    3939#import "SystemMemory.h"
    4040#import "WebCoreThread.h"
     41#import <dispatch/private.h>
    4142#endif
    4243
     
    5253#endif
    5354}
    54 
    55 #if PLATFORM(MAC)
    5655
    5756static dispatch_source_t _cache_event_source = 0;
     
    7473
    7574    dispatch_async(dispatch_get_main_queue(), ^{
    76 #if MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
     75#if PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000
     76        _cache_event_source = dispatch_source_create(DISPATCH_SOURCE_TYPE_MEMORYSTATUS, 0, DISPATCH_MEMORYSTATUS_PRESSURE_WARN, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0));
     77#elif PLATFORM(MAC) && MAC_OS_X_VERSION_MIN_REQUIRED >= 1090
    7778        _cache_event_source = wkCreateMemoryStatusPressureCriticalDispatchOnMainQueue();
    7879#else
     
    8182        if (_cache_event_source) {
    8283            dispatch_set_context(_cache_event_source, this);
    83             dispatch_source_set_event_handler(_cache_event_source, ^{ memoryPressureHandler().respondToMemoryPressure();});
     84            dispatch_source_set_event_handler(_cache_event_source, ^{
     85                memoryPressureHandler().respondToMemoryPressure();
     86            });
    8487            dispatch_resume(_cache_event_source);
    8588        }
     
    157160}
    158161
    159 #else // !PLATFORM(MAC)
    160 
     162#if PLATFORM(IOS)
    161163static void respondToMemoryPressureCallback(CFRunLoopObserverRef observer, CFRunLoopActivity /*activity*/, void* /*info*/)
    162164{
Note: See TracChangeset for help on using the changeset viewer.