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

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

Issue 132823005: Schedule session initialization in MediaKeys. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@rename_close_gkr
Patch Set: drop Default=Undefined Created 6 years, 11 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/MediaKeys.h
diff --git a/Source/modules/encryptedmedia/MediaKeys.h b/Source/modules/encryptedmedia/MediaKeys.h
index 96700140ec3bbd2bdeaa77ee6718f4aa8926d41d..640c24865fadd50b9343aa4ebc2f50c31c2c1e35 100644
--- a/Source/modules/encryptedmedia/MediaKeys.h
+++ b/Source/modules/encryptedmedia/MediaKeys.h
@@ -28,6 +28,9 @@
#include "bindings/v8/ScriptWrappable.h"
#include "core/events/EventTarget.h"
+#include "modules/encryptedmedia/MediaKeySession.h"
+#include "platform/Timer.h"
+#include "wtf/Deque.h"
#include "wtf/OwnPtr.h"
#include "wtf/PassRefPtr.h"
#include "wtf/RefCounted.h"
@@ -42,7 +45,6 @@ class WebContentDecryptionModule;
namespace WebCore {
class ContentDecryptionModule;
-class MediaKeySession;
class HTMLMediaElement;
class ExceptionState;
@@ -55,7 +57,7 @@ public:
static PassRefPtr<MediaKeys> create(const String& keySystem, ExceptionState&);
~MediaKeys();
- PassRefPtr<MediaKeySession> createSession(ExecutionContext*, const String& mimeType, Uint8Array* initData, ExceptionState&);
+ PassRefPtr<MediaKeySession> createSession(ExecutionContext*, const String& contentType, Uint8Array* initData, ExceptionState&);
const String& keySystem() const { return m_keySystem; }
@@ -65,12 +67,26 @@ public:
protected:
MediaKeys(const String& keySystem, PassOwnPtr<ContentDecryptionModule>);
+ void initializeNewSessionTimerFired(Timer<MediaKeys>*);
Vector<RefPtr<MediaKeySession> > m_sessions;
HTMLMediaElement* m_mediaElement;
const String m_keySystem;
OwnPtr<ContentDecryptionModule> m_cdm;
+
+ // FIXME: Check whether |initData| can be changed by JS. Maybe we should not pass it as a pointer.
+ struct InitializeNewSessionData {
+ InitializeNewSessionData(PassRefPtr<MediaKeySession> session, const String& contentType, PassRefPtr<Uint8Array> initData)
+ : session(session)
+ , contentType(contentType)
+ , initData(initData) { }
+ RefPtr<MediaKeySession> session;
+ String contentType;
+ RefPtr<Uint8Array> initData;
+ };
+ Deque<InitializeNewSessionData> m_pendingInitializeNewSessionData;
+ Timer<MediaKeys> m_initializeNewSessionTimer;
};
}

Powered by Google App Engine
This is Rietveld 408576698