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

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

Issue 543173002: Implement MediaKeySession.generateRequest() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 3 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 26237a2fd6897032a31ba14b24de281803d623bb..80c374d6c059a8ba202a2f8514241d8378ffcbdc 100644
--- a/Source/modules/encryptedmedia/MediaKeySession.h
+++ b/Source/modules/encryptedmedia/MediaKeySession.h
@@ -65,13 +65,17 @@ class MediaKeySession FINAL
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;
+ const String& sessionId() const { return m_sessionId; }
+ double expiration() const { return m_expiration; }
ddorwin 2014/09/09 00:44:36 Ideally, expiration should have been added in a se
jrummell 2014/09/09 19:55:59 Removed since it's not used. Adding expiration wil
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(); }
@@ -93,9 +97,10 @@ public:
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
@@ -105,16 +110,30 @@ private:
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;
ddorwin 2014/09/09 00:44:36 This should be removed in a separate CL. It's no l
jrummell 2014/09/09 19:55:59 Acknowledged.
RefPtrWillBeMember<MediaKeyError> m_error;
OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue;
OwnPtr<WebContentDecryptionModuleSession> m_session;
- // Used to determine if MediaKeys is still active.
+ // Used to determine if MediaKeys is still active. Until the session is
+ // initialized, keep a hard reference to MediaKeys (as it is needed during
+ // initialization). Afterwards, a weak reference is all that is needed.
ddorwin 2014/09/09 00:44:36 We discussed a different solution that didn't requ
jrummell 2014/09/09 19:55:59 Done.
+ Member<MediaKeys> m_mediaKeys;
WeakMember<MediaKeys> m_keys;
ddorwin 2014/09/09 00:44:36 Eventually, this should be m_mediaKeys - I think t
jrummell 2014/09/09 19:55:59 Done.
+ // Session properties.
+ String m_sessionId;
ddorwin 2014/09/09 00:44:36 Why is this being tracked here now?
jrummell 2014/09/09 19:55:59 m_session wasn't being created until the generateR
+ double m_expiration;
+ String m_sessionType;
+ bool m_uninitialized;
ddorwin 2014/09/09 00:44:36 m_isUn... ditto below.
jrummell 2014/09/09 19:56:00 Done.
+ bool m_callable;
+
ddorwin 2014/09/09 00:44:36 nit: Keep the states together, separate from the p
jrummell 2014/09/09 19:55:59 Done.
// Is the CDM finished with this session?
bool m_isClosed;

Powered by Google App Engine
This is Rietveld 408576698