Diff
Modified: trunk/Source/WebKit/ChangeLog (260497 => 260498)
--- trunk/Source/WebKit/ChangeLog 2020-04-22 03:58:34 UTC (rev 260497)
+++ trunk/Source/WebKit/ChangeLog 2020-04-22 04:05:48 UTC (rev 260498)
@@ -1,5 +1,17 @@
2020-04-21 Ryan Haddad <ryanhad...@apple.com>
+ 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
+
+2020-04-21 Ryan Haddad <ryanhad...@apple.com>
+
Unreviewed, reverting r260410.
Caused crashes in Safari
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (260497 => 260498)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2020-04-22 03:58:34 UTC (rev 260497)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2020-04-22 04:05:48 UTC (rev 260498)
@@ -389,8 +389,13 @@
#endif
#if HAVE(QUICKLOOK_THUMBNAILING)
+#if PLATFORM(MAC)
+using PlatformImage = NSImage*;
+#elif PLATFORM(IOS_FAMILY)
+using PlatformImage = UIImage*;
+#endif
-static RefPtr<WebKit::ShareableBitmap> convertPlatformImageToBitmap(CocoaImage *image, const WebCore::IntSize& size)
+static RefPtr<WebKit::ShareableBitmap> convertPlatformImageToBitmap(PlatformImage image, const WebCore::IntSize& size)
{
WebKit::ShareableBitmap::Configuration bitmapConfiguration;
auto bitmap = WebKit::ShareableBitmap::createShareable(size, bitmapConfiguration);
@@ -427,7 +432,7 @@
});
}];
- [[WKQLThumbnailQueueManager sharedInstance].queue addOperation:operation];
+ [[WKQLThumbnailQueueManager sharedInstance].qlThumbnailGenerationQueue addOperation:operation];
}
@@ -444,8 +449,7 @@
}
-#endif // HAVE(QUICKLOOK_THUMBNAILING)
-
+#endif
} // namespace WebKit
#undef MESSAGE_CHECK_COMPLETION
Modified: trunk/Source/WebKit/UIProcess/QuickLookThumbnailLoader.h (260497 => 260498)
--- trunk/Source/WebKit/UIProcess/QuickLookThumbnailLoader.h 2020-04-22 03:58:34 UTC (rev 260497)
+++ trunk/Source/WebKit/UIProcess/QuickLookThumbnailLoader.h 2020-04-22 04:05:48 UTC (rev 260498)
@@ -25,35 +25,36 @@
#if HAVE(QUICKLOOK_THUMBNAILING)
-#if USE(APPKIT)
-@class NSImage;
-using CocoaImage = NSImage;
-#else
+#if PLATFORM(IOS_FAMILY)
@class UIImage;
-using CocoaImage = UIImage;
#endif
@interface WKQLThumbnailQueueManager : NSObject
-@property (nonatomic, readonly, retain) NSOperationQueue *queue;
-
-- (instancetype)init;
+@property (nonatomic, readwrite, retain) NSOperationQueue* qlThumbnailGenerationQueue;
+- (id)init;
+ (WKQLThumbnailQueueManager *)sharedInstance;
-
@end
@interface WKQLThumbnailLoadOperation : NSOperation
-@property (atomic, readonly, getter=isAsynchronous) BOOL asynchronous;
-@property (atomic, readonly, getter=isExecuting) BOOL executing;
-@property (atomic, readonly, getter=isFinished) BOOL finished;
+@property (readonly, getter=isAsynchronous) BOOL asynchronous;
+@property (readonly, getter=isExecuting) BOOL executing;
+@property (readonly, getter=isFinished) BOOL finished;
-@property (nonatomic, readonly, copy) NSString *identifier;
-@property (nonatomic, readonly, retain) CocoaImage *thumbnail;
+@property (nonatomic, copy) NSString *contentType;
+@property (nonatomic) BOOL shouldWrite;
-- (instancetype)initWithAttachment:(NSFileWrapper *)fileWrapper identifier:(NSString *)identifier;
-- (instancetype)initWithURL:(NSString *)fileURL identifier:(NSString *)identifier;
+- (id)initWithAttachment:(NSFileWrapper *)fileWrapper identifier:(NSString *)identifier;
+- (id)initWithURL:(NSString *)fileURL identifier:(NSString *)identifier;
+- (NSString *)identifier;
+#if PLATFORM(IOS_FAMILY)
+-(UIImage *)thumbnail;
+#endif
+#if PLATFORM(MAC)
+-(NSImage *)thumbnail;
+#endif
@end
-#endif // HAVE(QUICKLOOK_THUMBNAILING)
+#endif
Modified: trunk/Source/WebKit/UIProcess/QuickLookThumbnailLoader.mm (260497 => 260498)
--- trunk/Source/WebKit/UIProcess/QuickLookThumbnailLoader.mm 2020-04-22 03:58:34 UTC (rev 260497)
+++ trunk/Source/WebKit/UIProcess/QuickLookThumbnailLoader.mm 2020-04-22 04:05:48 UTC (rev 260498)
@@ -33,20 +33,14 @@
@implementation WKQLThumbnailQueueManager
-- (instancetype)init
+- (id)init
{
self = [super init];
if (self)
- _queue = [[NSOperationQueue alloc] init];
+ _qlThumbnailGenerationQueue = [[NSOperationQueue alloc] init];
return self;
}
-- (void)dealloc
-{
- [_queue release];
- [super dealloc];
-}
-
+ (WKQLThumbnailQueueManager *)sharedInstance
{
static WKQLThumbnailQueueManager *sharedInstance = [[WKQLThumbnailQueueManager alloc] init];
@@ -55,20 +49,19 @@
@end
-@interface WKQLThumbnailLoadOperation ()
-@property (atomic, readwrite, getter=isExecuting) BOOL executing;
-@property (atomic, readwrite, getter=isFinished) BOOL finished;
-@end
-
@implementation WKQLThumbnailLoadOperation {
RetainPtr<NSURL> _filePath;
- RetainPtr<NSString> _identifier;
+ RetainPtr<NSMutableString> _identifier;
RetainPtr<NSFileWrapper> _fileWrapper;
- RetainPtr<CocoaImage> _thumbnail;
- BOOL _shouldWrite;
+#if PLATFORM(MAC)
+ RetainPtr<NSImage> _thumbnail;
+#endif
+#if PLATFORM(IOS_FAMILY)
+ RetainPtr<UIImage> _thumbnail;
+#endif
}
-- (instancetype)initWithAttachment:(NSFileWrapper *)fileWrapper identifier:(NSString *)identifier
+- (id)initWithAttachment:(NSFileWrapper *)fileWrapper identifier:(NSString *)identifier
{
if (self = [super init]) {
_fileWrapper = fileWrapper;
@@ -78,7 +71,7 @@
return self;
}
-- (instancetype)initWithURL:(NSString *)fileURL identifier:(NSString *)identifier
+- (id)initWithURL:(NSString *)fileURL identifier:(NSString *)identifier
{
if (self = [super init]) {
_identifier = adoptNS([identifier copy]);
@@ -90,14 +83,14 @@
- (void)start
{
self.executing = YES;
-
+
if (_shouldWrite) {
NSString *temporaryDirectory = FileSystem::createTemporaryDirectory(@"QLTempFileData");
-
+
NSString *filePath = [temporaryDirectory stringByAppendingPathComponent:[_fileWrapper preferredFilename]];
NSFileWrapperWritingOptions options = 0;
NSError *error = nil;
-
+
auto fileURLPath = adoptNS([NSURL fileURLWithPath:filePath]);
[_fileWrapper writeToURL:fileURLPath.get() options:options originalContentsURL:nil error:&error];
@@ -106,17 +99,18 @@
return;
}
- RetainPtr<QLThumbnailGenerationRequest> request = adoptNS([[QLThumbnailGenerationRequest alloc] initWithFileAtURL:_filePath.get() size:CGSizeMake(400, 400) scale:1 representationTypes:QLThumbnailGenerationRequestRepresentationTypeAll]);
- request.get().iconMode = YES;
-
- [[QLThumbnailGenerator sharedGenerator] generateBestRepresentationForRequest:request.get() completionHandler:^(QLThumbnailRepresentation *thumbnail, NSError *error) {
+ QLThumbnailGenerationRequest *req = [[QLThumbnailGenerationRequest alloc] initWithFileAtURL:_filePath.get() size:CGSizeMake(400, 400) scale:1 representationTypes:QLThumbnailGenerationRequestRepresentationTypeAll];
+ req.iconMode = YES;
+
+ [[QLThumbnailGenerator sharedGenerator] generateBestRepresentationForRequest:req completionHandler:^(QLThumbnailRepresentation *thumbnail, NSError *error) {
if (error)
return;
if (_thumbnail)
return;
-#if USE(APPKIT)
+#if PLATFORM(MAC)
_thumbnail = thumbnail.NSImage;
-#else
+#endif
+#if PLATFORM(IOS_FAMILY)
_thumbnail = thumbnail.UIImage;
#endif
if (_shouldWrite)
@@ -127,11 +121,20 @@
}];
}
-- (CocoaImage *)thumbnail
+#if PLATFORM(IOS_FAMILY)
+- (UIImage *)thumbnail
{
return _thumbnail.get();
}
+#endif
+#if PLATFORM(MAC)
+- (NSImage *)thumbnail
+{
+ return _thumbnail.get();
+}
+#endif
+
- (NSString *)identifier
{
return _identifier.get();
@@ -184,4 +187,4 @@
@end
-#endif // HAVE(QUICKLOOK_THUMBNAILING)
+#endif