: public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<MediaKeySession>, public ActiveDOMObject, public EventTargetWithInlineData
, private WebContentDecryptionModuleSession::Client {
DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<MediaKeySession>);
+ DEFINE_WRAPPERTYPEINFO();
WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaKeySession);
public:
- static ScriptPromise create(ScriptState*, MediaKeys*, const String& initDataType, PassRefPtr<ArrayBuffer> initData, const String& sessionType);
+ static MediaKeySession* create(ScriptState*, MediaKeys*, const String& sessionType);
virtual ~MediaKeySession();
const String& keySystem() const { return m_keySystem; }
String sessionId() const;
ScriptPromise closed(ScriptState*);
+ ScriptPromise generateRequest(ScriptState*, const String& initDataType, ArrayBuffer* initData);
+ ScriptPromise generateRequest(ScriptState*, const String& initDataType, ArrayBufferView* initData);
+
void setError(MediaKeyError*);
MediaKeyError* error() { return m_error.get(); }
private:
class PendingAction;
- friend class MediaKeySessionInitializer;
+ friend class NewSessionResult;
+
+ MediaKeySession(ScriptState*, MediaKeys*, const String& sessionType);
- MediaKeySession(ExecutionContext*, MediaKeys*, PassOwnPtr<WebContentDecryptionModuleSession>);
void actionTimerFired(Timer<MediaKeySession>*);
// WebContentDecryptionModuleSession::Client
virtual void error(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE;
virtual void error(WebContentDecryptionModuleException, unsigned long systemCode, const WebString& errorMessage) OVERRIDE;
+ ScriptPromise generateRequestInternal(ScriptState*, const String& initDataType, PassRefPtr<ArrayBuffer> initData);
ScriptPromise updateInternal(ScriptState*, PassRefPtr<ArrayBuffer> response);
+ // Called by NewSessionResult when the new sesison has been created.
+ void finishGenerateRequest();
+
String m_keySystem;
RefPtrWillBeMember<MediaKeyError> m_error;
OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue;
OwnPtr<WebContentDecryptionModuleSession> m_session;
// Used to determine if MediaKeys is still active.
- WeakMember<MediaKeys> m_keys;
+ WeakMember<MediaKeys> m_mediaKeys;
+
+ // Session properties.
+ String m_sessionType;
- // Is the CDM finished with this session?
- bool m_isClosed;
+ // Session states.
+ bool m_isUninitialized;
+ bool m_isCallable;
+ bool m_isClosed; // Is the CDM finished with this session?
// Keep track of the closed promise.
typedef ScriptPromiseProperty<Member<MediaKeySession>, V8UndefinedType, RefPtrWillBeMember<DOMException> > ClosedPromise;