Changeset 119546 in webkit


Ignore:
Timestamp:
Jun 5, 2012 6:37:09 PM (12 years ago)
Author:
Stephanie Lewis
Message:

https://bugs.webkit.org/show_bug.cgi?id=88370
Memory sampler should trigger low memory signal

Reviewed by Geoff Garen.

Source/WebCore:

No new tests. Verify by running stress test which crashes
in a few minutes without the fix.

Fix assumption in block code. We could get in a state where timer_event_source
had already been released before the block ran.

  • platform/mac/MemoryPressureHandlerMac.mm:

(WebCore::MemoryPressureHandler::holdOff):

Source/WebKit2:

Send low memory signal when running the memory sampler. We'd
like to test memory that cannot be freed.

  • Shared/WebMemorySampler.cpp:

(WebKit::WebMemorySampler::sampleTimerFired):

  • Shared/WebMemorySampler.h:

(WebMemorySampler):

  • Shared/mac/WebMemorySampler.mac.mm:

(WebKit):
(WebKit::WebMemorySampler::sendMemoryPressureEvent):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r119540 r119546  
     12012-06-05  Stephanie Lewis  <slewis@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=88370
     4        Memory sampler should trigger low memory signal
     5
     6        Reviewed by Geoff Garen.
     7
     8        No new tests. Verify by running stress test which crashes
     9        in a few minutes without the fix.
     10
     11        Fix assumption in block code.  We could get in a state where timer_event_source
     12        had already been released before the block ran.
     13
     14        * platform/mac/MemoryPressureHandlerMac.mm:
     15        (WebCore::MemoryPressureHandler::holdOff):
     16
    1172012-06-05  Yoshifumi Inoue  <yosin@chromium.org>
    218
  • trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm

    r113445 r119546  
    107107            dispatch_source_set_timer(_timer_event_source, dispatch_time(DISPATCH_TIME_NOW, seconds * NSEC_PER_SEC), DISPATCH_TIME_FOREVER, 1 * s_minimumHoldOffTime);
    108108            dispatch_source_set_event_handler(_timer_event_source, ^{
    109                 dispatch_source_cancel(_timer_event_source);
    110                 dispatch_release(_timer_event_source);
    111                 _timer_event_source = 0;
     109                if (_timer_event_source) {
     110                    dispatch_source_cancel(_timer_event_source);
     111                    dispatch_release(_timer_event_source);
     112                    _timer_event_source = 0;
     113                }
    112114                memoryPressureHandler().install();
    113115            });
  • trunk/Source/WebKit2/ChangeLog

    r119535 r119546  
     12012-06-04  Stephanie Lewis  <slewis@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=88370
     4        Memory sampler should trigger low memory signal
     5
     6        Reviewed by Geoff Garen.
     7
     8        Send low memory signal when running the memory sampler.  We'd
     9        like to test memory that cannot be freed.
     10
     11        * Shared/WebMemorySampler.cpp:
     12        (WebKit::WebMemorySampler::sampleTimerFired):
     13        * Shared/WebMemorySampler.h:
     14        (WebMemorySampler):
     15        * Shared/mac/WebMemorySampler.mac.mm:
     16        (WebKit):
     17        (WebKit::WebMemorySampler::sendMemoryPressureEvent):
     18
    1192012-06-05  Brady Eidson  <beidson@apple.com>
    220
  • trunk/Source/WebKit2/Shared/WebMemorySampler.cpp

    r95901 r119546  
    154154void WebMemorySampler::sampleTimerFired(Timer<WebMemorySampler>*)
    155155{
    156     appendCurrentMemoryUsageToFile(m_sampleLogFile);
     156    sendMemoryPressureEvent();
     157    appendCurrentMemoryUsageToFile(m_sampleLogFile);
    157158}
    158159
  • trunk/Source/WebKit2/Shared/WebMemorySampler.h

    r95901 r119546  
    9090    void stopTimerFired(WebCore::Timer<WebMemorySampler>*);
    9191    void appendCurrentMemoryUsageToFile(WebCore::PlatformFileHandle&);
     92    void sendMemoryPressureEvent();
    9293   
    9394    SystemMallocStats sampleSystemMalloc() const;
  • trunk/Source/WebKit2/Shared/mac/WebMemorySampler.mac.mm

    r95901 r119546  
    3434#import <mach/mach_types.h>
    3535#import <malloc/malloc.h>
     36#import <notify.h>
    3637#import <runtime/JSLock.h>
    3738#import <WebCore/JSDOMWindow.h>
     
    176177    return webKitMemoryStats;
    177178}
    178    
     179 
     180void WebMemorySampler::sendMemoryPressureEvent()
     181{
     182    // Free memory that could be released if we needed more.
     183    // We want to track memory that cannot.
     184    notify_post("org.WebKit.lowMemory");
     185}
     186
    179187}
    180188
Note: See TracChangeset for help on using the changeset viewer.