ASSIGNED 185839
Avoid loading AVFoundation to check supported MIME types if possible
https://bugs.webkit.org/show_bug.cgi?id=185839
Summary Avoid loading AVFoundation to check supported MIME types if possible
Eric Carlson
Reported 2018-05-21 14:17:54 PDT
Loading AVFoundation to call +[AVURLAssetClass audiovisualMIMETypes] triggers an allocation of more than 2MB. Move the call to the UI process and pass the list of types to each new web process so we can do it once per application instead of once per web process.
Attachments
Patch (22.44 KB, patch)
2018-05-21 14:39 PDT, Eric Carlson
no flags
Archive of layout-test-results from ews103 for mac-sierra (1.91 MB, application/zip)
2018-05-21 15:20 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews113 for mac-sierra (1.29 MB, application/zip)
2018-05-21 15:24 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews107 for mac-sierra-wk2 (3.23 MB, application/zip)
2018-05-21 16:02 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews124 for ios-simulator-wk2 (40.25 MB, application/zip)
2018-05-21 16:20 PDT, EWS Watchlist
no flags
Patch (34.01 KB, patch)
2018-05-23 13:42 PDT, Eric Carlson
no flags
Patch (33.51 KB, patch)
2018-05-23 13:59 PDT, Eric Carlson
jer.noble: review+
ews-watchlist: commit-queue-
Archive of layout-test-results from ews100 for mac-sierra (2.46 MB, application/zip)
2018-05-23 14:50 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews104 for mac-sierra-wk2 (3.50 MB, application/zip)
2018-05-23 15:03 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews126 for ios-simulator-wk2 (2.41 MB, application/zip)
2018-05-23 15:47 PDT, EWS Watchlist
no flags
Archive of layout-test-results from ews113 for mac-sierra (3.11 MB, application/zip)
2018-05-23 15:48 PDT, EWS Watchlist
no flags
Patch for landing (33.74 KB, patch)
2018-05-23 16:01 PDT, Eric Carlson
ews-watchlist: commit-queue-
Archive of layout-test-results from ews200 for win-future (12.79 MB, application/zip)
2018-05-23 17:42 PDT, EWS Watchlist
no flags
Eric Carlson
Comment 1 2018-05-21 14:18:54 PDT
Eric Carlson
Comment 2 2018-05-21 14:39:45 PDT
Simon Fraser (smfr)
Comment 3 2018-05-21 14:47:46 PDT
Comment on attachment 340895 [details] Patch How much time does this add to Safari launch on a slow iOS device? Before, we would do this lazily in the web process when we found an extension we didn't know how to handle. Now, you're paying the cost every time. I'm not sure this is an improvement.
Eric Carlson
Comment 4 2018-05-21 14:53:42 PDT
Comment on attachment 340895 [details] Patch Removing r?, this needs to be revised to work in WK1.
Jer Noble
Comment 5 2018-05-21 14:54:47 PDT
Comment on attachment 340895 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=340895&action=review So it appears that, as it stands, this patch will break WebKitLegacy, since there's no code path for it to initialize the AVFoundationMIMETypeCache. One idea to circumvent this problem would be to leave the AVFoundationMIMETypeCache implementation as-is, but add a "non-initializing singleton()" accessor that WK2 could use to fill the cache with pre-initialized values. > Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm:361 > - if (!supportsMediaType(MediaType::Video)) > - return nullptr; > + if (AVFoundationMIMETypeCache::singleton().types().contains(mimeType)) > + return true; I would change this sightly: ContentType type { mimeType }; if (!AVFoundationMIMETypeCache::singleton().types().contains(type.contentType())) return flase; That way, if the content-type portion of the MIME isn't an AVFoundation supported type, we don't bother asking the AVURLAsset for something which it's not going to support.
EWS Watchlist
Comment 6 2018-05-21 15:20:49 PDT
Comment on attachment 340895 [details] Patch Attachment 340895 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/7757570 Number of test failures exceeded the failure limit.
EWS Watchlist
Comment 7 2018-05-21 15:20:50 PDT
Created attachment 340907 [details] Archive of layout-test-results from ews103 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews103 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 8 2018-05-21 15:24:18 PDT
Comment on attachment 340895 [details] Patch Attachment 340895 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/7757505 Number of test failures exceeded the failure limit.
EWS Watchlist
Comment 9 2018-05-21 15:24:19 PDT
Created attachment 340908 [details] Archive of layout-test-results from ews113 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews113 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 10 2018-05-21 16:02:15 PDT
Comment on attachment 340895 [details] Patch Attachment 340895 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/7757907 New failing tests: fast/images/animated-image-mp4.html http/tests/images/image-supports-video.html fast/images/animated-image-mp4-crash.html
EWS Watchlist
Comment 11 2018-05-21 16:02:17 PDT
Created attachment 340915 [details] Archive of layout-test-results from ews107 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews107 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 12 2018-05-21 16:20:08 PDT
Comment on attachment 340895 [details] Patch Attachment 340895 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/7757756 New failing tests: fast/images/animated-image-mp4.html fast/images/animated-image-mp4-crash.html
EWS Watchlist
Comment 13 2018-05-21 16:20:10 PDT
Created attachment 340919 [details] Archive of layout-test-results from ews124 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews124 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.4
Eric Carlson
Comment 14 2018-05-23 13:41:16 PDT
*** Bug 185817 has been marked as a duplicate of this bug. ***
Eric Carlson
Comment 15 2018-05-23 13:42:33 PDT
Eric Carlson
Comment 16 2018-05-23 13:59:14 PDT
Jer Noble
Comment 17 2018-05-23 14:07:39 PDT
Comment on attachment 341126 [details] Patch r=me with a general nit. Rather than check whether the m_cache.isEmpty() to see whether it's been initialized, it might be better to have a "bool m_isInitialized" or change m_cache to an std::optional. That way, you can disambiguate between "the list of supported mime types is empty" and "the cache hasn't been initialized yet".
EWS Watchlist
Comment 18 2018-05-23 14:50:14 PDT
Comment on attachment 341126 [details] Patch Attachment 341126 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/7780928 New failing tests: fast/images/animated-image-mp4-crash.html http/tests/images/image-supports-video.html fast/images/animated-image-mp4.html
EWS Watchlist
Comment 19 2018-05-23 14:50:15 PDT
Created attachment 341132 [details] Archive of layout-test-results from ews100 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews100 Port: mac-sierra Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 20 2018-05-23 15:03:08 PDT
Comment on attachment 341126 [details] Patch Attachment 341126 [details] did not pass mac-wk2-ews (mac-wk2): Output: http://webkit-queues.webkit.org/results/7780953 New failing tests: fast/images/animated-image-mp4.html fast/images/animated-image-mp4-crash.html http/tests/images/image-supports-video.html
EWS Watchlist
Comment 21 2018-05-23 15:03:10 PDT
Created attachment 341133 [details] Archive of layout-test-results from ews104 for mac-sierra-wk2 The attached test failures were seen while running run-webkit-tests on the mac-wk2-ews. Bot: ews104 Port: mac-sierra-wk2 Platform: Mac OS X 10.12.6
EWS Watchlist
Comment 22 2018-05-23 15:47:20 PDT
Comment on attachment 341126 [details] Patch Attachment 341126 [details] did not pass ios-sim-ews (ios-simulator-wk2): Output: http://webkit-queues.webkit.org/results/7781188 New failing tests: fast/images/animated-image-mp4-crash.html fast/images/animated-image-mp4.html
EWS Watchlist
Comment 23 2018-05-23 15:47:22 PDT
Created attachment 341138 [details] Archive of layout-test-results from ews126 for ios-simulator-wk2 The attached test failures were seen while running run-webkit-tests on the ios-sim-ews. Bot: ews126 Port: ios-simulator-wk2 Platform: Mac OS X 10.13.4
EWS Watchlist
Comment 24 2018-05-23 15:48:15 PDT
Comment on attachment 341126 [details] Patch Attachment 341126 [details] did not pass mac-debug-ews (mac): Output: http://webkit-queues.webkit.org/results/7781239 New failing tests: fast/images/animated-image-mp4-crash.html fast/images/animated-image-mp4.html
EWS Watchlist
Comment 25 2018-05-23 15:48:16 PDT
Created attachment 341139 [details] Archive of layout-test-results from ews113 for mac-sierra The attached test failures were seen while running run-webkit-tests on the mac-debug-ews. Bot: ews113 Port: mac-sierra Platform: Mac OS X 10.12.6
Eric Carlson
Comment 26 2018-05-23 16:01:01 PDT
Created attachment 341142 [details] Patch for landing
WebKit Commit Bot
Comment 27 2018-05-23 17:01:00 PDT
Comment on attachment 341142 [details] Patch for landing Clearing flags on attachment: 341142 Committed r232136: <https://trac.webkit.org/changeset/232136>
EWS Watchlist
Comment 28 2018-05-23 17:42:00 PDT
Comment on attachment 341142 [details] Patch for landing Attachment 341142 [details] did not pass win-ews (win): Output: http://webkit-queues.webkit.org/results/7782529 New failing tests: http/tests/security/contentSecurityPolicy/userAgentShadowDOM/allow-video.html
EWS Watchlist
Comment 29 2018-05-23 17:42:12 PDT
Created attachment 341152 [details] Archive of layout-test-results from ews200 for win-future The attached test failures were seen while running run-webkit-tests on the win-ews. Bot: ews200 Port: win-future Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Simon Fraser (smfr)
Comment 30 2018-05-23 20:44:20 PDT
Could you address my comment #3 please?
Eric Carlson
Comment 31 2018-05-24 10:46:18 PDT
(In reply to Simon Fraser (smfr) from comment #30) > Could you address my comment #3 please? Please read the patch.
Note You need to log in before you can comment on or make changes to this bug.