Changeset 231893 in webkit


Ignore:
Timestamp:
May 17, 2018 4:30:04 AM (6 years ago)
Author:
dino@apple.com
Message:

Safari optimized flow should be releasing viewer to prevent memory growth with subsequent launches/closes
https://bugs.webkit.org/show_bug.cgi?id=185722
<rdar://problem/40247351>

Reviewed by Antoine Quint.

I made a rookie mistake in the original patch: I was holding a strong
reference to "self" in a block, which was causing a retain cycle.
Replace that with a WeakObjCPtr.

  • UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:

(-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r231879 r231893  
     12018-05-17  Dean Jackson  <dino@apple.com>
     2
     3        Safari optimized flow should be releasing viewer to prevent memory growth with subsequent launches/closes
     4        https://bugs.webkit.org/show_bug.cgi?id=185722
     5        <rdar://problem/40247351>
     6
     7        Reviewed by Antoine Quint.
     8
     9        I made a rookie mistake in the original patch: I was holding a strong
     10        reference to "self" in a block, which was causing a retain cycle.
     11        Replace that with a WeakObjCPtr.
     12
     13        * UIProcess/Cocoa/SystemPreviewControllerCocoa.mm:
     14        (-[_WKPreviewControllerDataSource previewController:previewItemAtIndex:]):
     15
    1162018-05-16  Brent Fulgham  <bfulgham@apple.com>
    217
  • trunk/Source/WebKit/UIProcess/Cocoa/SystemPreviewControllerCocoa.mm

    r231825 r231893  
    3030
    3131#import "APIUIClient.h"
     32#import "WeakObjCPtr.h"
    3233#import "WebPageProxy.h"
    33 
    3434#import <MobileCoreServices/MobileCoreServices.h>
    3535#import <QuickLook/QuickLook.h>
     
    8888    [_item setUseLoadingTimeout:NO];
    8989
    90     [_itemProvider registerItemForTypeIdentifier:contentType loadHandler:^(NSItemProviderCompletionHandler completionHandler, Class expectedValueClass, NSDictionary * options) {
    91         // This will get called once the download completes.
    92         self.completionHandler = completionHandler;
     90    WebKit::WeakObjCPtr<_WKPreviewControllerDataSource> weakSelf { self };
     91    [_itemProvider registerItemForTypeIdentifier:contentType loadHandler:[weakSelf = WTFMove(weakSelf)] (NSItemProviderCompletionHandler completionHandler, Class expectedValueClass, NSDictionary * options) {
     92        if (auto strongSelf = weakSelf.get())
     93            [strongSelf setCompletionHandler:completionHandler];
    9394    }];
    9495    return _item.get();
Note: See TracChangeset for help on using the changeset viewer.