Changeset 252008 in webkit
- Timestamp:
- Nov 4, 2019 12:58:52 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 deleted
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r252003 r252008 1 2019-11-04 Truitt Savell <tsavell@apple.com> 2 3 Unreviewed, rolling out r251993. 4 5 Broke platform/mac/media/encrypted-media/fps- 6 generateRequest.html on Mojave+ 7 8 Reverted changeset: 9 10 "MediaKeySession / WebKitMediaKeySession should not prevent 11 entering the back/forward cache" 12 https://bugs.webkit.org/show_bug.cgi?id=203089 13 https://trac.webkit.org/changeset/251993 14 1 15 2019-11-04 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r252007 r252008 1 2019-11-04 Truitt Savell <tsavell@apple.com> 2 3 Unreviewed, rolling out r251993. 4 5 Broke platform/mac/media/encrypted-media/fps- 6 generateRequest.html on Mojave+ 7 8 Reverted changeset: 9 10 "MediaKeySession / WebKitMediaKeySession should not prevent 11 entering the back/forward cache" 12 https://bugs.webkit.org/show_bug.cgi?id=203089 13 https://trac.webkit.org/changeset/251993 14 1 15 2019-11-04 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.cpp
r251993 r252008 32 32 #if ENABLE(ENCRYPTED_MEDIA) 33 33 34 #include "AbstractEventLoop.h"35 34 #include "CDM.h" 36 35 #include "CDMInstance.h" … … 72 71 , m_implementation(WTFMove(implementation)) 73 72 , m_instanceSession(WTFMove(instanceSession)) 73 , m_eventQueue(MainThreadGenericEventQueue::create(*this)) 74 74 { 75 75 // https://w3c.github.io/encrypted-media/#dom-mediakeys-createsession … … 158 158 // 9. Let promise be a new promise. 159 159 // 10. Run the following steps in parallel: 160 enqueueTask([this, initData = SharedBuffer::create(initData.data(), initData.length()), initDataType, promise = WTFMove(promise)] () mutable {160 m_taskQueue.enqueueTask([this, initData = SharedBuffer::create(initData.data(), initData.length()), initDataType, promise = WTFMove(promise)] () mutable { 161 161 // 10.1. If the init data is not valid for initDataType, reject promise with a newly created TypeError. 162 162 // 10.2. Let sanitized init data be a validated and sanitized version of init data. … … 227 227 228 228 // 10.10. Queue a task to run the following steps: 229 enqueueTask([this, promise = WTFMove(promise), message = WTFMove(message), messageType, sessionId, succeeded] () mutable {229 m_taskQueue.enqueueTask([this, promise = WTFMove(promise), message = WTFMove(message), messageType, sessionId, succeeded] () mutable { 230 230 // 10.10.1. If any of the preceding steps failed, reject promise with a new DOMException whose name is the appropriate error name. 231 231 if (succeeded == CDMInstanceSession::SuccessValue::Failed) { … … 278 278 // 7. Let promise be a new promise. 279 279 // 8. Run the following steps in parallel: 280 enqueueTask([this, sessionId, promise = WTFMove(promise)] () mutable {280 m_taskQueue.enqueueTask([this, sessionId, promise = WTFMove(promise)] () mutable { 281 281 // 8.1. Let sanitized session ID be a validated and/or sanitized version of sessionId. 282 282 // 8.2. If the preceding step failed, or if sanitized session ID is empty, reject promise with a newly created TypeError. … … 330 330 331 331 // 8.9. Queue a task to run the following steps: 332 enqueueTask([this, knownKeys = WTFMove(knownKeys), expiration = WTFMove(expiration), message = WTFMove(message), sanitizedSessionId, succeeded, promise = WTFMove(promise)] () mutable {332 m_taskQueue.enqueueTask([this, knownKeys = WTFMove(knownKeys), expiration = WTFMove(expiration), message = WTFMove(message), sanitizedSessionId, succeeded, promise = WTFMove(promise)] () mutable { 333 333 // 8.9.1. If any of the preceding steps failed, reject promise with a the appropriate error name. 334 334 if (succeeded == CDMInstanceSession::SuccessValue::Failed) { … … 387 387 // 5. Let promise be a new promise. 388 388 // 6. Run the following steps in parallel: 389 enqueueTask([this, response = SharedBuffer::create(response.data(), response.length()), promise = WTFMove(promise)] () mutable {389 m_taskQueue.enqueueTask([this, response = SharedBuffer::create(response.data(), response.length()), promise = WTFMove(promise)] () mutable { 390 390 // 6.1. Let sanitized response be a validated and/or sanitized version of response copy. 391 391 RefPtr<SharedBuffer> sanitizedResponse = m_implementation->sanitizeResponse(response); … … 438 438 // 6.7.3.2. Let message type be the appropriate MediaKeyMessageType for the message. 439 439 // 6.8. Queue a task to run the following steps: 440 enqueueTask([this, sessionWasClosed, changedKeys = WTFMove(changedKeys), changedExpiration = WTFMove(changedExpiration), message = WTFMove(message), promise = WTFMove(promise)] () mutable {440 m_taskQueue.enqueueTask([this, sessionWasClosed, changedKeys = WTFMove(changedKeys), changedExpiration = WTFMove(changedExpiration), message = WTFMove(message), promise = WTFMove(promise)] () mutable { 441 441 LOG(EME, "EME - updating CDM license succeeded for session %s, sending a message to the license server", m_sessionId.utf8().data()); 442 442 // 6.8.1. … … 515 515 // 4. Let promise be a new promise. 516 516 // 5. Run the following steps in parallel: 517 enqueueTask([this, promise = WTFMove(promise)] () mutable {517 m_taskQueue.enqueueTask([this, promise = WTFMove(promise)] () mutable { 518 518 // 5.1. Let cdm be the CDM instance represented by session's cdm instance value. 519 519 // 5.2. Use cdm to close the key session associated with session. … … 524 524 525 525 // 5.3. Queue a task to run the following steps: 526 enqueueTask([this, promise = WTFMove(promise)] () mutable {526 m_taskQueue.enqueueTask([this, promise = WTFMove(promise)] () mutable { 527 527 // 5.3.1. Run the Session Closed algorithm on the session. 528 528 sessionClosed(); … … 553 553 // 3. Let promise be a new promise. 554 554 // 4. Run the following steps in parallel: 555 enqueueTask([this, promise = WTFMove(promise)] () mutable {555 m_taskQueue.enqueueTask([this, promise = WTFMove(promise)] () mutable { 556 556 // 4.1. Let cdm be the CDM instance represented by this object's cdm instance value. 557 557 // 4.2. Let message be null. … … 578 578 579 579 // 4.5. Queue a task to run the following steps: 580 enqueueTask([this, keys = WTFMove(keys), message = WTFMove(message), succeeded, promise = WTFMove(promise)] () mutable {580 m_taskQueue.enqueueTask([this, keys = WTFMove(keys), message = WTFMove(message), succeeded, promise = WTFMove(promise)] () mutable { 581 581 // 4.5.1. Run the Update Key Statuses algorithm on the session, providing all key ID(s) in the session along with the "released" MediaKeyStatus value for each. 582 582 updateKeyStatuses(WTFMove(keys)); … … 617 617 // session. 618 618 auto messageEvent = MediaKeyMessageEvent::create(eventNames().messageEvent, {messageType, message.tryCreateArrayBuffer()}, Event::IsTrusted::Yes); 619 enqueueEvent(WTFMove(messageEvent));619 m_eventQueue->enqueueEvent(WTFMove(messageEvent)); 620 620 } 621 621 … … 662 662 663 663 // 5. Queue a task to fire a simple event named keystatuseschange at the session. 664 enqueueEvent(Event::create(eventNames().keystatuseschangeEvent, Event::CanBubble::No, Event::IsCancelable::No));664 m_eventQueue->enqueueEvent(Event::create(eventNames().keystatuseschangeEvent, Event::CanBubble::No, Event::IsCancelable::No)); 665 665 666 666 // 6. Queue a task to run the Attempt to Resume Playback If Necessary algorithm on each of the media element(s) whose mediaKeys attribute is the MediaKeys object that created the session. 667 enqueueTask(667 m_taskQueue.enqueueTask( 668 668 [this] () mutable { 669 669 if (m_keys) … … 734 734 bool MediaKeySession::hasPendingActivity() const 735 735 { 736 // A MediaKeySession object SHALL NOT be destroyed and SHALL continue to receive events if it is not closed and the MediaKeys object that created it remains accessible.737 return (!m_closed && m_keys) || ActiveDOMObject::hasPendingActivity();736 notImplemented(); 737 return false; 738 738 } 739 739 740 740 const char* MediaKeySession::activeDOMObjectName() const 741 741 { 742 notImplemented(); 742 743 return "MediaKeySession"; 743 744 } 744 745 745 void MediaKeySession::enqueueTask(Function<void()>&& task) 746 { 747 auto* context = scriptExecutionContext(); 748 if (!context) 749 return; 750 751 context->eventLoop().queueTask(TaskSource::Networking, *context, [pendingActivity = makePendingActivity(*this), task = WTFMove(task)] { 752 task(); 753 }); 754 } 755 756 void MediaKeySession::enqueueEvent(Ref<Event>&& event) 757 { 758 auto* context = scriptExecutionContext(); 759 if (!context) 760 return; 761 762 context->eventLoop().queueTask(TaskSource::Networking, *context, [this, pendingActivity = makePendingActivity(*this), event = WTFMove(event)]() mutable { 763 dispatchEvent(WTFMove(event)); 764 }); 746 // FIXME: This should never prevent entering the back/forward cache. 747 bool MediaKeySession::shouldPreventEnteringBackForwardCache_DEPRECATED() const 748 { 749 notImplemented(); 750 return true; 751 } 752 753 void MediaKeySession::stop() 754 { 755 notImplemented(); 765 756 } 766 757 -
trunk/Source/WebCore/Modules/encryptedmedia/MediaKeySession.h
r251993 r252008 34 34 #include "CDMInstanceSession.h" 35 35 #include "EventTarget.h" 36 #include "GenericEventQueue.h" 37 #include "GenericTaskQueue.h" 36 38 #include "IDLTypes.h" 37 39 #include "MediaKeyMessageType.h" … … 39 41 #include "MediaKeyStatus.h" 40 42 #include <wtf/RefCounted.h> 41 #include <wtf/UniqueRef.h>42 43 #include <wtf/Vector.h> 43 44 #include <wtf/WeakPtr.h> … … 91 92 String mediaKeysStorageDirectory() const; 92 93 93 void enqueueTask(Function<void()>&&);94 void enqueueEvent(Ref<Event>&&);95 96 94 // CDMInstanceSessionClient 97 95 void updateKeyStatuses(CDMInstanceSessionClient::KeyStatusVector&&) override; … … 107 105 // ActiveDOMObject 108 106 const char* activeDOMObjectName() const override; 107 bool shouldPreventEnteringBackForwardCache_DEPRECATED() const override; 108 void stop() override; 109 109 110 110 WeakPtr<MediaKeys> m_keys; … … 120 120 Ref<CDM> m_implementation; 121 121 Ref<CDMInstanceSession> m_instanceSession; 122 UniqueRef<MainThreadGenericEventQueue> m_eventQueue; 123 GenericTaskQueue<Timer> m_taskQueue; 122 124 Vector<Ref<SharedBuffer>> m_recordOfKeyUsage; 123 125 double m_firstDecryptTime { 0 }; -
trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp
r251993 r252008 29 29 #if ENABLE(LEGACY_ENCRYPTED_MEDIA) 30 30 31 #include "AbstractEventLoop.h"32 31 #include "Document.h" 33 32 #include "EventNames.h" … … 56 55 , m_keys(&keys) 57 56 , m_keySystem(keySystem) 57 , m_asyncEventQueue(MainThreadGenericEventQueue::create(*this)) 58 58 , m_session(keys.cdm().createSession(*this)) 59 59 , m_keyRequestTimer(*this, &WebKitMediaKeySession::keyRequestTimerFired) … … 68 68 if (m_session) 69 69 m_session->setClient(nullptr); 70 71 m_asyncEventQueue->cancelAllEvents(); 70 72 } 71 73 … … 182 184 auto keyaddedEvent = Event::create(eventNames().webkitkeyaddedEvent, Event::CanBubble::No, Event::IsCancelable::No); 183 185 keyaddedEvent->setTarget(this); 184 enqueueEvent(WTFMove(keyaddedEvent));186 m_asyncEventQueue->enqueueEvent(WTFMove(keyaddedEvent)); 185 187 186 188 ASSERT(m_keys); … … 206 208 auto event = WebKitMediaKeyMessageEvent::create(eventNames().webkitkeymessageEvent, message, destinationURL); 207 209 event->setTarget(this); 208 enqueueEvent(WTFMove(event));210 m_asyncEventQueue->enqueueEvent(WTFMove(event)); 209 211 } 210 212 … … 215 217 auto keyerrorEvent = Event::create(eventNames().webkitkeyerrorEvent, Event::CanBubble::No, Event::IsCancelable::No); 216 218 keyerrorEvent->setTarget(this); 217 enqueueEvent(WTFMove(keyerrorEvent));219 m_asyncEventQueue->enqueueEvent(WTFMove(keyerrorEvent)); 218 220 } 219 221 … … 237 239 bool WebKitMediaKeySession::hasPendingActivity() const 238 240 { 239 return (m_keys && m_session) || ActiveDOMObject::hasPendingActivity();241 return (m_keys && m_session) || m_asyncEventQueue->hasPendingEvents(); 240 242 } 241 243 … … 250 252 } 251 253 252 void WebKitMediaKeySession::enqueueEvent(Ref<Event>&& event) 253 { 254 auto* context = scriptExecutionContext(); 255 if (!context) 256 return; 257 258 context->eventLoop().queueTask(TaskSource::Networking, *context, [this, pendingActivity = makePendingActivity(*this), event = WTFMove(event)]() mutable { 259 dispatchEvent(WTFMove(event)); 260 }); 254 bool WebKitMediaKeySession::shouldPreventEnteringBackForwardCache_DEPRECATED() const 255 { 256 // FIXME: This should never prevent entering the back/forward cache. 257 return true; 261 258 } 262 259 -
trunk/Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.h
r251993 r252008 31 31 #include "EventTarget.h" 32 32 #include "ExceptionOr.h" 33 #include "GenericEventQueue.h" 33 34 #include "LegacyCDMSession.h" 34 35 #include "Timer.h" … … 41 42 class WebKitMediaKeys; 42 43 43 class WebKitMediaKeySession final : public RefCounted<WebKitMediaKeySession>, public EventTargetWithInlineData, p ublicActiveDOMObject, private LegacyCDMSessionClient {44 class WebKitMediaKeySession final : public RefCounted<WebKitMediaKeySession>, public EventTargetWithInlineData, private ActiveDOMObject, private LegacyCDMSessionClient { 44 45 WTF_MAKE_ISO_ALLOCATED(WebKitMediaKeySession); 45 46 public: … … 74 75 String mediaKeysStorageDirectory() const final; 75 76 76 void enqueueEvent(Ref<Event>&&);77 78 77 void refEventTarget() final { ref(); } 79 78 void derefEventTarget() final { deref(); } 80 79 81 80 void stop() final; 81 bool shouldPreventEnteringBackForwardCache_DEPRECATED() const final; 82 82 const char* activeDOMObjectName() const final; 83 83 … … 89 89 String m_sessionId; 90 90 RefPtr<WebKitMediaKeyError> m_error; 91 UniqueRef<MainThreadGenericEventQueue> m_asyncEventQueue; 91 92 std::unique_ptr<LegacyCDMSession> m_session; 92 93
Note: See TracChangeset
for help on using the changeset viewer.