| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 // | 57 // |
| 58 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, | 58 // Because this object controls the lifetime of the WebContentDecryptionModuleSe
ssion, |
| 59 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. | 59 // it may outlive any JavaScript references as long as the MediaKeys object is a
live. |
| 60 // The WebContentDecryptionModuleSession has the same lifetime as this object. | 60 // The WebContentDecryptionModuleSession has the same lifetime as this object. |
| 61 class MediaKeySession final | 61 class MediaKeySession final |
| 62 : public RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession
> | 62 : public RefCountedGarbageCollectedEventTargetWithInlineData<MediaKeySession
> |
| 63 , public ActiveDOMObject | 63 , public ActiveDOMObject |
| 64 , private WebContentDecryptionModuleSession::Client { | 64 , private WebContentDecryptionModuleSession::Client { |
| 65 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MediaKeySession); | 65 REFCOUNTED_GARBAGE_COLLECTED_EVENT_TARGET(MediaKeySession); |
| 66 DEFINE_WRAPPERTYPEINFO(); | 66 DEFINE_WRAPPERTYPEINFO(); |
| 67 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); | 67 USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession); |
| 68 public: | 68 public: |
| 69 static MediaKeySession* create(ScriptState*, MediaKeys*, WebEncryptedMediaSe
ssionType); | 69 static MediaKeySession* create(ScriptState*, MediaKeys*, WebEncryptedMediaSe
ssionType); |
| 70 ~MediaKeySession() override; | 70 ~MediaKeySession() override; |
| 71 | 71 |
| 72 String sessionId() const; | 72 String sessionId() const; |
| 73 double expiration() const { return m_expiration; } | 73 double expiration() const { return m_expiration; } |
| 74 ScriptPromise closed(ScriptState*); | 74 ScriptPromise closed(ScriptState*); |
| 75 MediaKeyStatusMap* keyStatuses(); | 75 MediaKeyStatusMap* keyStatuses(); |
| 76 | 76 |
| 77 ScriptPromise generateRequest(ScriptState*, const String& initDataType, cons
t DOMArrayPiece& initData); | 77 ScriptPromise generateRequest(ScriptState*, const String& initDataType, cons
t DOMArrayPiece& initData); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 108 void close() override; | 108 void close() override; |
| 109 void expirationChanged(double updatedExpiryTimeInMS) override; | 109 void expirationChanged(double updatedExpiryTimeInMS) override; |
| 110 void keysStatusesChange(const WebVector<WebEncryptedMediaKeyInformation>&, b
ool hasAdditionalUsableKey) override; | 110 void keysStatusesChange(const WebVector<WebEncryptedMediaKeyInformation>&, b
ool hasAdditionalUsableKey) override; |
| 111 | 111 |
| 112 // Called by NewSessionResult when the new session has been created. | 112 // Called by NewSessionResult when the new session has been created. |
| 113 void finishGenerateRequest(); | 113 void finishGenerateRequest(); |
| 114 | 114 |
| 115 // Called by LoadSessionResult when the session has been loaded. | 115 // Called by LoadSessionResult when the session has been loaded. |
| 116 void finishLoad(); | 116 void finishLoad(); |
| 117 | 117 |
| 118 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 118 Member<GenericEventQueue> m_asyncEventQueue; |
| 119 OwnPtr<WebContentDecryptionModuleSession> m_session; | 119 OwnPtr<WebContentDecryptionModuleSession> m_session; |
| 120 | 120 |
| 121 // Used to determine if MediaKeys is still active. | 121 // Used to determine if MediaKeys is still active. |
| 122 WeakMember<MediaKeys> m_mediaKeys; | 122 WeakMember<MediaKeys> m_mediaKeys; |
| 123 | 123 |
| 124 // Session properties. | 124 // Session properties. |
| 125 WebEncryptedMediaSessionType m_sessionType; | 125 WebEncryptedMediaSessionType m_sessionType; |
| 126 double m_expiration; | 126 double m_expiration; |
| 127 Member<MediaKeyStatusMap> m_keyStatusesMap; | 127 Member<MediaKeyStatusMap> m_keyStatusesMap; |
| 128 | 128 |
| 129 // Session states. | 129 // Session states. |
| 130 bool m_isUninitialized; | 130 bool m_isUninitialized; |
| 131 bool m_isCallable; | 131 bool m_isCallable; |
| 132 bool m_isClosed; // Is the CDM finished with this session? | 132 bool m_isClosed; // Is the CDM finished with this session? |
| 133 | 133 |
| 134 // Keep track of the closed promise. | 134 // Keep track of the closed promise. |
| 135 typedef ScriptPromiseProperty<Member<MediaKeySession>, ToV8UndefinedGenerato
r, Member<DOMException>> ClosedPromise; | 135 typedef ScriptPromiseProperty<Member<MediaKeySession>, ToV8UndefinedGenerato
r, Member<DOMException>> ClosedPromise; |
| 136 Member<ClosedPromise> m_closedPromise; | 136 Member<ClosedPromise> m_closedPromise; |
| 137 | 137 |
| 138 HeapDeque<Member<PendingAction>> m_pendingActions; | 138 HeapDeque<Member<PendingAction>> m_pendingActions; |
| 139 Timer<MediaKeySession> m_actionTimer; | 139 Timer<MediaKeySession> m_actionTimer; |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 } // namespace blink | 142 } // namespace blink |
| 143 | 143 |
| 144 #endif // MediaKeySession_h | 144 #endif // MediaKeySession_h |
| OLD | NEW |