Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(454)

Side by Side Diff: third_party/WebKit/Source/modules/encryptedmedia/MediaKeySession.cpp

Issue 2406073002: EME: Implement Session Closed algorithm (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 822 matching lines...) Expand 10 before | Expand all | Expand 10 after
833 } 833 }
834 init.setMessage( 834 init.setMessage(
835 DOMArrayBuffer::create(static_cast<const void*>(message), messageLength)); 835 DOMArrayBuffer::create(static_cast<const void*>(message), messageLength));
836 836
837 MediaKeyMessageEvent* event = 837 MediaKeyMessageEvent* event =
838 MediaKeyMessageEvent::create(EventTypeNames::message, init); 838 MediaKeyMessageEvent::create(EventTypeNames::message, init);
839 event->setTarget(this); 839 event->setTarget(this);
840 m_asyncEventQueue->enqueueEvent(event); 840 m_asyncEventQueue->enqueueEvent(event);
841 } 841 }
842 842
843 void MediaKeySession::close() { 843 void MediaKeySession::close() {
ddorwin 2016/10/11 01:41:07 This method is overloaded with the implementation
jrummell 2016/10/11 18:47:35 Since we're switching blink to Chromium style, we
844 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")"; 844 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ")";
845 845
846 // From https://w3c.github.io/encrypted-media/#session-close: 846 // From http://w3c.github.io/encrypted-media/#session-closed
847 // The following steps are run: 847 // 1. Let session be the associated MediaKeySession object.
848 // 1. Let the session be the associated MediaKeySession object. 848 // 2. If session's session type is "persistent-usage-record", execute the
849 // 2. Let promise be the closed attribute of the session. 849 // following steps in parallel:
850 // 3. Resolve promise. 850 // 1. Let cdm be the CDM instance represented by session's cdm instance
851 // value.
852 // 2. Use cdm to store session's record of key usage, if it exists.
853 // ("persistent-usage-record" not supported by Chrome.)
854
855 // 3. Run the Update Key Statuses algorithm on the session, providing an
856 // empty sequence.
857 keysStatusesChange(WebVector<WebEncryptedMediaKeyInformation>(), false);
858
859 // 4. Run the Update Expiration algorithm on the session, providing NaN.
860 expirationChanged(std::numeric_limits<double>::quiet_NaN());
ddorwin 2016/10/11 01:41:07 Unrelated to this CL, it's odd that we have Change
jrummell 2016/10/11 18:47:35 Agreed.
861
862 // 5. Let promise be the closed attribute of the session.
863 // 6. Resolve promise.
851 m_closedPromise->resolve(ToV8UndefinedGenerator()); 864 m_closedPromise->resolve(ToV8UndefinedGenerator());
852 865
853 // Once closed, the session can no longer be the target of events from 866 // After this algorithm has run, event handlers for the events queued by
854 // the CDM so this object can be garbage collected. 867 // this algorithm will be executed, but no further events can be queued.
868 // As a result, no messages can be sent by the CDM as a result of closing
869 // the session.
855 m_isClosed = true; 870 m_isClosed = true;
856 } 871 }
857 872
858 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) { 873 void MediaKeySession::expirationChanged(double updatedExpiryTimeInMS) {
859 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") " 874 DVLOG(MEDIA_KEY_SESSION_LOG_LEVEL) << __func__ << "(" << this << ") "
860 << updatedExpiryTimeInMS; 875 << updatedExpiryTimeInMS;
861 876
862 // From https://w3c.github.io/encrypted-media/#update-expiration: 877 // From https://w3c.github.io/encrypted-media/#update-expiration:
863 // The following steps are run: 878 // The following steps are run:
864 // 1. Let the session be the associated MediaKeySession object. 879 // 1. Let the session be the associated MediaKeySession object.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 visitor->trace(m_asyncEventQueue); 972 visitor->trace(m_asyncEventQueue);
958 visitor->trace(m_pendingActions); 973 visitor->trace(m_pendingActions);
959 visitor->trace(m_mediaKeys); 974 visitor->trace(m_mediaKeys);
960 visitor->trace(m_keyStatusesMap); 975 visitor->trace(m_keyStatusesMap);
961 visitor->trace(m_closedPromise); 976 visitor->trace(m_closedPromise);
962 EventTargetWithInlineData::trace(visitor); 977 EventTargetWithInlineData::trace(visitor);
963 ActiveDOMObject::trace(visitor); 978 ActiveDOMObject::trace(visitor);
964 } 979 }
965 980
966 } // namespace blink 981 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698