| OLD | NEW |
| 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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 295 visitor->trace(m_session); | 295 visitor->trace(m_session); |
| 296 ContentDecryptionModuleResultPromise::trace(visitor); | 296 ContentDecryptionModuleResultPromise::trace(visitor); |
| 297 } | 297 } |
| 298 | 298 |
| 299 private: | 299 private: |
| 300 Member<MediaKeySession> m_session; | 300 Member<MediaKeySession> m_session; |
| 301 }; | 301 }; |
| 302 | 302 |
| 303 MediaKeySession* MediaKeySession::create(ScriptState* scriptState, MediaKeys* me
diaKeys, WebEncryptedMediaSessionType sessionType) | 303 MediaKeySession* MediaKeySession::create(ScriptState* scriptState, MediaKeys* me
diaKeys, WebEncryptedMediaSessionType sessionType) |
| 304 { | 304 { |
| 305 RefPtrWillBeRawPtr<MediaKeySession> session = new MediaKeySession(scriptStat
e, mediaKeys, sessionType); | 305 RawPtr<MediaKeySession> session = new MediaKeySession(scriptState, mediaKeys
, sessionType); |
| 306 session->suspendIfNeeded(); | 306 session->suspendIfNeeded(); |
| 307 return session.get(); | 307 return session.get(); |
| 308 } | 308 } |
| 309 | 309 |
| 310 MediaKeySession::MediaKeySession(ScriptState* scriptState, MediaKeys* mediaKeys,
WebEncryptedMediaSessionType sessionType) | 310 MediaKeySession::MediaKeySession(ScriptState* scriptState, MediaKeys* mediaKeys,
WebEncryptedMediaSessionType sessionType) |
| 311 : ActiveScriptWrappable(this) | 311 : ActiveScriptWrappable(this) |
| 312 , ActiveDOMObject(scriptState->getExecutionContext()) | 312 , ActiveDOMObject(scriptState->getExecutionContext()) |
| 313 , m_asyncEventQueue(GenericEventQueue::create(this)) | 313 , m_asyncEventQueue(GenericEventQueue::create(this)) |
| 314 , m_mediaKeys(mediaKeys) | 314 , m_mediaKeys(mediaKeys) |
| 315 , m_sessionType(sessionType) | 315 , m_sessionType(sessionType) |
| (...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 794 break; | 794 break; |
| 795 case WebContentDecryptionModuleSession::Client::MessageType::LicenseRenewal: | 795 case WebContentDecryptionModuleSession::Client::MessageType::LicenseRenewal: |
| 796 init.setMessageType("license-renewal"); | 796 init.setMessageType("license-renewal"); |
| 797 break; | 797 break; |
| 798 case WebContentDecryptionModuleSession::Client::MessageType::LicenseRelease: | 798 case WebContentDecryptionModuleSession::Client::MessageType::LicenseRelease: |
| 799 init.setMessageType("license-release"); | 799 init.setMessageType("license-release"); |
| 800 break; | 800 break; |
| 801 } | 801 } |
| 802 init.setMessage(DOMArrayBuffer::create(static_cast<const void*>(message), me
ssageLength)); | 802 init.setMessage(DOMArrayBuffer::create(static_cast<const void*>(message), me
ssageLength)); |
| 803 | 803 |
| 804 RefPtrWillBeRawPtr<MediaKeyMessageEvent> event = MediaKeyMessageEvent::creat
e(EventTypeNames::message, init); | 804 RawPtr<MediaKeyMessageEvent> event = MediaKeyMessageEvent::create(EventTypeN
ames::message, init); |
| 805 event->setTarget(this); | 805 event->setTarget(this); |
| 806 m_asyncEventQueue->enqueueEvent(event.release()); | 806 m_asyncEventQueue->enqueueEvent(event.release()); |
| 807 } | 807 } |
| 808 | 808 |
| 809 void MediaKeySession::close() | 809 void MediaKeySession::close() |
| 810 { | 810 { |
| 811 WTF_LOG(Media, "MediaKeySession(%p)::close", this); | 811 WTF_LOG(Media, "MediaKeySession(%p)::close", this); |
| 812 | 812 |
| 813 // From https://w3c.github.io/encrypted-media/#session-close: | 813 // From https://w3c.github.io/encrypted-media/#session-close: |
| 814 // The following steps are run: | 814 // The following steps are run: |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 for (size_t i = 0; i < keys.size(); ++i) { | 862 for (size_t i = 0; i < keys.size(); ++i) { |
| 863 // 4.2.1 Let pair be the pair. | 863 // 4.2.1 Let pair be the pair. |
| 864 const auto& key = keys[i]; | 864 const auto& key = keys[i]; |
| 865 // 4.2.2 Insert an entry for pair's key ID into statuses with the | 865 // 4.2.2 Insert an entry for pair's key ID into statuses with the |
| 866 // value of pair's MediaKeyStatus value. | 866 // value of pair's MediaKeyStatus value. |
| 867 m_keyStatusesMap->addEntry(key.id(), ConvertKeyStatusToString(key.status
())); | 867 m_keyStatusesMap->addEntry(key.id(), ConvertKeyStatusToString(key.status
())); |
| 868 } | 868 } |
| 869 | 869 |
| 870 // 5. Queue a task to fire a simple event named keystatuseschange | 870 // 5. Queue a task to fire a simple event named keystatuseschange |
| 871 // at the session. | 871 // at the session. |
| 872 RefPtrWillBeRawPtr<Event> event = Event::create(EventTypeNames::keystatusesc
hange); | 872 RawPtr<Event> event = Event::create(EventTypeNames::keystatuseschange); |
| 873 event->setTarget(this); | 873 event->setTarget(this); |
| 874 m_asyncEventQueue->enqueueEvent(event.release()); | 874 m_asyncEventQueue->enqueueEvent(event.release()); |
| 875 | 875 |
| 876 // 6. Queue a task to run the attempt to resume playback if necessary | 876 // 6. Queue a task to run the attempt to resume playback if necessary |
| 877 // algorithm on each of the media element(s) whose mediaKeys attribute | 877 // algorithm on each of the media element(s) whose mediaKeys attribute |
| 878 // is the MediaKeys object that created the session. The user agent | 878 // is the MediaKeys object that created the session. The user agent |
| 879 // may choose to skip this step if it knows resuming will fail. | 879 // may choose to skip this step if it knows resuming will fail. |
| 880 // FIXME: Attempt to resume playback if |hasAdditionalUsableKey| is true. | 880 // FIXME: Attempt to resume playback if |hasAdditionalUsableKey| is true. |
| 881 // http://crbug.com/413413 | 881 // http://crbug.com/413413 |
| 882 } | 882 } |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 922 visitor->trace(m_asyncEventQueue); | 922 visitor->trace(m_asyncEventQueue); |
| 923 visitor->trace(m_pendingActions); | 923 visitor->trace(m_pendingActions); |
| 924 visitor->trace(m_mediaKeys); | 924 visitor->trace(m_mediaKeys); |
| 925 visitor->trace(m_keyStatusesMap); | 925 visitor->trace(m_keyStatusesMap); |
| 926 visitor->trace(m_closedPromise); | 926 visitor->trace(m_closedPromise); |
| 927 RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession>::trace(
visitor); | 927 RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession>::trace(
visitor); |
| 928 ActiveDOMObject::trace(visitor); | 928 ActiveDOMObject::trace(visitor); |
| 929 } | 929 } |
| 930 | 930 |
| 931 } // namespace blink | 931 } // namespace blink |
| OLD | NEW |