Changeset 239236 in webkit
- Timestamp:
- Dec 14, 2018 2:59:36 PM (5 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r239230 r239236 1 2018-12-14 Jer Noble <jer.noble@apple.com> 2 3 CRASH in CDMInstanceSessionFairPlayStreamingAVFObjC::closeSession(WTF::String const&, WTF::Function<void ()>&&) 4 https://bugs.webkit.org/show_bug.cgi?id=192713 5 <rdar://problem/46739706> 6 7 Reviewed by Eric Carlson. 8 9 A callback is being called twice, and the second time has a null Promise. Instead of these 10 callbacks being WTF::Function, make them WTF::CompletionHandlers, which self-nullify and 11 have ASSERTS() that they are called once-and-only-once. 12 13 * platform/encryptedmedia/CDMInstanceSession.h: 14 * platform/encryptedmedia/clearkey/CDMClearKey.cpp: 15 (WebCore::CDMInstanceSessionClearKey::closeSession): 16 * platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm: 17 (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::closeSession): 18 (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRequest): 19 (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didProvideRenewingRequest): 20 (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::didFailToProvideRequest): 21 (WebCore::CDMInstanceSessionFairPlayStreamingAVFObjC::requestDidSucceed): 22 1 23 2018-12-14 David Kilzer <ddkilzer@apple.com> 2 24 -
trunk/Source/WebCore/platform/encryptedmedia/CDMInstanceSession.h
r237649 r239236 31 31 #include "CDMMessageType.h" 32 32 #include "CDMSessionType.h" 33 #include <wtf/CompletionHandler.h> 33 34 #include <wtf/RefCounted.h> 34 35 #include <wtf/Vector.h> … … 65 66 }; 66 67 67 using LicenseCallback = Function<void(Ref<SharedBuffer>&& message, const String& sessionId, bool needsIndividualization, SuccessValue succeeded)>;68 using LicenseCallback = CompletionHandler<void(Ref<SharedBuffer>&& message, const String& sessionId, bool needsIndividualization, SuccessValue succeeded)>; 68 69 virtual void requestLicense(LicenseType, const AtomicString& initDataType, Ref<SharedBuffer>&& initData, LicenseCallback&&) = 0; 69 70 70 71 using KeyStatusVector = CDMInstanceSessionClient::KeyStatusVector; 71 72 using Message = std::pair<MessageType, Ref<SharedBuffer>>; 72 using LicenseUpdateCallback = Function<void(bool sessionWasClosed, std::optional<KeyStatusVector>&& changedKeys, std::optional<double>&& changedExpiration, std::optional<Message>&& message, SuccessValue succeeded)>;73 using LicenseUpdateCallback = CompletionHandler<void(bool sessionWasClosed, std::optional<KeyStatusVector>&& changedKeys, std::optional<double>&& changedExpiration, std::optional<Message>&& message, SuccessValue succeeded)>; 73 74 virtual void updateLicense(const String& sessionId, LicenseType, const SharedBuffer& response, LicenseUpdateCallback&&) = 0; 74 75 … … 81 82 }; 82 83 83 using LoadSessionCallback = Function<void(std::optional<KeyStatusVector>&&, std::optional<double>&&, std::optional<Message>&&, SuccessValue, SessionLoadFailure)>;84 using LoadSessionCallback = CompletionHandler<void(std::optional<KeyStatusVector>&&, std::optional<double>&&, std::optional<Message>&&, SuccessValue, SessionLoadFailure)>; 84 85 virtual void loadSession(LicenseType, const String& sessionId, const String& origin, LoadSessionCallback&&) = 0; 85 86 86 using CloseSessionCallback = Function<void()>;87 using CloseSessionCallback = CompletionHandler<void()>; 87 88 virtual void closeSession(const String& sessionId, CloseSessionCallback&&) = 0; 88 89 89 using RemoveSessionDataCallback = Function<void(KeyStatusVector&&, std::optional<Ref<SharedBuffer>>&&, SuccessValue)>;90 using RemoveSessionDataCallback = CompletionHandler<void(KeyStatusVector&&, std::optional<Ref<SharedBuffer>>&&, SuccessValue)>; 90 91 virtual void removeSessionData(const String& sessionId, LicenseType, RemoveSessionDataCallback&&) = 0; 91 92 -
trunk/Source/WebCore/platform/encryptedmedia/clearkey/CDMClearKey.cpp
r236317 r239236 677 677 { 678 678 callOnMainThread( 679 [weakThis = makeWeakPtr(*this), callback = WTFMove(callback)] {679 [weakThis = makeWeakPtr(*this), callback = WTFMove(callback)] () mutable { 680 680 if (!weakThis) 681 681 return; -
trunk/Source/WebCore/platform/graphics/avfoundation/objc/CDMInstanceFairPlayStreamingAVFObjC.mm
r237649 r239236 429 429 if (m_requestLicenseCallback) { 430 430 m_requestLicenseCallback(SharedBuffer::create(), m_sessionId, false, Failed); 431 m_requestLicenseCallback = nullptr;431 ASSERT(!m_requestLicenseCallback); 432 432 } 433 433 if (m_updateLicenseCallback) { 434 434 m_updateLicenseCallback(true, std::nullopt, std::nullopt, std::nullopt, Failed); 435 m_updateLicenseCallback = nullptr;435 ASSERT(!m_updateLicenseCallback); 436 436 } 437 437 if (m_removeSessionDataCallback) { 438 438 m_removeSessionDataCallback({ }, std::nullopt, Failed); 439 m_removeSessionDataCallback = nullptr;439 ASSERT(!m_removeSessionDataCallback); 440 440 } 441 441 m_currentRequest = nullptr; … … 517 517 if (m_requestLicenseCallback) { 518 518 m_requestLicenseCallback(SharedBuffer::create(), m_sessionId, false, Failed); 519 m_requestLicenseCallback = nullptr;519 ASSERT(!m_requestLicenseCallback); 520 520 } 521 521 return; … … 534 534 else if (m_client) 535 535 m_client->sendMessage(CDMMessageType::LicenseRequest, SharedBuffer::create(contentKeyRequestData.get())); 536 m_requestLicenseCallback = nullptr;536 ASSERT(!m_requestLicenseCallback); 537 537 }); 538 538 }]; … … 570 570 else if (m_client) 571 571 m_client->sendMessage(CDMMessageType::LicenseRenewal, SharedBuffer::create(contentKeyRequestData.get())); 572 m_updateLicenseCallback = nullptr;572 ASSERT(!m_updateLicenseCallback); 573 573 }); 574 574 }]; … … 584 584 UNUSED_PARAM(request); 585 585 UNUSED_PARAM(error); 586 if (m_updateLicenseCallback) 586 if (m_updateLicenseCallback) { 587 587 m_updateLicenseCallback(false, std::nullopt, std::nullopt, std::nullopt, Failed); 588 ASSERT(!m_updateLicenseCallback); 589 } 588 590 589 591 m_currentRequest = nullptr; … … 595 597 { 596 598 UNUSED_PARAM(request); 597 if (m_updateLicenseCallback) 599 if (m_updateLicenseCallback) { 598 600 m_updateLicenseCallback(false, std::make_optional(keyStatuses()), std::nullopt, std::nullopt, Succeeded); 601 ASSERT(!m_updateLicenseCallback); 602 } 599 603 600 604 m_currentRequest = nullptr;
Note: See TracChangeset
for help on using the changeset viewer.