Index: Source/modules/encryptedmedia/MediaKeys.cpp |
diff --git a/Source/modules/encryptedmedia/MediaKeys.cpp b/Source/modules/encryptedmedia/MediaKeys.cpp |
index 285c58ac43759816a82d9feee78e1ae6a207b0e1..5daedaeadb64c378fa8570938640f619f688e7d0 100644 |
--- a/Source/modules/encryptedmedia/MediaKeys.cpp |
+++ b/Source/modules/encryptedmedia/MediaKeys.cpp |
@@ -78,10 +78,11 @@ MediaKeys::MediaKeys(const String& keySystem, PassOwnPtr<ContentDecryptionModule |
MediaKeys::~MediaKeys() |
{ |
+ // FIXME: This reference is outdated. |
ddorwin
2014/01/07 02:41:55
Yeah, we should not call release() here. WebCDM sh
xhwang
2014/01/09 01:04:41
Done.
|
// From <http://dvcs.w3.org/hg/html-media/raw-file/default/encrypted-media/encrypted-media.html#dom-media-keys-constructor>: |
- // When destroying a MediaKeys object, follow the steps in close(). |
+ // When destroying a MediaKeys object, follow the steps in release(). |
for (size_t i = 0; i < m_sessions.size(); ++i) |
- m_sessions[i]->close(); |
+ m_sessions[i]->release(); |
} |
PassRefPtr<MediaKeySession> MediaKeys::createSession(ExecutionContext* context, const String& type, Uint8Array* initData, ExceptionState& exceptionState) |
@@ -90,35 +91,34 @@ PassRefPtr<MediaKeySession> MediaKeys::createSession(ExecutionContext* context, |
// The createSession(type, initData) method must run the following steps: |
// Note: The contents of initData are container-specific Initialization Data. |
- // 1. If type is null or an empty string and initData is not null or an empty string, throw an |
+ // If type is null or an empty string and initData is not null or an empty string, throw an |
ddorwin
2014/01/07 02:41:55
Can type be null?
The parameters are no longer opt
xhwang
2014/01/09 01:04:41
This change will be non-tribial. Added FIXME.
ddorwin
2014/01/25 01:49:36
This is now enforced by steps in the spec: https:/
|
// InvalidAccessError exception and abort these steps. |
if ((type.isEmpty()) && (!initData || initData->length())) { |
exceptionState.throwUninformativeAndGenericDOMException(InvalidAccessError); |
return 0; |
} |
- // 2. If type contains a MIME type that is not supported or is not supported by the keySystem, throw |
- // a NotSupportedError exception and abort these steps. |
+ // 1. If type contains a MIME type that is not supported or is not supported by the keySystem, |
+ // throw a NOT_SUPPORTED_ERR exception and abort these steps. |
ASSERT(!type.isEmpty()); |
if (type.isEmpty() || !m_cdm->supportsMIMEType(type)) { |
exceptionState.throwUninformativeAndGenericDOMException(NotSupportedError); |
return 0; |
} |
- // 3. Create a new MediaKeySession object. |
+ // 2. Create a new MediaKeySession object. |
RefPtr<MediaKeySession> session = MediaKeySession::create(context, m_cdm.get(), this); |
- // 3.1 Let the keySystem attribute be keySystem. |
+ // 2.1 Let the keySystem attribute be keySystem. |
ASSERT(!session->keySystem().isEmpty()); |
- // 3.2 Let the sessionId attribute be a unique Session ID string. It may be generated by cdm. |
- // This is handled by m_cdm and may happen asynchronously. |
+ // FIXME: 2.2 Let the state of the session be CREATED. |
- // 4. Add the new object to an internal list of session objects. |
+ // 3. Add the new object to an internal list of session objects. |
m_sessions.append(session); |
- // 5. Schedule a task to generate a key request, providing type, initData, and the new object. |
- session->generateKeyRequest(type, initData); |
+ // 4. Schedule a task to initialize the session, providing type, initData, and the new object. |
ddorwin
2014/01/07 02:41:55
Hmm, so I even used "initialize" in the spec... (I
xhwang
2014/01/09 01:04:41
Yeah, this is how I come up with this word in the
|
+ session->initialize(type, initData); |
ddorwin
2014/01/07 02:41:55
If we are going to keep the asynchronicity in Blin
xhwang
2014/01/09 01:04:41
Added FIXME.
|
- // 6. Return the new object to the caller. |
+ // 5. Return the new object to the caller. |
return session; |
} |