Changeset 260498 in webkit


Ignore:
Timestamp:
Apr 21, 2020 9:05:48 PM (4 years ago)
Author:
Ryan Haddad
Message:

Unreviewed, reverting r260478.

Caused TestWebKitAPI.WKAttachmentTests crashes on Catalina

Reverted changeset:

"Clean up QuickLookThumbnailLoader"
https://bugs.webkit.org/show_bug.cgi?id=210814
https://trac.webkit.org/changeset/260478

Location:
trunk/Source/WebKit
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r260497 r260498  
     12020-04-21  Ryan Haddad  <ryanhaddad@apple.com>
     2
     3        Unreviewed, reverting r260478.
     4
     5        Caused TestWebKitAPI.WKAttachmentTests crashes on Catalina
     6
     7        Reverted changeset:
     8
     9        "Clean up QuickLookThumbnailLoader"
     10        https://bugs.webkit.org/show_bug.cgi?id=210814
     11        https://trac.webkit.org/changeset/260478
     12
    1132020-04-21  Ryan Haddad  <ryanhaddad@apple.com>
    214
  • trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm

    r260478 r260498  
    390390
    391391#if HAVE(QUICKLOOK_THUMBNAILING)
    392 
    393 static RefPtr<WebKit::ShareableBitmap> convertPlatformImageToBitmap(CocoaImage *image, const WebCore::IntSize& size)
     392#if PLATFORM(MAC)
     393using PlatformImage = NSImage*;
     394#elif PLATFORM(IOS_FAMILY)
     395using PlatformImage = UIImage*;
     396#endif
     397
     398static RefPtr<WebKit::ShareableBitmap> convertPlatformImageToBitmap(PlatformImage image, const WebCore::IntSize& size)
    394399{
    395400    WebKit::ShareableBitmap::Configuration bitmapConfiguration;
     
    428433    }];
    429434       
    430     [[WKQLThumbnailQueueManager sharedInstance].queue addOperation:operation];
     435    [[WKQLThumbnailQueueManager sharedInstance].qlThumbnailGenerationQueue addOperation:operation];
    431436}
    432437
     
    445450}
    446451
    447 #endif // HAVE(QUICKLOOK_THUMBNAILING)
    448 
     452#endif
    449453} // namespace WebKit
    450454
  • trunk/Source/WebKit/UIProcess/QuickLookThumbnailLoader.h

    r260478 r260498  
    2626#if HAVE(QUICKLOOK_THUMBNAILING)
    2727
    28 #if USE(APPKIT)
    29 @class NSImage;
    30 using CocoaImage = NSImage;
    31 #else
     28#if PLATFORM(IOS_FAMILY)
    3229@class UIImage;
    33 using CocoaImage = UIImage;
    3430#endif
    3531
    3632@interface WKQLThumbnailQueueManager : NSObject
    3733
    38 @property (nonatomic, readonly, retain) NSOperationQueue *queue;
    39 
    40 - (instancetype)init;
     34@property (nonatomic, readwrite, retain) NSOperationQueue* qlThumbnailGenerationQueue;
     35- (id)init;
    4136+ (WKQLThumbnailQueueManager *)sharedInstance;
    42 
    4337@end
    4438
    4539@interface WKQLThumbnailLoadOperation : NSOperation
    4640
    47 @property (atomic, readonly, getter=isAsynchronous) BOOL asynchronous;
    48 @property (atomic, readonly, getter=isExecuting) BOOL executing;
    49 @property (atomic, readonly, getter=isFinished) BOOL finished;
     41@property (readonly, getter=isAsynchronous) BOOL asynchronous;
     42@property (readonly, getter=isExecuting) BOOL executing;
     43@property (readonly, getter=isFinished) BOOL finished;
    5044
    51 @property (nonatomic, readonly, copy) NSString *identifier;
    52 @property (nonatomic, readonly, retain) CocoaImage *thumbnail;
     45@property (nonatomic, copy) NSString *contentType;
     46@property (nonatomic) BOOL shouldWrite;
    5347
    54 - (instancetype)initWithAttachment:(NSFileWrapper *)fileWrapper identifier:(NSString *)identifier;
    55 - (instancetype)initWithURL:(NSString *)fileURL identifier:(NSString *)identifier;
     48- (id)initWithAttachment:(NSFileWrapper *)fileWrapper identifier:(NSString *)identifier;
     49- (id)initWithURL:(NSString *)fileURL identifier:(NSString *)identifier;
     50- (NSString *)identifier;
     51#if PLATFORM(IOS_FAMILY)
     52-(UIImage *)thumbnail;
     53#endif
     54#if PLATFORM(MAC)
     55-(NSImage *)thumbnail;
     56#endif
    5657
    5758@end
    5859
    59 #endif // HAVE(QUICKLOOK_THUMBNAILING)
     60#endif
  • trunk/Source/WebKit/UIProcess/QuickLookThumbnailLoader.mm

    r260478 r260498  
    3434@implementation WKQLThumbnailQueueManager
    3535
    36 - (instancetype)init
     36- (id)init
    3737{
    3838    self = [super init];
    3939    if (self)
    40         _queue = [[NSOperationQueue alloc] init];
     40        _qlThumbnailGenerationQueue = [[NSOperationQueue alloc] init];
    4141    return self;
    42 }
    43 
    44 - (void)dealloc
    45 {
    46     [_queue release];
    47     [super dealloc];
    4842}
    4943
     
    5650@end
    5751
    58 @interface WKQLThumbnailLoadOperation ()
    59 @property (atomic, readwrite, getter=isExecuting) BOOL executing;
    60 @property (atomic, readwrite, getter=isFinished) BOOL finished;
    61 @end
    62 
    6352@implementation WKQLThumbnailLoadOperation {
    6453    RetainPtr<NSURL> _filePath;
    65     RetainPtr<NSString> _identifier;
     54    RetainPtr<NSMutableString> _identifier;
    6655    RetainPtr<NSFileWrapper> _fileWrapper;
    67     RetainPtr<CocoaImage> _thumbnail;
    68     BOOL _shouldWrite;
     56#if PLATFORM(MAC)
     57    RetainPtr<NSImage> _thumbnail;
     58#endif
     59#if PLATFORM(IOS_FAMILY)
     60    RetainPtr<UIImage> _thumbnail;
     61#endif
    6962}
    7063
    71 - (instancetype)initWithAttachment:(NSFileWrapper *)fileWrapper identifier:(NSString *)identifier
     64- (id)initWithAttachment:(NSFileWrapper *)fileWrapper identifier:(NSString *)identifier
    7265{
    7366    if (self = [super init]) {
     
    7972}
    8073
    81 - (instancetype)initWithURL:(NSString *)fileURL identifier:(NSString *)identifier
     74- (id)initWithURL:(NSString *)fileURL identifier:(NSString *)identifier
    8275{
    8376    if (self = [super init]) {
     
    9184{
    9285    self.executing = YES;
    93 
     86   
    9487    if (_shouldWrite) {
    9588        NSString *temporaryDirectory = FileSystem::createTemporaryDirectory(@"QLTempFileData");
    96 
     89   
    9790        NSString *filePath = [temporaryDirectory stringByAppendingPathComponent:[_fileWrapper preferredFilename]];
    9891        NSFileWrapperWritingOptions options = 0;
    9992        NSError *error = nil;
    100 
     93       
    10194        auto fileURLPath = adoptNS([NSURL fileURLWithPath:filePath]);
    10295
     
    107100    }
    108101
    109     RetainPtr<QLThumbnailGenerationRequest> request = adoptNS([[QLThumbnailGenerationRequest alloc] initWithFileAtURL:_filePath.get() size:CGSizeMake(400, 400) scale:1 representationTypes:QLThumbnailGenerationRequestRepresentationTypeAll]);
    110     request.get().iconMode = YES;
    111 
    112     [[QLThumbnailGenerator sharedGenerator] generateBestRepresentationForRequest:request.get() completionHandler:^(QLThumbnailRepresentation *thumbnail, NSError *error) {
     102    QLThumbnailGenerationRequest *req = [[QLThumbnailGenerationRequest alloc] initWithFileAtURL:_filePath.get() size:CGSizeMake(400, 400) scale:1 representationTypes:QLThumbnailGenerationRequestRepresentationTypeAll];
     103    req.iconMode = YES;
     104   
     105    [[QLThumbnailGenerator sharedGenerator] generateBestRepresentationForRequest:req completionHandler:^(QLThumbnailRepresentation *thumbnail, NSError *error) {
    113106        if (error)
    114107            return;
    115108        if (_thumbnail)
    116109            return;
    117 #if USE(APPKIT)
     110#if PLATFORM(MAC)
    118111        _thumbnail = thumbnail.NSImage;
    119 #else
     112#endif
     113#if PLATFORM(IOS_FAMILY)
    120114        _thumbnail = thumbnail.UIImage;
    121115#endif
     
    128122}
    129123
    130 - (CocoaImage *)thumbnail
     124#if PLATFORM(IOS_FAMILY)
     125- (UIImage *)thumbnail
    131126{
    132127    return _thumbnail.get();
    133128}
     129#endif
     130
     131#if PLATFORM(MAC)
     132- (NSImage *)thumbnail
     133{
     134    return _thumbnail.get();
     135}
     136#endif
    134137
    135138- (NSString *)identifier
     
    185188@end
    186189
    187 #endif // HAVE(QUICKLOOK_THUMBNAILING)
     190#endif
Note: See TracChangeset for help on using the changeset viewer.