Changeset 260498 in webkit
- Timestamp:
- Apr 21, 2020 9:05:48 PM (4 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r260497 r260498 1 2020-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 1 13 2020-04-21 Ryan Haddad <ryanhaddad@apple.com> 2 14 -
trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
r260478 r260498 390 390 391 391 #if HAVE(QUICKLOOK_THUMBNAILING) 392 393 static RefPtr<WebKit::ShareableBitmap> convertPlatformImageToBitmap(CocoaImage *image, const WebCore::IntSize& size) 392 #if PLATFORM(MAC) 393 using PlatformImage = NSImage*; 394 #elif PLATFORM(IOS_FAMILY) 395 using PlatformImage = UIImage*; 396 #endif 397 398 static RefPtr<WebKit::ShareableBitmap> convertPlatformImageToBitmap(PlatformImage image, const WebCore::IntSize& size) 394 399 { 395 400 WebKit::ShareableBitmap::Configuration bitmapConfiguration; … … 428 433 }]; 429 434 430 [[WKQLThumbnailQueueManager sharedInstance].q ueue addOperation:operation];435 [[WKQLThumbnailQueueManager sharedInstance].qlThumbnailGenerationQueue addOperation:operation]; 431 436 } 432 437 … … 445 450 } 446 451 447 #endif // HAVE(QUICKLOOK_THUMBNAILING) 448 452 #endif 449 453 } // namespace WebKit 450 454 -
trunk/Source/WebKit/UIProcess/QuickLookThumbnailLoader.h
r260478 r260498 26 26 #if HAVE(QUICKLOOK_THUMBNAILING) 27 27 28 #if USE(APPKIT) 29 @class NSImage; 30 using CocoaImage = NSImage; 31 #else 28 #if PLATFORM(IOS_FAMILY) 32 29 @class UIImage; 33 using CocoaImage = UIImage;34 30 #endif 35 31 36 32 @interface WKQLThumbnailQueueManager : NSObject 37 33 38 @property (nonatomic, readonly, retain) NSOperationQueue *queue; 39 40 - (instancetype)init; 34 @property (nonatomic, readwrite, retain) NSOperationQueue* qlThumbnailGenerationQueue; 35 - (id)init; 41 36 + (WKQLThumbnailQueueManager *)sharedInstance; 42 43 37 @end 44 38 45 39 @interface WKQLThumbnailLoadOperation : NSOperation 46 40 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; 50 44 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; 53 47 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 56 57 57 58 @end 58 59 59 #endif // HAVE(QUICKLOOK_THUMBNAILING)60 #endif -
trunk/Source/WebKit/UIProcess/QuickLookThumbnailLoader.mm
r260478 r260498 34 34 @implementation WKQLThumbnailQueueManager 35 35 36 - (i nstancetype)init36 - (id)init 37 37 { 38 38 self = [super init]; 39 39 if (self) 40 _q ueue = [[NSOperationQueue alloc] init];40 _qlThumbnailGenerationQueue = [[NSOperationQueue alloc] init]; 41 41 return self; 42 }43 44 - (void)dealloc45 {46 [_queue release];47 [super dealloc];48 42 } 49 43 … … 56 50 @end 57 51 58 @interface WKQLThumbnailLoadOperation ()59 @property (atomic, readwrite, getter=isExecuting) BOOL executing;60 @property (atomic, readwrite, getter=isFinished) BOOL finished;61 @end62 63 52 @implementation WKQLThumbnailLoadOperation { 64 53 RetainPtr<NSURL> _filePath; 65 RetainPtr<NS String> _identifier;54 RetainPtr<NSMutableString> _identifier; 66 55 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 69 62 } 70 63 71 - (i nstancetype)initWithAttachment:(NSFileWrapper *)fileWrapper identifier:(NSString *)identifier64 - (id)initWithAttachment:(NSFileWrapper *)fileWrapper identifier:(NSString *)identifier 72 65 { 73 66 if (self = [super init]) { … … 79 72 } 80 73 81 - (i nstancetype)initWithURL:(NSString *)fileURL identifier:(NSString *)identifier74 - (id)initWithURL:(NSString *)fileURL identifier:(NSString *)identifier 82 75 { 83 76 if (self = [super init]) { … … 91 84 { 92 85 self.executing = YES; 93 86 94 87 if (_shouldWrite) { 95 88 NSString *temporaryDirectory = FileSystem::createTemporaryDirectory(@"QLTempFileData"); 96 89 97 90 NSString *filePath = [temporaryDirectory stringByAppendingPathComponent:[_fileWrapper preferredFilename]]; 98 91 NSFileWrapperWritingOptions options = 0; 99 92 NSError *error = nil; 100 93 101 94 auto fileURLPath = adoptNS([NSURL fileURLWithPath:filePath]); 102 95 … … 107 100 } 108 101 109 RetainPtr<QLThumbnailGenerationRequest> request = adoptNS([[QLThumbnailGenerationRequest alloc] initWithFileAtURL:_filePath.get() size:CGSizeMake(400, 400) scale:1 representationTypes:QLThumbnailGenerationRequestRepresentationTypeAll]);110 req uest.get().iconMode = YES;111 112 [[QLThumbnailGenerator sharedGenerator] generateBestRepresentationForRequest:req uest.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) { 113 106 if (error) 114 107 return; 115 108 if (_thumbnail) 116 109 return; 117 #if USE(APPKIT)110 #if PLATFORM(MAC) 118 111 _thumbnail = thumbnail.NSImage; 119 #else 112 #endif 113 #if PLATFORM(IOS_FAMILY) 120 114 _thumbnail = thumbnail.UIImage; 121 115 #endif … … 128 122 } 129 123 130 - (CocoaImage *)thumbnail 124 #if PLATFORM(IOS_FAMILY) 125 - (UIImage *)thumbnail 131 126 { 132 127 return _thumbnail.get(); 133 128 } 129 #endif 130 131 #if PLATFORM(MAC) 132 - (NSImage *)thumbnail 133 { 134 return _thumbnail.get(); 135 } 136 #endif 134 137 135 138 - (NSString *)identifier … … 185 188 @end 186 189 187 #endif // HAVE(QUICKLOOK_THUMBNAILING)190 #endif
Note: See TracChangeset
for help on using the changeset viewer.