Changeset 218498 in webkit
- Timestamp:
- Jun 19, 2017 10:44:20 AM (7 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r218497 r218498 1 2017-06-19 Chris Dumez <cdumez@apple.com> 2 3 Use WTF::Function instead of std::function in WebCore/Modules 4 https://bugs.webkit.org/show_bug.cgi?id=173534 5 6 Reviewed by Alex Christensen. 7 8 Use WTF::Function instead of std::function in WebCore/Modules to avoid 9 copying. 10 11 * Modules/applepay/PaymentCoordinatorClient.h: 12 * Modules/encryptedmedia/CDM.h: 13 * Modules/encryptedmedia/legacy/LegacyCDM.cpp: 14 (WebCore::CDMFactory::CDMFactory): 15 (WebCore::CDM::registerCDMFactory): 16 * Modules/encryptedmedia/legacy/LegacyCDM.h: 17 * Modules/mediasession/MediaSession.cpp: 18 (WebCore::MediaSession::changeActiveMediaElements): 19 (WebCore::MediaSession::safelyIterateActiveMediaElements): 20 * Modules/mediasession/MediaSession.h: 21 * Modules/mediastream/MediaEndpointPeerConnection.cpp: 22 (WebCore::matchTransceiver): 23 * Modules/mediastream/MediaStreamRegistry.cpp: 24 (WebCore::MediaStreamRegistry::forEach): 25 * Modules/mediastream/MediaStreamRegistry.h: 26 1 27 2017-06-19 Youenn Fablet <youenn@apple.com> 2 28 -
trunk/Source/WebCore/Modules/applepay/PaymentCoordinatorClient.h
r218457 r218498 29 29 30 30 #include "PaymentRequest.h" 31 #include <functional>32 31 #include <wtf/Forward.h> 32 #include <wtf/Function.h> 33 33 34 34 namespace WebCore { -
trunk/Source/WebCore/Modules/encryptedmedia/CDM.cpp
r217973 r218498 162 162 callback(WTFMove(configuration)); 163 163 }; 164 getConsentStatus(WTFMove(optionalConfiguration.value()), WTFMove(restrictions), consentCallback);164 getConsentStatus(WTFMove(optionalConfiguration.value()), WTFMove(restrictions), WTFMove(consentCallback)); 165 165 } 166 166 -
trunk/Source/WebCore/Modules/encryptedmedia/CDM.h
r212110 r218498 31 31 #include "MediaKeySystemConfiguration.h" 32 32 #include "SharedBuffer.h" 33 #include < functional>33 #include <wtf/Function.h> 34 34 #include <wtf/HashSet.h> 35 35 #include <wtf/Ref.h> … … 67 67 ~CDM(); 68 68 69 using SupportedConfigurationCallback = std::function<void(std::optional<MediaKeySystemConfiguration>)>;69 using SupportedConfigurationCallback = WTF::Function<void(std::optional<MediaKeySystemConfiguration>)>; 70 70 void getSupportedConfiguration(MediaKeySystemConfiguration&& candidateConfiguration, SupportedConfigurationCallback&&); 71 71 … … 111 111 WeakPtr<CDM> createWeakPtr() { return m_weakPtrFactory.createWeakPtr(); } 112 112 113 using ConsentStatusCallback = std::function<void(ConsentStatus, MediaKeySystemConfiguration&&, MediaKeysRestrictions&&)>;113 using ConsentStatusCallback = WTF::Function<void(ConsentStatus, MediaKeySystemConfiguration&&, MediaKeysRestrictions&&)>; 114 114 void getConsentStatus(MediaKeySystemConfiguration&& accumulatedConfiguration, MediaKeysRestrictions&&, ConsentStatusCallback&&); 115 115 String m_keySystem; -
trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp
r215686 r218498 633 633 return MediaKeyStatus::StatusPending; 634 634 case CDMInstance::KeyStatus::InternalError: 635 return MediaKeyStatus::InternalError;635 break; 636 636 }; 637 return MediaKeyStatus::InternalError; 637 638 }; 638 639 -
trunk/Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDM.cpp
r209936 r218498 47 47 WTF_MAKE_NONCOPYABLE(CDMFactory); WTF_MAKE_FAST_ALLOCATED; 48 48 public: 49 CDMFactory(CreateCDM constructor, CDMSupportsKeySystem supportsKeySystem, CDMSupportsKeySystemAndMimeType supportsKeySystemAndMimeType)50 : constructor( constructor)49 CDMFactory(CreateCDM&& constructor, CDMSupportsKeySystem supportsKeySystem, CDMSupportsKeySystemAndMimeType supportsKeySystemAndMimeType) 50 : constructor(WTFMove(constructor)) 51 51 , supportsKeySystem(supportsKeySystem) 52 52 , supportsKeySystemAndMimeType(supportsKeySystemAndMimeType) … … 82 82 } 83 83 84 void CDM::registerCDMFactory(CreateCDM constructor, CDMSupportsKeySystem supportsKeySystem, CDMSupportsKeySystemAndMimeType supportsKeySystemAndMimeType)84 void CDM::registerCDMFactory(CreateCDM&& constructor, CDMSupportsKeySystem supportsKeySystem, CDMSupportsKeySystemAndMimeType supportsKeySystemAndMimeType) 85 85 { 86 installedCDMFactories().append(new CDMFactory( constructor, supportsKeySystem, supportsKeySystemAndMimeType));86 installedCDMFactories().append(new CDMFactory(WTFMove(constructor), supportsKeySystem, supportsKeySystemAndMimeType)); 87 87 } 88 88 -
trunk/Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDM.h
r209936 r218498 31 31 #include <runtime/Uint8Array.h> 32 32 #include <wtf/Forward.h> 33 #include <wtf/Function.h> 33 34 #include <wtf/text/WTFString.h> 34 35 … … 39 40 class MediaPlayer; 40 41 41 typedef std::function<std::unique_ptr<CDMPrivateInterface> (CDM*)> CreateCDM;42 using CreateCDM = WTF::Function<std::unique_ptr<CDMPrivateInterface> (CDM*)>; 42 43 typedef bool (*CDMSupportsKeySystem)(const String&); 43 44 typedef bool (*CDMSupportsKeySystemAndMimeType)(const String&, const String&); … … 58 59 static bool keySystemSupportsMimeType(const String& keySystem, const String& mimeType); 59 60 static std::unique_ptr<CDM> create(const String& keySystem); 60 WEBCORE_EXPORT static void registerCDMFactory(CreateCDM , CDMSupportsKeySystem, CDMSupportsKeySystemAndMimeType);61 WEBCORE_EXPORT static void registerCDMFactory(CreateCDM&&, CDMSupportsKeySystem, CDMSupportsKeySystemAndMimeType); 61 62 ~CDM(); 62 63 -
trunk/Source/WebCore/Modules/mediasession/MediaSession.cpp
r209240 r218498 84 84 } 85 85 86 void MediaSession::changeActiveMediaElements( std::function<void(void)>worker)86 void MediaSession::changeActiveMediaElements(const WTF::Function<void(void)>& worker) 87 87 { 88 88 if (Page *page = m_document.page()) { … … 238 238 } 239 239 240 void MediaSession::safelyIterateActiveMediaElements( std::function<void(HTMLMediaElement*)>handler)240 void MediaSession::safelyIterateActiveMediaElements(const WTF::Function<void(HTMLMediaElement*)>& handler) 241 241 { 242 242 ASSERT(!m_iteratedActiveParticipatingElements); -
trunk/Source/WebCore/Modules/mediasession/MediaSession.h
r209240 r218498 30 30 #include "MediaRemoteControls.h" 31 31 #include "MediaSessionMetadata.h" 32 #include <wtf/Function.h> 32 33 #include <wtf/HashSet.h> 33 34 … … 89 90 void removeMediaElement(HTMLMediaElement&); 90 91 91 void safelyIterateActiveMediaElements( std::function<void(HTMLMediaElement*)>);92 void changeActiveMediaElements( std::function<void(void)>);92 void safelyIterateActiveMediaElements(const WTF::Function<void(HTMLMediaElement*)>&); 93 void changeActiveMediaElements(const WTF::Function<void(void)>&); 93 94 void addActiveMediaElement(HTMLMediaElement&); 94 95 bool isMediaElementActive(HTMLMediaElement&); -
trunk/Source/WebCore/Modules/mediastream/MediaEndpointPeerConnection.cpp
r216501 r218498 53 53 #include "RTCTrackEvent.h" 54 54 #include "SDPProcessor.h" 55 #include <wtf/Function.h> 55 56 #include <wtf/MainThread.h> 56 57 #include <wtf/text/Base64.h> … … 103 104 } 104 105 105 static RTCRtpTransceiver* matchTransceiver(const RtpTransceiverVector& transceivers, const std::function<bool(RTCRtpTransceiver&)>& matchFunction)106 static RTCRtpTransceiver* matchTransceiver(const RtpTransceiverVector& transceivers, const WTF::Function<bool(RTCRtpTransceiver&)>& matchFunction) 106 107 { 107 108 for (auto& transceiver : transceivers) { -
trunk/Source/WebCore/Modules/mediastream/MediaStreamRegistry.cpp
r216197 r218498 87 87 } 88 88 89 void MediaStreamRegistry::forEach( std::function<void(MediaStream&)>callback) const89 void MediaStreamRegistry::forEach(const WTF::Function<void(MediaStream&)>& callback) const 90 90 { 91 91 for (auto& stream : mediaStreams()) -
trunk/Source/WebCore/Modules/mediastream/MediaStreamRegistry.h
r218488 r218498 29 29 30 30 #include "URLRegistry.h" 31 #include < functional>31 #include <wtf/Function.h> 32 32 #include <wtf/HashMap.h> 33 33 #include <wtf/text/StringHash.h> … … 57 57 MediaStream* lookUp(const URL&) const; 58 58 59 void forEach( std::function<void(MediaStream&)>) const;59 void forEach(const WTF::Function<void(MediaStream&)>&) const; 60 60 61 61 private:
Note: See TracChangeset
for help on using the changeset viewer.