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

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: 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
Index: Source/modules/encryptedmedia/MediaKeySession.h
diff --git a/Source/modules/encryptedmedia/MediaKeySession.h b/Source/modules/encryptedmedia/MediaKeySession.h
index 04e254a5ef4592cc8cb910fc0c35f46e93f5bce5..93258f55b394addf25d1c17c0346c3e65850d9ad 100644
--- a/Source/modules/encryptedmedia/MediaKeySession.h
+++ b/Source/modules/encryptedmedia/MediaKeySession.h
@@ -33,6 +33,7 @@
#include "core/dom/EventTarget.h"
#include "core/dom/ExceptionCode.h"
#include "core/platform/Timer.h"
+#include "core/platform/graphics/CDMSession.h"
#include "wtf/Deque.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
@@ -44,21 +45,25 @@ namespace WebCore {
class GenericEventQueue;
class MediaKeyError;
class MediaKeys;
+class CDM;
class CDMSession;
-class MediaKeySession : public RefCounted<MediaKeySession>, public ScriptWrappable, public EventTarget, public ContextDestructionObserver {
+// References are held by JS and MediaKeys.
+// Because this object controls the lifetime of the CDMSession, it may outlive
+// any references to it as long as the MediaKeys object is alive.
+// The CDMSession has the same lifetime as this object.
+class MediaKeySession
+ : public RefCounted<MediaKeySession>, public ScriptWrappable, public EventTarget, public ContextDestructionObserver
+ , private CDMSessionClient {
public:
- static PassRefPtr<MediaKeySession> create(ScriptExecutionContext*, MediaKeys*, const String& keySystem);
+ static PassRefPtr<MediaKeySession> create(ScriptExecutionContext*, CDM&, 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; }
+ PassRefPtr<MediaKeyError> error() const;
ddorwin 2013/06/06 23:29:50 abarth: Which way should we prefer? I changed this
abarth-chromium 2013/06/07 00:08:23 Do you mean between returning a MediaKeyError* and
ddorwin 2013/06/10 22:52:34 Done. Should we change HTMLMediaElement too?
void generateKeyRequest(const String& mimeType, Uint8Array* initData);
void update(Uint8Array* key, ExceptionCode&);
@@ -76,17 +81,22 @@ public:
virtual const AtomicString& interfaceName() const OVERRIDE;
virtual ScriptExecutionContext* scriptExecutionContext() const OVERRIDE;
-protected:
- MediaKeySession(ScriptExecutionContext*, MediaKeys*, const String& keySystem);
+private:
+ MediaKeySession(ScriptExecutionContext*, CDM&, MediaKeys*);
void keyRequestTimerFired(Timer<MediaKeySession>*);
void addKeyTimerFired(Timer<MediaKeySession>*);
- MediaKeys* m_keys;
- String m_keySystem;
- String m_sessionId;
+ // CDMSessionClient
+ virtual void keyAdded() OVERRIDE;
+ virtual void keyError(MediaKeyError::Code, unsigned long systemCode) OVERRIDE;
+ virtual void keyMessage(const unsigned char* message, unsigned messageLength, const KURL& destinationURL) OVERRIDE;
+
+ const String m_keySystem;
RefPtr<MediaKeyError> m_error;
OwnPtr<GenericEventQueue> m_asyncEventQueue;
OwnPtr<CDMSession> 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) { }

Powered by Google App Engine
This is Rietveld 408576698