Changeset 232136 in webkit
- Timestamp:
- May 23, 2018 5:00:54 PM (6 years ago)
- Location:
- trunk/Source
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r232132 r232136 1 2018-05-23 Eric Carlson <eric.carlson@apple.com> 2 3 Avoid loading AVFoundation to check supported MIME types if possible 4 https://bugs.webkit.org/show_bug.cgi?id=185839 5 <rdar://problem/40182010> 6 7 Reviewed by Jer Noble. 8 9 * wtf/cocoa/SoftLinking.h: Add SOFT_LINK_FRAMEWORK_OPTIONAL_PREFLIGHT. 10 1 11 2018-05-23 Filip Pizlo <fpizlo@apple.com> 2 12 -
trunk/Source/WTF/wtf/cocoa/SoftLinking.h
r230974 r232136 64 64 } 65 65 66 #define SOFT_LINK_FRAMEWORK_OPTIONAL_PREFLIGHT(framework) \ 67 static bool framework##LibraryIsAvailable() \ 68 { \ 69 static bool frameworkLibraryIsAvailable = dlopen_preflight("/System/Library/Frameworks/" #framework ".framework/" #framework); \ 70 return frameworkLibraryIsAvailable; \ 71 } 72 66 73 #define SOFT_LINK_FRAMEWORK_OPTIONAL(framework) \ 67 74 static void* framework##Library() \ -
trunk/Source/WebCore/ChangeLog
r232123 r232136 1 2018-05-23 Eric Carlson <eric.carlson@apple.com> 2 3 Avoid loading AVFoundation to check supported MIME types if possible 4 https://bugs.webkit.org/show_bug.cgi?id=185839 5 <rdar://problem/40182010> 6 7 Reviewed by Jer Noble. 8 9 Avoid loading AVFoundation to call +[AVURLAssetClass audiovisualMIMETypes] as long as possible, 10 and when they are loaded send the list to the UI process so it can pass it to all extant 11 and all new web processes so they can won't have call it at all. 12 13 * WebCore.xcodeproj/project.pbxproj: 14 * platform/graphics/ImageDecoder.cpp: 15 (WebCore::ImageDecoder::create): Don't call ImageDecoderAVFObjC::canDecodeType if 16 ImageDecoderCG can decode the type so we don't have to load AVFoundation. 17 (WebCore::ImageDecoder::supportsMediaType): Return as soon as a decoder class says 18 it supports a media type to avoid calling more than one. Call ImageDecoderAVFObjC last. 19 20 * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h: 21 (WebCore::AVFoundationMIMETypeCache::setCacheMIMETypesCallback): 22 * platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm: 23 (WebCore::AVFoundationMIMETypeCache::singleton): Simplify. 24 (WebCore::AVFoundationMIMETypeCache::setSupportedTypes): Cache the supplied list of types 25 so we won't have to load AVFoundation when asked for types later. 26 (WebCore::AVFoundationMIMETypeCache::types): 27 (WebCore::AVFoundationMIMETypeCache::supportsContentType): New convenience routine. 28 (WebCore::AVFoundationMIMETypeCache::canDecodeType): Ditto. 29 (WebCore::AVFoundationMIMETypeCache::isAvailable const): New, check to see if AVFoundation.framework 30 is available without actually loading it. 31 (WebCore::AVFoundationMIMETypeCache::loadMIMETypes): Load types if possible. 32 (WebCore::AVFoundationMIMETypeCache::AVFoundationMIMETypeCache): Deleted. 33 (WebCore::AVFoundationMIMETypeCache::loadTypes): Deleted. 34 35 * platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm: 36 (WebCore::ImageDecoderAVFObjC::create): Use AVFoundationMIMETypeCache::isAvailable instead 37 of loading the frameworks. 38 (WebCore::ImageDecoderAVFObjC::supportsMediaType): Ditto. 39 (WebCore::ImageDecoderAVFObjC::supportsContentType): Use AVFoundationMIMETypeCache::supportsContentType. 40 (WebCore::ImageDecoderAVFObjC::canDecodeType): Use AVFoundationMIMETypeCache::canDecodeType. 41 42 * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm: 43 (WebCore::MediaPlayerPrivateAVFoundationObjC::registerMediaEngine): ASSERT if the 44 AVFoundationMIMETypeCache is empty, it shouldn't be possible to get here in that state. 45 (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsType): Use AVFoundationMIMETypeCache::supportsContentType. 46 (WebCore::MediaPlayerPrivateAVFoundationObjC::supportsKeySystem): Use AVFoundationMIMETypeCache::canDecodeType. 47 48 * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm: 49 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::registerMediaEngine): ASSERT if the 50 AVFoundationMIMETypeCache is empty, it shouldn't be possible to get here in that state. 51 (WebCore::MediaPlayerPrivateMediaSourceAVFObjC::supportsType): Use AVFoundationMIMETypeCache::canDecodeType. 52 53 * platform/graphics/cg/ImageDecoderCG.cpp: 54 (WebCore::ImageDecoderCG::canDecodeType): New. 55 * platform/graphics/cg/ImageDecoderCG.h: 56 1 57 2018-05-23 Chris Dumez <cdumez@apple.com> 2 58 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r232114 r232136 220 220 07EE76EF1BEA619800F89133 /* MockRealtimeVideoSourceMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 07EE76ED1BEA619800F89133 /* MockRealtimeVideoSourceMac.h */; }; 221 221 07F04A942006B1E300AE2A0A /* ApplicationStateChangeListener.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F04A92200684BC00AE2A0A /* ApplicationStateChangeListener.h */; settings = {ATTRIBUTES = (Private, ); }; }; 222 07F4E93320B3587F002E3803 /* AVFoundationMIMETypeCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 07C8AD121D073D630087C5CE /* AVFoundationMIMETypeCache.h */; settings = {ATTRIBUTES = (Private, ); }; }; 222 223 07F876841AD580F900905849 /* MediaPlaybackTargetContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 07F876831AD4A94500905849 /* MediaPlaybackTargetContext.h */; settings = {ATTRIBUTES = (Private, ); }; }; 223 224 07F944161864D046005D31CB /* PlatformMediaSessionManager.h in Headers */ = {isa = PBXBuildFile; fileRef = CDAE8C081746B95700532D78 /* PlatformMediaSessionManager.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 27121 27122 CDC675231EAEA9B700727C84 /* AVAudioSessionCaptureDeviceManager.h in Headers */, 27122 27123 070363E2181A1CDC00C074A5 /* AVCaptureDeviceManager.h in Headers */, 27124 07F4E93320B3587F002E3803 /* AVFoundationMIMETypeCache.h in Headers */, 27123 27125 070363E4181A1CDC00C074A5 /* AVMediaCaptureSource.h in Headers */, 27124 27126 CD336F6217F9F64700DDDCD0 /* AVTrackPrivateAVFObjCImpl.h in Headers */, -
trunk/Source/WebCore/platform/graphics/ImageDecoder.cpp
r227631 r232136 43 43 RefPtr<ImageDecoder> ImageDecoder::create(SharedBuffer& data, const String& mimeType, AlphaOption alphaOption, GammaAndColorProfileOption gammaAndColorProfileOption) 44 44 { 45 UNUSED_PARAM(mimeType); 46 45 47 #if HAVE(AVASSETREADER) 46 if ( ImageDecoderAVFObjC::canDecodeType(mimeType))48 if (!ImageDecoderCG::canDecodeType(mimeType) && ImageDecoderAVFObjC::canDecodeType(mimeType)) 47 49 return ImageDecoderAVFObjC::create(data, mimeType, alphaOption, gammaAndColorProfileOption); 48 #else49 UNUSED_PARAM(mimeType);50 50 #endif 51 51 … … 61 61 bool ImageDecoder::supportsMediaType(MediaType type) 62 62 { 63 bool supports = false; 63 #if USE(CG) 64 if (ImageDecoderCG::supportsMediaType(type)) 65 return true; 66 #elif USE(DIRECT2D) 67 if (ImageDecoderDirect2D::supportsMediaType(type)) 68 return true; 69 #else 70 if (ScalableImageDecoder::supportsMediaType(type)) 71 return true; 72 #endif 73 64 74 #if HAVE(AVASSETREADER) 65 75 if (ImageDecoderAVFObjC::supportsMediaType(type)) 66 supports =true;76 return true; 67 77 #endif 68 78 69 #if USE(CG) 70 if (ImageDecoderCG::supportsMediaType(type)) 71 supports = true; 72 #elif USE(DIRECT2D) 73 if (ImageDecoderDirect2D::supportsMediaType(type)) 74 supports = true; 75 #else 76 if (ScalableImageDecoder::supportsMediaType(type)) 77 supports = true; 78 #endif 79 80 return supports; 79 return false; 81 80 } 82 81 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.h
r201831 r232136 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #ifndef AVFoundationMIMETypeCache_h 27 #define AVFoundationMIMETypeCache_h 26 #pragma once 28 27 29 #if ENABLE(VIDEO) && USE(AVFOUNDATION)28 #if PLATFORM(COCOA) 30 29 31 30 #include <wtf/Forward.h> … … 35 34 namespace WebCore { 36 35 36 class ContentType; 37 37 38 class AVFoundationMIMETypeCache { 38 39 public: 39 static AVFoundationMIMETypeCache& singleton();40 WEBCORE_EXPORT static AVFoundationMIMETypeCache& singleton(); 40 41 41 AVFoundationMIMETypeCache(); 42 bool supportsContentType(const ContentType&); 43 bool canDecodeType(const String&); 42 44 43 void loadTypes();44 45 const HashSet<String, ASCIICaseInsensitiveHash>& types(); 46 bool isEmpty(); 47 bool isAvailable() const; 48 49 using CacheMIMETypesCallback = std::function<void(const Vector<String>&)>; 50 void setCacheMIMETypesCallback(CacheMIMETypesCallback&& callback) { m_cacheTypeCallback = WTFMove(callback); } 51 52 WEBCORE_EXPORT void setSupportedTypes(const Vector<String>&); 45 53 46 54 private: 47 enum MIMETypeLoadStatus { NotLoaded, Loading, Loaded }; 55 friend NeverDestroyed<AVFoundationMIMETypeCache>; 56 AVFoundationMIMETypeCache() = default; 48 57 49 MIMETypeLoadStatus m_status { NotLoaded };50 dispatch_queue_t m_loaderQueue; 51 Lock m_lock;52 HashSet<String, ASCIICaseInsensitiveHash> m_cache;58 void loadMIMETypes(); 59 60 std::optional<HashSet<String, ASCIICaseInsensitiveHash>> m_cache; 61 CacheMIMETypesCallback m_cacheTypeCallback; 53 62 }; 54 63 55 64 } 65 56 66 #endif 57 #endif -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/AVFoundationMIMETypeCache.mm
r223476 r232136 1 1 /* 2 * Copyright (C) 2016 Apple Inc. All rights reserved.2 * Copyright (C) 2016-2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 27 27 #import "AVFoundationMIMETypeCache.h" 28 28 29 #if ENABLE(VIDEO) && USE(AVFOUNDATION)29 #if PLATFORM(COCOA) 30 30 31 #import "ContentType.h" 31 32 #import <AVFoundation/AVAsset.h> 32 33 #import <wtf/HashSet.h> 33 #import <wtf/Locker.h>34 #import <wtf/NeverDestroyed.h>35 34 36 35 #import <pal/cf/CoreMediaSoftLink.h> 37 36 37 #if ENABLE(VIDEO) && USE(AVFOUNDATION) 38 SOFT_LINK_FRAMEWORK_OPTIONAL_PREFLIGHT(AVFoundation) 38 39 SOFT_LINK_FRAMEWORK_OPTIONAL(AVFoundation) 39 40 SOFT_LINK_CLASS(AVFoundation, AVURLAsset) 41 #endif 40 42 41 43 namespace WebCore { 42 43 using namespace PAL;44 45 AVFoundationMIMETypeCache::AVFoundationMIMETypeCache()46 {47 m_loaderQueue = dispatch_queue_create("WebCoreAudioVisualMIMETypes loader queue", DISPATCH_QUEUE_SERIAL);48 }49 50 void AVFoundationMIMETypeCache::loadTypes()51 {52 {53 Locker<Lock> lock(m_lock);54 55 if (m_status != NotLoaded)56 return;57 58 if (!AVFoundationLibrary()) {59 m_status = Loaded;60 return;61 }62 63 m_status = Loading;64 }65 66 dispatch_async(m_loaderQueue, [this] {67 for (NSString *type in [getAVURLAssetClass() audiovisualMIMETypes])68 m_cache.add(type);69 m_lock.lock();70 m_status = Loaded;71 m_lock.unlock();72 });73 }74 75 const HashSet<String, ASCIICaseInsensitiveHash>& AVFoundationMIMETypeCache::types()76 {77 m_lock.lock();78 MIMETypeLoadStatus status = m_status;79 m_lock.unlock();80 81 if (status != Loaded) {82 loadTypes();83 dispatch_sync(m_loaderQueue, ^{ });84 }85 86 return m_cache;87 }88 44 89 45 AVFoundationMIMETypeCache& AVFoundationMIMETypeCache::singleton() … … 93 49 } 94 50 51 void AVFoundationMIMETypeCache::setSupportedTypes(const Vector<String>& types) 52 { 53 if (m_cache) 54 return; 55 56 m_cache = HashSet<String, ASCIICaseInsensitiveHash>(); 57 for (auto& type : types) 58 m_cache->add(type); 59 } 60 61 const HashSet<String, ASCIICaseInsensitiveHash>& AVFoundationMIMETypeCache::types() 62 { 63 if (!m_cache) 64 loadMIMETypes(); 65 66 return *m_cache; 67 } 68 69 bool AVFoundationMIMETypeCache::supportsContentType(const ContentType& contentType) 70 { 71 if (contentType.isEmpty()) 72 return false; 73 74 return types().contains(contentType.containerType()); 75 } 76 77 bool AVFoundationMIMETypeCache::canDecodeType(const String& mimeType) 78 { 79 if (mimeType.isEmpty()) 80 return false; 81 82 if (!isAvailable() || !types().contains(ContentType { mimeType }.containerType())) 83 return false; 84 85 #if ENABLE(VIDEO) && USE(AVFOUNDATION) 86 return [getAVURLAssetClass() isPlayableExtendedMIMEType:mimeType]; 87 #endif 88 89 return false; 90 } 91 92 bool AVFoundationMIMETypeCache::isAvailable() const 93 { 94 #if ENABLE(VIDEO) && USE(AVFOUNDATION) 95 return AVFoundationLibraryIsAvailable(); 96 #else 97 return false; 98 #endif 99 } 100 101 void AVFoundationMIMETypeCache::loadMIMETypes() 102 { 103 m_cache = HashSet<String, ASCIICaseInsensitiveHash>(); 104 105 #if ENABLE(VIDEO) && USE(AVFOUNDATION) 106 static std::once_flag onceFlag; 107 std::call_once(onceFlag, [this] { 108 if (!AVFoundationLibrary()) 109 return; 110 111 for (NSString* type in [getAVURLAssetClass() audiovisualMIMETypes]) 112 m_cache->add(type); 113 114 if (m_cacheTypeCallback) 115 m_cacheTypeCallback(copyToVector(*m_cache)); 116 }); 117 #endif 118 } 119 95 120 } 96 121 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/ImageDecoderAVFObjC.mm
r231920 r232136 320 320 { 321 321 // AVFoundation may not be available at runtime. 322 if (! getAVURLAssetClass())322 if (!AVFoundationMIMETypeCache::singleton().isAvailable()) 323 323 return nullptr; 324 324 … … 351 351 bool ImageDecoderAVFObjC::supportsMediaType(MediaType type) 352 352 { 353 if (type == MediaType::Video) 354 return getAVURLAssetClass() && canLoad_VideoToolbox_VTCreateCGImageFromCVPixelBuffer(); 355 return false; 353 return type == MediaType::Video && AVFoundationMIMETypeCache::singleton().isAvailable(); 356 354 } 357 355 358 356 bool ImageDecoderAVFObjC::supportsContentType(const ContentType& type) 359 357 { 360 if (getAVURLAssetClass() && canLoad_VideoToolbox_VTCreateCGImageFromCVPixelBuffer()) 361 return AVFoundationMIMETypeCache::singleton().types().contains(type.containerType()); 362 return false; 358 return AVFoundationMIMETypeCache::singleton().supportsContentType(type); 363 359 } 364 360 365 361 bool ImageDecoderAVFObjC::canDecodeType(const String& mimeType) 366 362 { 367 if (!supportsMediaType(MediaType::Video)) 368 return nullptr; 369 370 return [getAVURLAssetClass() isPlayableExtendedMIMEType:mimeType]; 363 return AVFoundationMIMETypeCache::singleton().canDecodeType(mimeType); 371 364 } 372 365 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm
r231578 r232136 398 398 registrar([](MediaPlayer* player) { return std::make_unique<MediaPlayerPrivateAVFoundationObjC>(player); }, 399 399 getSupportedTypes, supportsType, originsInMediaCache, clearMediaCache, clearMediaCacheForOrigins, supportsKeySystem); 400 A VFoundationMIMETypeCache::singleton().loadTypes();400 ASSERT(AVFoundationMIMETypeCache::singleton().isAvailable()); 401 401 } 402 402 … … 1682 1682 return MediaPlayer::IsNotSupported; 1683 1683 1684 if (!staticMIMETypeList().contains(containerType) && !AVFoundationMIMETypeCache::singleton(). types().contains(containerType))1684 if (!staticMIMETypeList().contains(containerType) && !AVFoundationMIMETypeCache::singleton().canDecodeType(containerType)) 1685 1685 return MediaPlayer::IsNotSupported; 1686 1686 … … 1711 1711 return false; 1712 1712 1713 if (!mimeType.isEmpty() && !staticMIMETypeList().contains(mimeType) && !AVFoundationMIMETypeCache::singleton(). types().contains(mimeType))1713 if (!mimeType.isEmpty() && !staticMIMETypeList().contains(mimeType) && !AVFoundationMIMETypeCache::singleton().canDecodeType(mimeType)) 1714 1714 return false; 1715 1715 -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
r230194 r232136 192 192 registrar([](MediaPlayer* player) { return std::make_unique<MediaPlayerPrivateMediaSourceAVFObjC>(player); }, 193 193 getSupportedTypes, supportsType, 0, 0, 0, 0); 194 A VFoundationMIMETypeCache::singleton().loadTypes();194 ASSERT(AVFoundationMIMETypeCache::singleton().isAvailable()); 195 195 } 196 196 … … 220 220 #endif 221 221 222 if (parameters.type.isEmpty() || !AVFoundationMIMETypeCache::singleton(). types().contains(parameters.type.containerType()))222 if (parameters.type.isEmpty() || !AVFoundationMIMETypeCache::singleton().canDecodeType(parameters.type.containerType())) 223 223 return MediaPlayer::IsNotSupported; 224 224 -
trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.cpp
r230712 r232136 34 34 #include "IntSize.h" 35 35 #include "Logging.h" 36 #include "MIMETypeRegistry.h" 36 37 #include "SharedBuffer.h" 37 38 #include "UTIRegistry.h" … … 481 482 } 482 483 484 bool ImageDecoderCG::canDecodeType(const String& mimeType) 485 { 486 return MIMETypeRegistry::isSupportedImageMIMEType(mimeType); 487 } 488 483 489 } 484 490 -
trunk/Source/WebCore/platform/graphics/cg/ImageDecoderCG.h
r225616 r232136 41 41 42 42 static bool supportsMediaType(MediaType type) { return type == MediaType::Image; } 43 43 static bool canDecodeType(const String&); 44 44 45 size_t bytesDecodedToDetermineProperties() const final; 45 46 -
trunk/Source/WebKit/ChangeLog
r232133 r232136 1 2018-05-23 Eric Carlson <eric.carlson@apple.com> 2 3 Avoid loading AVFoundation to check supported MIME types if possible 4 https://bugs.webkit.org/show_bug.cgi?id=185839 5 <rdar://problem/40182010> 6 7 Reviewed by Jer Noble. 8 9 * Shared/WebProcessCreationParameters.cpp: 10 (WebKit::WebProcessCreationParameters::encode const): Encode mediaMIMETypes. 11 (WebKit::WebProcessCreationParameters::decode): Decode mediaMIMETypes. 12 * Shared/WebProcessCreationParameters.h: 13 14 * UIProcess/Cocoa/WebProcessProxyCocoa.mm: 15 (WebKit::mediaTypeCache): Static Vector of media MIME types. 16 (WebKit::WebProcessProxy::cacheMediaMIMETypes): Cache the type list and pass it to every other 17 process proxy. 18 (WebKit::WebProcessProxy::cacheMediaMIMETypesInternal): Cache the type list and pass it to the 19 web process. 20 (WebKit::WebProcessProxy::mediaMIMETypes): Return the cached type list. 21 22 * UIProcess/WebProcessPool.cpp: 23 (WebKit::WebProcessPool::initializeNewWebProcess): Set parameters.mediaMIMETypes. 24 25 * UIProcess/WebProcessProxy.h: 26 * UIProcess/WebProcessProxy.messages.in: Add CacheMediaMIMETypes. 27 28 * WebProcess/WebProcess.h: 29 * WebProcess/WebProcess.messages.in: Add SetMediaMIMETypes. 30 31 * WebProcess/cocoa/WebProcessCocoa.mm: 32 (WebKit::WebProcess::platformInitializeWebProcess): Cache the MIME types if the list isn't 33 empty, else register with AVFoundationMIMETypeCache to be notified when it loads types. 34 AVFoundationMIMETypeCache to 35 (WebKit::WebProcess::platformTerminate): Unregister with AVFoundationMIMETypeCache. 36 (WebKit::WebProcess::setMediaMIMETypes): Pass list of types to AVFoundationMIMETypeCache. 37 1 38 2018-05-23 Brian Burg <bburg@apple.com> 2 39 -
trunk/Source/WebKit/Shared/WebProcessCreationParameters.cpp
r232083 r232136 155 155 encoder << shouldLogUserInteraction; 156 156 #endif 157 158 #if PLATFORM(COCOA) 159 encoder << mediaMIMETypes; 160 #endif 157 161 } 158 162 … … 402 406 #endif 403 407 408 #if PLATFORM(COCOA) 409 if (!decoder.decode(parameters.mediaMIMETypes)) 410 return false; 411 #endif 412 404 413 return true; 405 414 } -
trunk/Source/WebKit/Shared/WebProcessCreationParameters.h
r232083 r232136 186 186 #endif 187 187 188 #if PLATFORM(COCOA) 189 Vector<String> mediaMIMETypes; 190 #endif 191 188 192 #if HAVE(CFNETWORK_STORAGE_PARTITIONING) && !RELEASE_LOG_DISABLED 189 193 bool shouldLogUserInteraction { false }; -
trunk/Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm
r215132 r232136 32 32 #import "WKBrowsingContextHandleInternal.h" 33 33 #import "WKTypeRefWrapper.h" 34 #import "WebProcessMessages.h" 35 #import "WebProcessPool.h" 34 36 #import <sys/sysctl.h> 35 37 #import <wtf/NeverDestroyed.h> … … 138 140 } 139 141 142 static Vector<String>& mediaTypeCache() 143 { 144 ASSERT(RunLoop::isMain()); 145 static NeverDestroyed<Vector<String>> typeCache; 146 return typeCache; 140 147 } 148 149 void WebProcessProxy::cacheMediaMIMETypes(const Vector<String>& types) 150 { 151 if (!mediaTypeCache().isEmpty()) 152 return; 153 154 mediaTypeCache() = types; 155 for (auto& process : processPool().processes()) { 156 if (process != this) 157 cacheMediaMIMETypesInternal(types); 158 } 159 } 160 161 void WebProcessProxy::cacheMediaMIMETypesInternal(const Vector<String>& types) 162 { 163 if (!mediaTypeCache().isEmpty()) 164 return; 165 166 mediaTypeCache() = types; 167 send(Messages::WebProcess::SetMediaMIMETypes(types), 0); 168 } 169 170 Vector<String> WebProcessProxy::mediaMIMETypes() 171 { 172 return mediaTypeCache(); 173 } 174 175 } -
trunk/Source/WebKit/UIProcess/WebPageProxy.h
r232090 r232136 1314 1314 WebCore::IntRect syncRootViewToScreen(const WebCore::IntRect& viewRect); 1315 1315 1316 #if PLATFORM(COCOA) 1317 Vector<String> mediaMIMETypes(); 1318 #endif 1319 1316 1320 private: 1317 1321 WebPageProxy(PageClient&, WebProcessProxy&, uint64_t pageID, Ref<API::PageConfiguration>&&); -
trunk/Source/WebKit/UIProcess/WebProcessPool.cpp
r232133 r232136 940 940 parameters.presentingApplicationPID = m_configuration->presentingApplicationPID(); 941 941 942 #if PLATFORM(COCOA) 943 parameters.mediaMIMETypes = process.mediaMIMETypes(); 944 #endif 945 942 946 // Add any platform specific parameters 943 947 platformInitializeWebProcess(parameters); -
trunk/Source/WebKit/UIProcess/WebProcessProxy.h
r231931 r232136 222 222 void setIsInPrewarmedPool(bool isInPrewarmedPool) { m_isInPrewarmedPool = isInPrewarmedPool; } 223 223 224 #if PLATFORM(COCOA) 225 Vector<String> mediaMIMETypes(); 226 void cacheMediaMIMETypes(const Vector<String>&); 227 #endif 228 224 229 protected: 225 230 static uint64_t generatePageID(); … … 233 238 // ProcessLauncher::Client 234 239 void didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier) override; 240 241 #if PLATFORM(COCOA) 242 void cacheMediaMIMETypesInternal(const Vector<String>&); 243 #endif 235 244 236 245 private: -
trunk/Source/WebKit/UIProcess/WebProcessProxy.messages.in
r230812 r232136 67 67 DidDeliverMessagePortMessages(uint64_t messageBatchIdentifier) 68 68 DidCheckProcessLocalPortForActivity(uint64_t callbackIdentifier, bool isLocallyReachable) 69 70 #if PLATFORM(COCOA) 71 CacheMediaMIMETypes(Vector<String> types) 72 #endif 69 73 } -
trunk/Source/WebKit/WebProcess/WebProcess.h
r231348 r232136 241 241 #endif 242 242 243 #if PLATFORM(COCOA) 244 void setMediaMIMETypes(const Vector<String>); 245 #endif 246 243 247 private: 244 248 WebProcess(); -
trunk/Source/WebKit/WebProcess/WebProcess.messages.in
r231771 r232136 136 136 #endif 137 137 #endif 138 139 #if PLATFORM(COCOA) 140 SetMediaMIMETypes(Vector<String> types) 141 #endif 138 142 } -
trunk/Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm
r231984 r232136 49 49 #import <JavaScriptCore/ConfigFile.h> 50 50 #import <JavaScriptCore/Options.h> 51 #import <WebCore/AVFoundationMIMETypeCache.h> 51 52 #import <WebCore/AXObjectCache.h> 52 53 #import <WebCore/CPUMonitor.h> … … 182 183 pthread_set_fixedpriority_self(); 183 184 #endif 185 186 if (!parameters.mediaMIMETypes.isEmpty()) 187 setMediaMIMETypes(parameters.mediaMIMETypes); 188 else { 189 AVFoundationMIMETypeCache::singleton().setCacheMIMETypesCallback([this](const Vector<String>& types) { 190 parentProcessConnection()->send(Messages::WebProcessProxy::CacheMediaMIMETypes(types), 0); 191 }); 192 } 184 193 } 185 194 … … 335 344 void WebProcess::platformTerminate() 336 345 { 346 AVFoundationMIMETypeCache::singleton().setCacheMIMETypesCallback(nullptr); 337 347 } 338 348 … … 578 588 #endif 579 589 590 void WebProcess::setMediaMIMETypes(const Vector<String> types) 591 { 592 AVFoundationMIMETypeCache::singleton().setSupportedTypes(types); 593 } 594 580 595 } // namespace WebKit
Note: See TracChangeset
for help on using the changeset viewer.