[webkit-reviews] review granted: [Bug 189288] Post review Weinig fix-ups : [Attachment 348876] Patch

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Sep 4 17:22:52 PDT 2018


Sam Weinig <sam at webkit.org> has granted Dean Jackson <dino at apple.com>'s request
for review:
Bug 189288: Post review Weinig fix-ups
https://bugs.webkit.org/show_bug.cgi?id=189288

Attachment 348876: Patch

https://bugs.webkit.org/attachment.cgi?id=348876&action=review




--- Comment #2 from Sam Weinig <sam at webkit.org> ---
Comment on attachment 348876
  --> https://bugs.webkit.org/attachment.cgi?id=348876
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=348876&action=review

> Source/WebCore/platform/MIMETypeRegistry.cpp:710
> +    static NeverDestroyed<HashSet<String, ASCIICaseInsensitiveHash>>
systemPreviewMIMETypes = std::initializer_list<String> {

I think you want to remove the global static above as well.

> Source/WebCore/rendering/RenderThemeIOS.mm:1866
>      static NSBundle *arKitBundle;
> -    static dispatch_once_t onceToken;
> -    dispatch_once(&onceToken, ^{
> +    if (!arKitBundle) {
>  #if PLATFORM(IOS_SIMULATOR)
>	  
dlopen("/System/Library/PrivateFrameworks/AssetViewer.framework/AssetViewer",
RTLD_NOW);
>	   arKitBundle = [NSBundle
bundleForClass:NSClassFromString(@"ASVThumbnailView")];
>  #else
>	   arKitBundle = [NSBundle bundleWithURL:[NSURL
fileURLWithPath:@"/System/Library/PrivateFrameworks/AssetViewer.framework"]];
>  #endif
> -    });
> +    }

If you wanted to, you could do this with a lamba, removing the if-statement,
but I am not sure it is any better.

static NSBundle *arKitBundle = []() { 
    ...
    return [NSBundle ...
}();

> Source/WebCore/rendering/RenderThemeIOS.mm:-1895
>      static CGPDFPageRef logoPage;
> -    static dispatch_once_t onceToken;
> -    dispatch_once(&onceToken, ^{
> +    if (!logoPage)
>	   logoPage = loadARKitPDFPage(@"ARKitBadge").leakRef();
> -    });

This could all be one line.


More information about the webkit-reviews mailing list