Changeset 195900 in webkit


Ignore:
Timestamp:
Jan 30, 2016 11:22:58 AM (8 years ago)
Author:
ddkilzer@apple.com
Message:

[iOS] WebKit1 apps crash in _ZN7WebCore16DiskCacheMonitorC2ERKNS_15ResourceRequestENS_9SessionIDEPK20_CFCachedURLResponse_block_invoke1
<http://webkit.org/b/153710>
<rdar://problem/23116706>

Reviewed by Darin Adler.

  • loader/cocoa/DiskCacheMonitorCocoa.mm:

(WebCore::DiskCacheMonitor::DiskCacheMonitor):

  • Fix race condition on iOS WebKit1 clients by calling the block to cancel the DiskCacheMonitor on the WebThread, which is the same thread where the CFCachedURLResponseCallBackBlock is called.
  • Removed whitespace to adhere to style.
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r195899 r195900  
     12016-01-30  David Kilzer  <ddkilzer@apple.com>
     2
     3        [iOS] WebKit1 apps crash in ___ZN7WebCore16DiskCacheMonitorC2ERKNS_15ResourceRequestENS_9SessionIDEPK20_CFCachedURLResponse_block_invoke1
     4        <http://webkit.org/b/153710>
     5        <rdar://problem/23116706>
     6
     7        Reviewed by Darin Adler.
     8
     9        * loader/cocoa/DiskCacheMonitorCocoa.mm:
     10        (WebCore::DiskCacheMonitor::DiskCacheMonitor):
     11        - Fix race condition on iOS WebKit1 clients by calling the block
     12          to cancel the DiskCacheMonitor on the WebThread, which is the
     13          same thread where the CFCachedURLResponseCallBackBlock is
     14          called.
     15        - Removed whitespace to adhere to style.
     16
    1172016-01-30  Ryosuke Niwa  <rniwa@webkit.org>
    218
  • trunk/Source/WebCore/loader/cocoa/DiskCacheMonitorCocoa.mm

    r183234 r195900  
    7272    // Set up a delayed callback to cancel this monitor if the resource hasn't been cached yet.
    7373    __block DiskCacheMonitor* rawMonitor = this;
    74 
    75     dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * diskCacheMonitorTimeout), dispatch_get_main_queue(), ^{
     74    auto cancelMonitorBlock = ^{
    7675        delete rawMonitor; // Balanced by "new DiskCacheMonitor" in monitorFileBackingStoreCreation.
    7776        rawMonitor = nullptr;
    78     });
     77    };
     78
     79#if USE(WEB_THREAD)
     80    auto cancelMonitorBlockToRun = ^{
     81        WebThreadRun(cancelMonitorBlock);
     82    };
     83#else
     84    auto cancelMonitorBlockToRun = cancelMonitorBlock;
     85#endif
     86
     87    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC * diskCacheMonitorTimeout), dispatch_get_main_queue(), cancelMonitorBlockToRun);
    7988
    8089    // Set up the disk caching callback to create the ShareableResource and send it to the WebProcess.
     
    97106
    98107#if USE(WEB_THREAD)
    99     CFCachedURLResponseCallBackBlock blockToRun = ^ (CFCachedURLResponseRef response)
     108    CFCachedURLResponseCallBackBlock blockToRun = ^(CFCachedURLResponseRef response)
    100109    {
    101110        CFRetain(response);
    102         WebThreadRun(^ {
     111        WebThreadRun(^{
    103112            block(response);
    104113            CFRelease(response);
Note: See TracChangeset for help on using the changeset viewer.