Bug 172405 - [CG] Use the SPI CGImageSourceGetTypeWithData() to get the typeIdentifierHint of an image
Summary: [CG] Use the SPI CGImageSourceGetTypeWithData() to get the typeIdentifierHint...
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Images (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Said Abou-Hallawa
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2017-05-19 17:57 PDT by Said Abou-Hallawa
Modified: 2017-05-22 14:23 PDT (History)
6 users (show)

See Also:


Attachments
Patch (12.54 KB, patch)
2017-05-19 18:44 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-elcapitan-wk2 (632.73 KB, application/zip)
2017-05-19 19:38 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews112 for mac-elcapitan (610.05 KB, application/zip)
2017-05-19 19:49 PDT, Build Bot
no flags Details
Archive of layout-test-results from ews100 for mac-elcapitan (941.15 KB, application/zip)
2017-05-19 23:22 PDT, Build Bot
no flags Details
Patch (10.13 KB, patch)
2017-05-20 23:54 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews115 for mac-elcapitan (1.56 MB, application/zip)
2017-05-21 02:13 PDT, Build Bot
no flags Details
Patch (10.13 KB, patch)
2017-05-21 16:48 PDT, Said Abou-Hallawa
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Said Abou-Hallawa 2017-05-19 17:57:30 PDT
I tried using CGImageSourceGetTypeWithURL() to get the typeIdentifierHint of an image. The typeIdentifierHint helps the CGImageSource choose the correct decoder from the beginning. This function works but it was very costly since it opens or loads the image file and read its header to guess its type. Opening and reading a local file takes many cycles to finish. Requesting the image resource through the network doubles the network traffic. Since we create the ImageDecoder when we first receive data from the network layer, we can use CGImageSourceGetTypeWithData() instead.
Comment 1 Said Abou-Hallawa 2017-05-19 18:44:55 PDT
Created attachment 310744 [details]
Patch
Comment 2 Said Abou-Hallawa 2017-05-19 18:48:32 PDT
<rdar://problem/31899716>
Comment 3 Build Bot 2017-05-19 19:38:00 PDT
Comment on attachment 310744 [details]
Patch

Attachment 310744 [details] did not pass mac-wk2-ews (mac-wk2):
Output: http://webkit-queues.webkit.org/results/3780516

Number of test failures exceeded the failure limit.
Comment 4 Build Bot 2017-05-19 19:38:01 PDT
Created attachment 310748 [details]
Archive of layout-test-results from ews107 for mac-elcapitan-wk2

The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews.
Bot: ews107  Port: mac-elcapitan-wk2  Platform: Mac OS X 10.11.6
Comment 5 Build Bot 2017-05-19 19:49:17 PDT
Comment on attachment 310744 [details]
Patch

Attachment 310744 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3780510

Number of test failures exceeded the failure limit.
Comment 6 Build Bot 2017-05-19 19:49:18 PDT
Created attachment 310750 [details]
Archive of layout-test-results from ews112 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews112  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 7 Build Bot 2017-05-19 23:22:20 PDT
Comment on attachment 310744 [details]
Patch

Attachment 310744 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.webkit.org/results/3781468

Number of test failures exceeded the failure limit.
Comment 8 Build Bot 2017-05-19 23:22:21 PDT
Created attachment 310764 [details]
Archive of layout-test-results from ews100 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: ews100  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 9 Said Abou-Hallawa 2017-05-20 23:54:02 PDT
Created attachment 310800 [details]
Patch
Comment 10 Build Bot 2017-05-21 02:13:43 PDT
Comment on attachment 310800 [details]
Patch

Attachment 310800 [details] did not pass mac-debug-ews (mac):
Output: http://webkit-queues.webkit.org/results/3787601

New failing tests:
imported/w3c/web-platform-tests/media-source/mediasource-buffered.html
Comment 11 Build Bot 2017-05-21 02:13:44 PDT
Created attachment 310805 [details]
Archive of layout-test-results from ews115 for mac-elcapitan

The attached test failures were seen while running run-webkit-tests on the mac-debug-ews.
Bot: ews115  Port: mac-elcapitan  Platform: Mac OS X 10.11.6
Comment 12 Said Abou-Hallawa 2017-05-21 16:48:40 PDT
Created attachment 310820 [details]
Patch
Comment 13 Simon Fraser (smfr) 2017-05-22 13:38:57 PDT
Comment on attachment 310820 [details]
Patch

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

> Source/WebCore/platform/graphics/ImageTypes.h:30
> +#if USE(CG)
> +typedef struct CGImageSource* CGImageSourceRef;
> +#endif

Why did this move?
Comment 14 Said Abou-Hallawa 2017-05-22 13:54:52 PDT
Comment on attachment 310820 [details]
Patch

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

>> Source/WebCore/platform/graphics/ImageTypes.h:30
>> +#endif
> 
> Why did this move?

I am planning to merge the following header files

Source/WebCore/platform/graphics/cg/ImageDecoderCG.h
Source/WebCore/platform/graphics/win/ImageDecoderDirect2D.h
Source/WebCore/platform/image-decoders/ImageDecoder.h

in one file:

Source/WebCore/platform/graphics/ImageDecoder.h

So I have been cleaning these header files to make it easy when they are merged.
Comment 15 WebKit Commit Bot 2017-05-22 14:23:27 PDT
Comment on attachment 310820 [details]
Patch

Clearing flags on attachment: 310820

Committed r217246: <http://trac.webkit.org/changeset/217246>
Comment 16 WebKit Commit Bot 2017-05-22 14:23:30 PDT
All reviewed patches have been landed.  Closing bug.