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