WebKit Bugzilla
Attachment 340895 Details for
Bug 185839
: Avoid loading AVFoundation to check supported MIME types if possible
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185839-20180521143944.patch (text/plain), 22.44 KB, created by
Eric Carlson
on 2018-05-21 14:39:45 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Eric Carlson
Created:
2018-05-21 14:39:45 PDT
Size:
22.44 KB
patch
obsolete
>Subversion Revision: 231983 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ef77cb83859a3bc9b332867e0a88dea75276f71a..3546005114d3e98f5465667bcc24c1299d60e050 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,45 @@ >+2018-05-21 Eric Carlson <eric.carlson@apple.com> >+ >+ Don't load AVFoundation in the web process just to check supported MIME types >+ https://bugs.webkit.org/show_bug.cgi?id=185839 >+ <rdar://problem/40182010> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Move the call to +[AVURLAssetClass audiovisualMIMETypes] to the UI process and pass >+ the list of types to each new web process so every web process doesn't need to load >+ AVFoundation just to check supported types. >+ >+ * WebCore.xcodeproj/project.pbxproj: >+ >+ * platform/graphics/ImageDecoder.cpp: >+ (WebCore::ImageDecoder::create): Check ImageDecoderAVFObjC last in case another decoder >+ supports the type. >+ >+ * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h: >+ * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm: >+ (WebCore::AVFoundationMIMETypeCache::singleton): >+ (WebCore::AVFoundationMIMETypeCache::setSupportedTypes): >+ (WebCore::AVFoundationMIMETypeCache::types): >+ (WebCore::AVFoundationMIMETypeCache::isEmpty const): >+ (WebCore::AVFoundationMIMETypeCache::AVFoundationMIMETypeCache): Deleted. >+ (WebCore::AVFoundationMIMETypeCache::loadTypes): Deleted. >+ >+ * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: >+ (WebCore::ImageDecoderAVFObjC::create): Assume AVFoundation isn't available if the type >+ cache is empty. >+ (WebCore::ImageDecoderAVFObjC::supportsMediaType): Ditto. >+ (WebCore::ImageDecoderAVFObjC::supportsContentType): Ditto. >+ (WebCore::ImageDecoderAVFObjC::canDecodeType): Check the AVFoundationMIMETypeCache >+ before asking AVAsset. >+ >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: >+ (WebCore::MediaPlayerPrivateAVFoundationObjC::registerMediaEngine): ASSERT if the >+ AVFoundationMIMETypeCache is empty, it shouldn't be possible to get here in that state. >+ >+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: >+ (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine): Ditto. >+ > 2018-05-18 Jer Noble <jer.noble@apple.com> > > Complete fix for enabling modern EME by default >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 5727f58c04ce03a4c3a49c747948336fdc3a73aa..655c37228f4ae394cfa57bf843c1f3453577d7b4 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,27 @@ >+2018-05-21 Eric Carlson <eric.carlson@apple.com> >+ >+ Don't load AVFoundation in the web process just to check supported MIME types >+ https://bugs.webkit.org/show_bug.cgi?id=185839 >+ <rdar://problem/40182010> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Move the call to +[AVURLAssetClass audiovisualMIMETypes] to the UI process and pass >+ the list of types to each new web process so every web process doesn't need to load >+ AVFoundation just to check supported types. >+ >+ * Shared/WebPageCreationParameters.cpp: >+ (WebKit::WebPageCreationParameters::encode const): >+ (WebKit::WebPageCreationParameters::decode): >+ * Shared/WebPageCreationParameters.h: >+ * UIProcess/Cocoa/WebPageProxyCocoa.mm: >+ (WebKit::WebPageProxy::mediaMIMETypes): >+ * UIProcess/WebPageProxy.cpp: >+ (WebKit::WebPageProxy::creationParameters): >+ * UIProcess/WebPageProxy.h: >+ * WebProcess/WebPage/WebPage.cpp: >+ (WebKit::WebPage): >+ > 2018-05-18 Jer Noble <jer.noble@apple.com> > > Complete fix for enabling modern EME by default >diff --git a/Source/WebCore/WebCore.xcodeproj/project.pbxproj b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >index b5104d1d4a71c3893c35e9d60d53797a8341fcb0..fa6a2085b91b91511d6bcb9bc81c633b1c541de4 100644 >--- a/Source/WebCore/WebCore.xcodeproj/project.pbxproj >+++ b/Source/WebCore/WebCore.xcodeproj/project.pbxproj >@@ -219,6 +219,7 @@ > 07EE76EC1BE96DB000F89133 /* MockRealtimeVideoSource.h in Headers */ = {isa = PBXBuildFile; fileRef = 07EE76EA1BE96DB000F89133 /* MockRealtimeVideoSource.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 07EE76EF1BEA619800F89133 /* MockRealtimeVideoSourceMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 07EE76ED1BEA619800F89133 /* MockRealtimeVideoSourceMac.h */; }; > 07F04A942006B1E300AE2A0A /* ApplicationStateChangeListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F04A92200684BC00AE2A0A /* ApplicationStateChangeListener.h */; settings = {ATTRIBUTES = (Private, ); }; }; >+ 07F4E93320B3587F002E3803 /* AVFoundationMIMETypeCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C8AD121D073D630087C5CE /* AVFoundationMIMETypeCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 07F876841AD580F900905849 /* MediaPlaybackTargetContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 07F944161864D046005D31CB /* PlatformMediaSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = CDAE8C081746B95700532D78 /* PlatformMediaSessionManager.h */; settings = {ATTRIBUTES = (Private, ); }; }; > 07FE99DD18807A7D00256648 /* MediaElementSession.h in Headers */ = {isa = PBXBuildFile; fileRef = 07FE99DB18807A7D00256648 /* MediaElementSession.h */; settings = {ATTRIBUTES = (Private, ); }; }; >@@ -26931,8 +26932,6 @@ > isa = PBXHeadersBuildPhase; > buildActionMask = 2147483647; > files = ( >- 29A812490FBB9CA900510293 /* WebAccessibilityObjectWrapperBase.h in Headers */, >- AA478A7F16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.h in Headers */, > 7CD0E2B81F80A4820016A4CE /* AbortController.h in Headers */, > 7CD0E2BF1F80A56E0016A4CE /* AbortSignal.h in Headers */, > 46B95195207D633400A7D2DD /* AbstractDOMWindow.h in Headers */, >@@ -27116,6 +27115,7 @@ > CDC675271EAEA9D400727C84 /* AVAudioSessionCaptureDevice.h in Headers */, > CDC675231EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.h in Headers */, > 070363E2181A1CDC00C074A5 /* AVCaptureDeviceManager.h in Headers */, >+ 07F4E93320B3587F002E3803 /* AVFoundationMIMETypeCache.h in Headers */, > 070363E4181A1CDC00C074A5 /* AVMediaCaptureSource.h in Headers */, > CD336F6217F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h in Headers */, > 070363E6181A1CDC00C074A5 /* AVVideoCaptureSource.h in Headers */, >@@ -30725,7 +30725,9 @@ > FD7F299213D4C0CB00AD9535 /* WaveShaperDSPKernel.h in Headers */, > FD7F299413D4C0CB00AD9535 /* WaveShaperNode.h in Headers */, > FD7F299713D4C0CB00AD9535 /* WaveShaperProcessor.h in Headers */, >+ 29A812490FBB9CA900510293 /* WebAccessibilityObjectWrapperBase.h in Headers */, > AAA728F716D1D8BC00D3BBC6 /* WebAccessibilityObjectWrapperIOS.h in Headers */, >+ AA478A7F16CD70C3007D1BB4 /* WebAccessibilityObjectWrapperMac.h in Headers */, > 2D3EF4481917915C00034184 /* WebActionDisablingCALayerDelegate.h in Headers */, > 71025ED31F99F0CE004A250C /* WebAnimation.h in Headers */, > 7132445120109DA500AE7FB2 /* WebAnimationUtilities.h in Headers */, >diff --git a/Source/WebCore/platform/graphics/ImageDecoder.cpp b/Source/WebCore/platform/graphics/ImageDecoder.cpp >index 2d9ce16da7008f7d0d0864d2ad1fcc1a146dfeb8..8eeba53c88bf7967614103ba4ae61906f197ee44 100644 >--- a/Source/WebCore/platform/graphics/ImageDecoder.cpp >+++ b/Source/WebCore/platform/graphics/ImageDecoder.cpp >@@ -42,13 +42,6 @@ namespace WebCore { > > RefPtr<ImageDecoder> ImageDecoder::create(SharedBuffer& data, const String& mimeType, AlphaOption alphaOption, GammaAndColorProfileOption gammaAndColorProfileOption) > { >-#if HAVE(AVASSETREADER) >- if (ImageDecoderAVFObjC::canDecodeType(mimeType)) >- return ImageDecoderAVFObjC::create(data, mimeType, alphaOption, gammaAndColorProfileOption); >-#else >- UNUSED_PARAM(mimeType); >-#endif >- > #if USE(CG) > return ImageDecoderCG::create(data, alphaOption, gammaAndColorProfileOption); > #elif USE(DIRECT2D) >@@ -56,6 +49,13 @@ RefPtr<ImageDecoder> ImageDecoder::create(SharedBuffer& data, const String& mime > #else > return ScalableImageDecoder::create(data, alphaOption, gammaAndColorProfileOption); > #endif >+ >+#if HAVE(AVASSETREADER) >+ if (ImageDecoderAVFObjC::canDecodeType(mimeType)) >+ return ImageDecoderAVFObjC::create(data, mimeType, alphaOption, gammaAndColorProfileOption); >+#else >+ UNUSED_PARAM(mimeType); >+#endif > } > > bool ImageDecoder::supportsMediaType(MediaType type) >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h b/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h >index 2888a29601fd16a12ff23af0009963acb77a105a..c54b49a1a334aae68a9c25418b66483a04dc7442 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -23,10 +23,9 @@ > * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. > */ > >-#ifndef AVFoundationMIMETypeCache_h >-#define AVFoundationMIMETypeCache_h >+#pragma once > >-#if ENABLE(VIDEO) && USE(AVFOUNDATION) >+#if PLATFORM(COCOA) > > #include <wtf/Forward.h> > #include <wtf/HashSet.h> >@@ -36,22 +35,20 @@ namespace WebCore { > > class AVFoundationMIMETypeCache { > public: >- static AVFoundationMIMETypeCache& singleton(); >+ WEBCORE_EXPORT static AVFoundationMIMETypeCache& singleton(); > >- AVFoundationMIMETypeCache(); >+ WEBCORE_EXPORT void setSupportedTypes(const Vector<String>&); > >- void loadTypes(); > const HashSet<String, ASCIICaseInsensitiveHash>& types(); >+ bool isEmpty() const; > > private: >- enum MIMETypeLoadStatus { NotLoaded, Loading, Loaded }; >+ friend NeverDestroyed<AVFoundationMIMETypeCache>; >+ AVFoundationMIMETypeCache() = default; > >- MIMETypeLoadStatus m_status { NotLoaded }; >- dispatch_queue_t m_loaderQueue; >- Lock m_lock; > HashSet<String, ASCIICaseInsensitiveHash> m_cache; > }; > > } >-#endif >+ > #endif >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm b/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm >index fce787144df5cf8265fcb2f1f121e30bdb25f288..928965a0a8465bbe0707aa200f861e186252b7df 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm >@@ -1,5 +1,5 @@ > /* >- * Copyright (C) 2016 Apple Inc. All rights reserved. >+ * Copyright (C) 2016-2018 Apple Inc. All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > * modification, are permitted provided that the following conditions >@@ -26,70 +26,37 @@ > #import "config.h" > #import "AVFoundationMIMETypeCache.h" > >-#if ENABLE(VIDEO) && USE(AVFOUNDATION) >+#if PLATFORM(COCOA) > > #import <AVFoundation/AVAsset.h> > #import <wtf/HashSet.h> >-#import <wtf/Locker.h> > #import <wtf/NeverDestroyed.h> > >-#import <pal/cf/CoreMediaSoftLink.h> >- >-SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation) >-SOFT_LINK_CLASS(AVFoundation, AVURLAsset) >- > namespace WebCore { > >-using namespace PAL; >- >-AVFoundationMIMETypeCache::AVFoundationMIMETypeCache() >+AVFoundationMIMETypeCache& AVFoundationMIMETypeCache::singleton() > { >- m_loaderQueue = dispatch_queue_create("WebCoreAudioVisualMIMETypes loader queue", DISPATCH_QUEUE_SERIAL); >+ static NeverDestroyed<AVFoundationMIMETypeCache> cache; >+ return cache.get(); > } > >-void AVFoundationMIMETypeCache::loadTypes() >+void AVFoundationMIMETypeCache::setSupportedTypes(const Vector<String>& types) > { >- { >- Locker<Lock> lock(m_lock); >- >- if (m_status != NotLoaded) >- return; >+ if (!m_cache.isEmpty()) >+ return; > >- if (!AVFoundationLibrary()) { >- m_status = Loaded; >- return; >- } >- >- m_status = Loading; >- } >- >- dispatch_async(m_loaderQueue, [this] { >- for (NSString *type in [getAVURLAssetClass() audiovisualMIMETypes]) >- m_cache.add(type); >- m_lock.lock(); >- m_status = Loaded; >- m_lock.unlock(); >- }); >+ for (auto& type : types) >+ m_cache.add(type); > } > > const HashSet<String, ASCIICaseInsensitiveHash>& AVFoundationMIMETypeCache::types() > { >- m_lock.lock(); >- MIMETypeLoadStatus status = m_status; >- m_lock.unlock(); >- >- if (status != Loaded) { >- loadTypes(); >- dispatch_sync(m_loaderQueue, ^{ }); >- } >- > return m_cache; > } > >-AVFoundationMIMETypeCache& AVFoundationMIMETypeCache::singleton() >+bool AVFoundationMIMETypeCache::isEmpty() const > { >- static NeverDestroyed<AVFoundationMIMETypeCache> cache; >- return cache.get(); >+ return m_cache.isEmpty(); > } > > } >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm >index 6368cb46b2fa6bd8144821a60573f63c94ce0e3c..7223a2af082e27c20d621dee0b07f52eb94f6fdb 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm >@@ -319,10 +319,7 @@ ImageDecoderAVFObjCSample* toSample(Iterator iter) > RefPtr<ImageDecoderAVFObjC> ImageDecoderAVFObjC::create(SharedBuffer& data, const String& mimeType, AlphaOption alphaOption, GammaAndColorProfileOption gammaAndColorProfileOption) > { > // AVFoundation may not be available at runtime. >- if (!getAVURLAssetClass()) >- return nullptr; >- >- if (!canLoad_VideoToolbox_VTCreateCGImageFromCVPixelBuffer()) >+ if (AVFoundationMIMETypeCache::singleton().isEmpty()) > return nullptr; > > return adoptRef(*new ImageDecoderAVFObjC(data, mimeType, alphaOption, gammaAndColorProfileOption)); >@@ -350,22 +347,18 @@ ImageDecoderAVFObjC::~ImageDecoderAVFObjC() = default; > > bool ImageDecoderAVFObjC::supportsMediaType(MediaType type) > { >- if (type == MediaType::Video) >- return getAVURLAssetClass() && canLoad_VideoToolbox_VTCreateCGImageFromCVPixelBuffer(); >- return false; >+ return !AVFoundationMIMETypeCache::singleton().isEmpty() && type == MediaType::Video; > } > > bool ImageDecoderAVFObjC::supportsContentType(const ContentType& type) > { >- if (getAVURLAssetClass() && canLoad_VideoToolbox_VTCreateCGImageFromCVPixelBuffer()) >- return AVFoundationMIMETypeCache::singleton().types().contains(type.containerType()); >- return false; >+ return AVFoundationMIMETypeCache::singleton().types().contains(type.containerType()); > } > > bool ImageDecoderAVFObjC::canDecodeType(const String& mimeType) > { >- if (!supportsMediaType(MediaType::Video)) >- return nullptr; >+ if (AVFoundationMIMETypeCache::singleton().types().contains(mimeType)) >+ return true; > > return [getAVURLAssetClass() isPlayableExtendedMIMEType:mimeType]; > } >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >index 57fd3cfaf26d0647049c0624c6404378ebfa960c..303caeffef5076a98ae1c38ac245f6241692562c 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm >@@ -397,7 +397,7 @@ void MediaPlayerPrivateAVFoundationObjC::registerMediaEngine(MediaEngineRegistra > > registrar([](MediaPlayer* player) { return std::make_unique<MediaPlayerPrivateAVFoundationObjC>(player); }, > getSupportedTypes, supportsType, originsInMediaCache, clearMediaCache, clearMediaCacheForOrigins, supportsKeySystem); >- AVFoundationMIMETypeCache::singleton().loadTypes(); >+ ASSERT(!AVFoundationMIMETypeCache::singleton().isEmpty()); > } > > static AVAssetCacheType *assetCacheForPath(const String& path) >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >index 5979722ac5bffe386f5480aafa1a66d0c2c442bc..cc81ec6f9b0721d7b50d3e9e413ee0067931fcb8 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm >@@ -191,7 +191,7 @@ void MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine(MediaEngineRegist > > registrar([](MediaPlayer* player) { return std::make_unique<MediaPlayerPrivateMediaSourceAVFObjC>(player); }, > getSupportedTypes, supportsType, 0, 0, 0, 0); >- AVFoundationMIMETypeCache::singleton().loadTypes(); >+ ASSERT(!AVFoundationMIMETypeCache::singleton().isEmpty()); > } > > bool MediaPlayerPrivateMediaSourceAVFObjC::isAvailable() >diff --git a/Source/WebKit/Shared/WebPageCreationParameters.cpp b/Source/WebKit/Shared/WebPageCreationParameters.cpp >index 3b0b8aa50fada9567d7ace9a2a573a01a325bdc7..379f8650e47f2826eea0d52132418370f47c4a13 100644 >--- a/Source/WebKit/Shared/WebPageCreationParameters.cpp >+++ b/Source/WebKit/Shared/WebPageCreationParameters.cpp >@@ -119,6 +119,9 @@ void WebPageCreationParameters::encode(IPC::Encoder& encoder) const > #if ENABLE(CONTENT_EXTENSIONS) > encoder << contentRuleLists; > #endif >+#if PLATFORM(COCOA) >+ encoder << mediaMIMETypes; >+#endif > } > > std::optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC::Decoder& decoder) >@@ -343,6 +346,14 @@ std::optional<WebPageCreationParameters> WebPageCreationParameters::decode(IPC:: > parameters.contentRuleLists = WTFMove(*contentRuleLists); > #endif > >+#if PLATFORM(COCOA) >+ std::optional<Vector<String>> mediaMIMETypes; >+ decoder >> mediaMIMETypes; >+ if (!mediaMIMETypes) >+ return std::nullopt; >+ parameters.mediaMIMETypes = WTFMove(*mediaMIMETypes); >+#endif >+ > return WTFMove(parameters); > } > >diff --git a/Source/WebKit/Shared/WebPageCreationParameters.h b/Source/WebKit/Shared/WebPageCreationParameters.h >index 06f7ab62088b7b38e85419ec752b76e6a65addab..fed4c53e4195ac8929a5e3e73f21e597a0d10558 100644 >--- a/Source/WebKit/Shared/WebPageCreationParameters.h >+++ b/Source/WebKit/Shared/WebPageCreationParameters.h >@@ -185,6 +185,10 @@ struct WebPageCreationParameters { > #if ENABLE(CONTENT_EXTENSIONS) > Vector<std::pair<String, WebCompiledContentRuleListData>> contentRuleLists; > #endif >+ >+#if PLATFORM(COCOA) >+ Vector<String> mediaMIMETypes; >+#endif > }; > > } // namespace WebKit >diff --git a/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm >index 0d6fc1c92b4a7db4e02f3b4390a13110c7d03fab..e7da813706222c360edeaa69ffbc3d7cb775f837 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm >@@ -35,8 +35,18 @@ > #import <WebCore/NotImplemented.h> > #import <WebCore/SearchPopupMenuCocoa.h> > #import <WebCore/ValidationBubble.h> >+#import <wtf/NeverDestroyed.h> > #import <wtf/cf/TypeCastsCF.h> > >+#if ENABLE(VIDEO) && USE(AVFOUNDATION) >+#import <AVFoundation/AVAsset.h> >+ >+#import <pal/cf/CoreMediaSoftLink.h> >+ >+SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation) >+SOFT_LINK_CLASS(AVFoundation, AVURLAsset) >+#endif // ENABLE(VIDEO) && USE(AVFOUNDATION) >+ > using namespace WebCore; > > namespace WebKit { >@@ -131,4 +141,24 @@ void WebPageProxy::setDragCaretRect(const IntRect& dragCaretRect) > > #endif // ENABLE(DRAG_SUPPORT) > >+Vector<String> WebPageProxy::mediaMIMETypes() >+{ >+ static NeverDestroyed<Vector<String>> mediaTypes; >+ >+#if ENABLE(VIDEO) && USE(AVFOUNDATION) >+ static std::once_flag onceFlag; >+ std::call_once(onceFlag, [] { >+ if (AVFoundationLibrary()) { >+ auto& typeList = mediaTypes.get(); >+ auto* nsTypes = [getAVURLAssetClass() audiovisualMIMETypes]; >+ typeList.reserveCapacity(nsTypes.count); >+ for (NSString* type in nsTypes) >+ typeList.append(type); >+ } >+ }); >+#endif >+ >+ return mediaTypes.get(); >+} >+ > } >diff --git a/Source/WebKit/UIProcess/WebPageProxy.cpp b/Source/WebKit/UIProcess/WebPageProxy.cpp >index 1da04d35086bb3a448eea1bdf822cc491146a6d7..b12c7b9da26c182454c43b547af68b1770732cf0 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.cpp >+++ b/Source/WebKit/UIProcess/WebPageProxy.cpp >@@ -6131,6 +6131,10 @@ WebPageCreationParameters WebPageProxy::creationParameters() > parameters.applicationManifest = m_configuration->applicationManifest() ? std::optional<WebCore::ApplicationManifest>(m_configuration->applicationManifest()->applicationManifest()) : std::nullopt; > #endif > >+#if PLATFORM(COCOA) >+ parameters.mediaMIMETypes = mediaMIMETypes(); >+#endif >+ > m_process->addWebUserContentControllerProxy(m_userContentController, parameters); > > return parameters; >diff --git a/Source/WebKit/UIProcess/WebPageProxy.h b/Source/WebKit/UIProcess/WebPageProxy.h >index 9c24a3f4f73c851481ac0ec9189b1a75e1e3ba48..096a5d14793626d012a10146d78c80546334a4ee 100644 >--- a/Source/WebKit/UIProcess/WebPageProxy.h >+++ b/Source/WebKit/UIProcess/WebPageProxy.h >@@ -1311,6 +1311,10 @@ public: > > void setDefersLoadingForTesting(bool); > >+#if PLATFORM(COCOA) >+ Vector<String> mediaMIMETypes(); >+#endif >+ > private: > WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&); > void platformInitialize(); >diff --git a/Source/WebKit/WebProcess/WebPage/WebPage.cpp b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >index 84a43c919f74440b63724134e459c417e5bf98cb..e962fab2450ce82ce7dfb7e67411c82d2f0bf4ec 100644 >--- a/Source/WebKit/WebProcess/WebPage/WebPage.cpp >+++ b/Source/WebKit/WebProcess/WebPage/WebPage.cpp >@@ -239,6 +239,7 @@ > #include "TouchBarMenuItemData.h" > #include "VideoFullscreenManager.h" > #include "WKStringCF.h" >+#include <WebCore/AVFoundationMIMETypeCache.h> > #include <WebCore/LegacyWebArchive.h> > #include <wtf/MachSendRight.h> > #endif >@@ -617,6 +618,10 @@ WebPage::WebPage(uint64_t pageID, WebPageCreationParameters&& parameters) > setViewportConfigurationViewLayoutSize(parameters.viewportConfigurationViewLayoutSize); > setMaximumUnobscuredSize(parameters.maximumUnobscuredSize); > #endif >+ >+#if PLATFORM(COCOA) >+ AVFoundationMIMETypeCache::singleton().setSupportedTypes(parameters.mediaMIMETypes); >+#endif > } > > #if ENABLE(WEB_RTC)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185839
:
340895
|
340907
|
340908
|
340915
|
340919
|
341124
|
341126
|
341132
|
341133
|
341138
|
341139
|
341142
|
341152