Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1713)

Unified Diff: Source/modules/encryptedmedia/MediaKeySession.h

Issue 16387015: Make unprefixed EME APIs use platform and Chromium. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: KURL.h moved Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/encryptedmedia/CDMPrivate.h ('k') | Source/modules/encryptedmedia/MediaKeySession.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/encryptedmedia/MediaKeySession.h
diff --git a/Source/modules/encryptedmedia/MediaKeySession.h b/Source/modules/encryptedmedia/MediaKeySession.h
index 04e254a5ef4592cc8cb910fc0c35f46e93f5bce5..429e4cd87b7d960c88b232d431eeb7c60b3e964a 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*);
~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;
+ // 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;
+
String m_keySystem;
- String m_sessionId;
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
« no previous file with comments | « Source/modules/encryptedmedia/CDMPrivate.h ('k') | Source/modules/encryptedmedia/MediaKeySession.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698