⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 203149 in webkit


Ignore:
Timestamp:
Jul 12, 2016, 9:05:06 PM (10 years ago)
Author:
akling@apple.com
Message:

[Cocoa] Simulated memory warning doesn't trigger libcache purge.
<https://webkit.org/b/159688>

Reviewed by Chris Dumez.

Since simulated memory warnings will have the "is under memory pressure" flag set,
we were skipping the libcache purge call.

Add a separate flag that tracks whether we're under simulated pressure, and always
prod libcache in that case.

  • platform/MemoryPressureHandler.h:
  • platform/cocoa/MemoryPressureHandlerCocoa.mm:

(WebCore::MemoryPressureHandler::platformReleaseMemory):
(WebCore::MemoryPressureHandler::install):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r203146 r203149  
     12016-07-12  Andreas Kling  <akling@apple.com>
     2
     3        [Cocoa] Simulated memory warning doesn't trigger libcache purge.
     4        <https://webkit.org/b/159688>
     5
     6        Reviewed by Chris Dumez.
     7
     8        Since simulated memory warnings will have the "is under memory pressure" flag set,
     9        we were skipping the libcache purge call.
     10
     11        Add a separate flag that tracks whether we're under simulated pressure, and always
     12        prod libcache in that case.
     13
     14        * platform/MemoryPressureHandler.h:
     15        * platform/cocoa/MemoryPressureHandlerCocoa.mm:
     16        (WebCore::MemoryPressureHandler::platformReleaseMemory):
     17        (WebCore::MemoryPressureHandler::install):
     18
    1192016-07-12  Gyuyoung Kim  <gyuyoung.kim@webkit.org>
    220
  • trunk/Source/WebCore/platform/MemoryPressureHandler.h

    r202166 r203149  
    144144
    145145    std::atomic<bool> m_underMemoryPressure;
     146    bool m_isSimulatedMemoryPressure { false };
    146147
    147148#if PLATFORM(IOS)
  • trunk/Source/WebCore/platform/cocoa/MemoryPressureHandlerCocoa.mm

    r202090 r203149  
    8080#endif
    8181
    82     if (critical == Critical::Yes && !isUnderMemoryPressure()) {
     82    if (critical == Critical::Yes && (!isUnderMemoryPressure() || m_isSimulatedMemoryPressure)) {
    8383        // libcache listens to OS memory notifications, but for process suspension
    8484        // or memory pressure simulation, we need to prod it manually:
     
    140140    // Allow simulation of memory pressure with "notifyutil -p org.WebKit.lowMemory"
    141141    notify_register_dispatch("org.WebKit.lowMemory", &_notifyToken, dispatch_get_main_queue(), ^(int) {
     142        m_isSimulatedMemoryPressure = true;
     143
    142144#if ENABLE(FMW_FOOTPRINT_COMPARISON)
    143145        auto footprintBefore = pagesPerVMTag();
     
    161163        dispatch_async(dispatch_get_main_queue(), ^{
    162164            MemoryPressureHandler::singleton().setUnderMemoryPressure(wasUnderMemoryPressure);
     165            m_isSimulatedMemoryPressure = false;
    163166        });
    164167    });
Note: See TracChangeset for help on using the changeset viewer.