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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 double expiration() const { return m_expiration; } | 81 double expiration() const { return m_expiration; } |
82 ScriptPromise closed(ScriptState*); | 82 ScriptPromise closed(ScriptState*); |
83 MediaKeyStatusMap* keyStatuses(); | 83 MediaKeyStatusMap* keyStatuses(); |
84 DEFINE_ATTRIBUTE_EVENT_LISTENER(keystatuseschange); | 84 DEFINE_ATTRIBUTE_EVENT_LISTENER(keystatuseschange); |
85 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); | 85 DEFINE_ATTRIBUTE_EVENT_LISTENER(message); |
86 | 86 |
87 ScriptPromise generateRequest(ScriptState*, | 87 ScriptPromise generateRequest(ScriptState*, |
88 const String& initDataType, | 88 const String& initDataType, |
89 const DOMArrayPiece& initData); | 89 const DOMArrayPiece& initData); |
90 ScriptPromise load(ScriptState*, const String& sessionId); | 90 ScriptPromise load(ScriptState*, const String& sessionId); |
91 | |
92 ScriptPromise update(ScriptState*, const DOMArrayPiece& response); | 91 ScriptPromise update(ScriptState*, const DOMArrayPiece& response); |
93 ScriptPromise close(ScriptState*); | 92 ScriptPromise close(ScriptState*); |
94 ScriptPromise remove(ScriptState*); | 93 ScriptPromise remove(ScriptState*); |
95 | 94 |
96 // EventTarget | 95 // EventTarget |
97 const AtomicString& interfaceName() const override; | 96 const AtomicString& interfaceName() const override; |
98 ExecutionContext* getExecutionContext() const override; | 97 ExecutionContext* getExecutionContext() const override; |
99 | 98 |
100 // ScriptWrappable | 99 // ScriptWrappable |
101 bool hasPendingActivity() const final; | 100 bool hasPendingActivity() const final; |
102 | 101 |
103 // ActiveDOMObject | 102 // ActiveDOMObject |
104 void contextDestroyed() override; | 103 void contextDestroyed() override; |
105 | 104 |
106 DECLARE_VIRTUAL_TRACE(); | 105 DECLARE_VIRTUAL_TRACE(); |
107 | 106 |
108 private: | 107 private: |
109 class PendingAction; | 108 class PendingAction; |
110 friend class NewSessionResultPromise; | 109 friend class NewSessionResultPromise; |
111 friend class LoadSessionResultPromise; | 110 friend class LoadSessionResultPromise; |
112 | 111 |
113 MediaKeySession(ScriptState*, MediaKeys*, WebEncryptedMediaSessionType); | 112 MediaKeySession(ScriptState*, MediaKeys*, WebEncryptedMediaSessionType); |
114 void dispose(); | 113 void dispose(); |
115 | 114 |
116 void actionTimerFired(TimerBase*); | 115 void actionTimerFired(TimerBase*); |
117 | 116 |
| 117 // The following perform the asynchronous part of the command referenced. |
| 118 void generateRequestTask(ContentDecryptionModuleResult*, |
| 119 WebEncryptedMediaInitDataType, |
| 120 DOMArrayBuffer* initDataBuffer); |
| 121 void finishGenerateRequest(); |
| 122 void loadTask(ContentDecryptionModuleResult*, const String& sessionId); |
| 123 void finishLoad(); |
| 124 void updateTask(ContentDecryptionModuleResult*, |
| 125 DOMArrayBuffer* sanitizedResponse); |
| 126 void closeTask(ContentDecryptionModuleResult*); |
| 127 void removeTask(ContentDecryptionModuleResult*); |
| 128 |
118 // WebContentDecryptionModuleSession::Client | 129 // WebContentDecryptionModuleSession::Client |
119 void message(MessageType, | 130 void message(MessageType, |
120 const unsigned char* message, | 131 const unsigned char* message, |
121 size_t messageLength) override; | 132 size_t messageLength) override; |
122 void close() override; | 133 void close() override; |
123 void expirationChanged(double updatedExpiryTimeInMS) override; | 134 void expirationChanged(double updatedExpiryTimeInMS) override; |
124 void keysStatusesChange(const WebVector<WebEncryptedMediaKeyInformation>&, | 135 void keysStatusesChange(const WebVector<WebEncryptedMediaKeyInformation>&, |
125 bool hasAdditionalUsableKey) override; | 136 bool hasAdditionalUsableKey) override; |
126 | 137 |
127 // Called by NewSessionResult when the new session has been created. | |
128 void finishGenerateRequest(); | |
129 | |
130 // Called by LoadSessionResult when the session has been loaded. | |
131 void finishLoad(); | |
132 | |
133 Member<GenericEventQueue> m_asyncEventQueue; | 138 Member<GenericEventQueue> m_asyncEventQueue; |
134 std::unique_ptr<WebContentDecryptionModuleSession> m_session; | 139 std::unique_ptr<WebContentDecryptionModuleSession> m_session; |
135 | 140 |
136 // Used to determine if MediaKeys is still active. | 141 // Used to determine if MediaKeys is still active. |
137 WeakMember<MediaKeys> m_mediaKeys; | 142 WeakMember<MediaKeys> m_mediaKeys; |
138 | 143 |
139 // Session properties. | 144 // Session properties. |
140 WebEncryptedMediaSessionType m_sessionType; | 145 WebEncryptedMediaSessionType m_sessionType; |
141 double m_expiration; | 146 double m_expiration; |
142 Member<MediaKeyStatusMap> m_keyStatusesMap; | 147 Member<MediaKeyStatusMap> m_keyStatusesMap; |
(...skipping 10 matching lines...) Expand all Loading... |
153 ClosedPromise; | 158 ClosedPromise; |
154 Member<ClosedPromise> m_closedPromise; | 159 Member<ClosedPromise> m_closedPromise; |
155 | 160 |
156 HeapDeque<Member<PendingAction>> m_pendingActions; | 161 HeapDeque<Member<PendingAction>> m_pendingActions; |
157 Timer<MediaKeySession> m_actionTimer; | 162 Timer<MediaKeySession> m_actionTimer; |
158 }; | 163 }; |
159 | 164 |
160 } // namespace blink | 165 } // namespace blink |
161 | 166 |
162 #endif // MediaKeySession_h | 167 #endif // MediaKeySession_h |
OLD | NEW |