Chromium Code Reviews| Index: Source/modules/encryptedmedia/MediaKeySession.h |
| diff --git a/Source/modules/encryptedmedia/MediaKeySession.h b/Source/modules/encryptedmedia/MediaKeySession.h |
| index 04e254a5ef4592cc8cb910fc0c35f46e93f5bce5..8bef7cd0e818cea32e6912d962184875e605e3b2 100644 |
| --- a/Source/modules/encryptedmedia/MediaKeySession.h |
| +++ b/Source/modules/encryptedmedia/MediaKeySession.h |
| @@ -26,13 +26,12 @@ |
| #ifndef MediaKeySession_h |
| #define MediaKeySession_h |
| -#if ENABLE(ENCRYPTED_MEDIA_V2) |
| - |
| #include "bindings/v8/ScriptWrappable.h" |
| #include "core/dom/ContextDestructionObserver.h" |
| #include "core/dom/EventTarget.h" |
| #include "core/dom/ExceptionCode.h" |
| #include "core/platform/Timer.h" |
| +#include "core/platform/graphics/ContentDecryptionModuleSession.h" |
| #include "wtf/Deque.h" |
| #include "wtf/PassRefPtr.h" |
| #include "wtf/RefCounted.h" |
| @@ -44,22 +43,26 @@ namespace WebCore { |
| class GenericEventQueue; |
| class MediaKeyError; |
| class MediaKeys; |
| -class CDMSession; |
| - |
| -class MediaKeySession : public RefCounted<MediaKeySession>, public ScriptWrappable, public EventTarget, public ContextDestructionObserver { |
| +class ContentDecryptionModule; |
| +class ContentDecryptionModuleSession; |
| + |
| +// References are held by JS and MediaKeys. |
| +// Because this object controls the lifetime of the ContentDecryptionModuleSession, |
| +// it may outlive any references to it as long as the MediaKeys object is alive. |
| +// The ContentDecryptionModuleSession has the same lifetime as this object. |
| +class MediaKeySession |
| + : public RefCounted<MediaKeySession>, public ScriptWrappable, public EventTarget, public ContextDestructionObserver |
| + , private ContentDecryptionModuleSessionClient { |
| public: |
| - static PassRefPtr<MediaKeySession> create(ScriptExecutionContext*, MediaKeys*, const String& keySystem); |
| + static PassRefPtr<MediaKeySession> create(ScriptExecutionContext*, ContentDecryptionModule&, MediaKeys*); |
|
abarth-chromium
2013/06/12 23:03:51
same nit about * versus &
ddorwin
2013/06/12 23:55:54
Done. (Same.)
|
| ~MediaKeySession(); |
| const String& keySystem() const { return m_keySystem; } |
| - const String& sessionId() const; |
| + String sessionId() const; |
| void setError(MediaKeyError*); |
| MediaKeyError* error() { return m_error.get(); } |
| - void setKeys(MediaKeys* keys) { m_keys = keys; } |
| - MediaKeys* keys() const { return m_keys; } |
| - |
| void generateKeyRequest(const String& mimeType, Uint8Array* initData); |
| void update(Uint8Array* key, ExceptionCode&); |
| void close(); |
| @@ -76,17 +79,22 @@ public: |
| virtual const AtomicString& interfaceName() const OVERRIDE; |
| virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE; |
| -protected: |
| - MediaKeySession(ScriptExecutionContext*, MediaKeys*, const String& keySystem); |
| +private: |
| + MediaKeySession(ScriptExecutionContext*, ContentDecryptionModule&, MediaKeys*); |
| void keyRequestTimerFired(Timer<MediaKeySession>*); |
| void addKeyTimerFired(Timer<MediaKeySession>*); |
| - MediaKeys* m_keys; |
| - String m_keySystem; |
| - String m_sessionId; |
| + // ContentDecryptionModuleSessionClient |
| + virtual void keyAdded() OVERRIDE; |
| + virtual void keyError(MediaKeyErrorCode, unsigned long systemCode) OVERRIDE; |
| + virtual void keyMessage(const unsigned char* message, size_t messageLength, const KURL& destinationURL) OVERRIDE; |
| + |
| + const String m_keySystem; |
|
abarth-chromium
2013/06/12 23:03:51
We typically don't use const for member variables.
ddorwin
2013/06/12 23:55:54
Done. (It was more an indication that the value is
|
| RefPtr<MediaKeyError> m_error; |
| OwnPtr<GenericEventQueue> m_asyncEventQueue; |
| - OwnPtr<CDMSession> m_session; |
| + OwnPtr<ContentDecryptionModuleSession> m_session; |
| + // Used to remove the reference from the parent MediaKeys when close()'d. |
| + MediaKeys* m_keys; |
| struct PendingKeyRequest { |
| PendingKeyRequest(const String& mimeType, Uint8Array* initData) : mimeType(mimeType), initData(initData) { } |
| @@ -111,6 +119,4 @@ private: |
| } |
| -#endif // ENABLE(ENCRYPTED_MEDIA_V2) |
| - |
| #endif // MediaKeySession_h |