Bug 171320 - WebItemProviderPasteboard should fetch preloaded assets from disk when possible
Summary: WebItemProviderPasteboard should fetch preloaded assets from disk when possible
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Wenson Hsieh
URL:
Keywords: InRadar
Depends on:
Blocks: 171341
  Show dependency treegraph
 
Reported: 2017-04-26 03:31 PDT by Wenson Hsieh
Modified: 2017-04-28 21:44 PDT (History)
5 users (show)

See Also:


Attachments
First pass (19.20 KB, patch)
2017-04-26 03:49 PDT, Wenson Hsieh
thorton: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Wenson Hsieh 2017-04-26 03:31:59 PDT
<rdar://problem/31614010>
Comment 1 Wenson Hsieh 2017-04-26 03:49:45 PDT
Created attachment 308235 [details]
First pass
Comment 2 Tim Horton 2017-04-26 15:51:32 PDT
Comment on attachment 308235 [details]
First pass

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

> Source/WebCore/platform/ios/WebItemProviderPasteboard.mm:182
> +    RetainPtr<NSArray> _typeToFileURLMaps;

What's with all these NSArrays? (no need to fix in this patch though)

> Source/WebCore/platform/ios/WebItemProviderPasteboard.mm:294
> +        // We've already loaded data relevant for this UTI type into disk, so there's no need to ask the UIItemProvider for the same data again.

into disk? onto disk?

> Source/WebCore/platform/ios/WebItemProviderPasteboard.mm:295
> +        if (NSData *result = [NSData dataWithContentsOfURL:typeToFileURLMap[loadedType] options:NSDataReadingMappedAlways error:nil])

Should we go with Always or IfSafe?
Comment 3 Wenson Hsieh 2017-04-26 20:47:27 PDT
(In reply to Tim Horton from comment #2)
> Comment on attachment 308235 [details]
> First pass
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=308235&action=review
> 
> > Source/WebCore/platform/ios/WebItemProviderPasteboard.mm:182
> > +    RetainPtr<NSArray> _typeToFileURLMaps;
> 
> What's with all these NSArrays? (no need to fix in this patch though)

There's no particular reason these are just NSArrays :/ I'll refactor these to be Vector<RetainPtr<NSString>> in a followup patch.

> 
> > Source/WebCore/platform/ios/WebItemProviderPasteboard.mm:294
> > +        // We've already loaded data relevant for this UTI type into disk, so there's no need to ask the UIItemProvider for the same data again.
> 
> into disk? onto disk?

s/into/onto/

> 
> > Source/WebCore/platform/ios/WebItemProviderPasteboard.mm:295
> > +        if (NSData *result = [NSData dataWithContentsOfURL:typeToFileURLMap[loadedType] options:NSDataReadingMappedAlways error:nil])
> 
> Should we go with Always or IfSafe?

Good point. Changed to use NSDataReadingMappedIfSafe.

Committed <https://trac.webkit.org/changeset/215835>