Chromium Code Reviews| Index: Source/modules/encryptedmedia/MediaKeySession.cpp |
| diff --git a/Source/modules/encryptedmedia/MediaKeySession.cpp b/Source/modules/encryptedmedia/MediaKeySession.cpp |
| index 0760ee356b0780ba0127f132c6ea8d9771a48813..67ac8d331b727cba6fa244e96718ed576225bdd3 100644 |
| --- a/Source/modules/encryptedmedia/MediaKeySession.cpp |
| +++ b/Source/modules/encryptedmedia/MediaKeySession.cpp |
| @@ -48,7 +48,7 @@ MediaKeySession::MediaKeySession(ExecutionContext* context, ContentDecryptionMod |
| , m_asyncEventQueue(GenericEventQueue::create(this)) |
| , m_session(cdm->createSession(this)) |
| , m_keys(keys) |
| - , m_keyRequestTimer(this, &MediaKeySession::keyRequestTimerFired) |
| + , m_initializeTimer(this, &MediaKeySession::initializationTimerFired) |
| , m_addKeyTimer(this, &MediaKeySession::addKeyTimerFired) |
| { |
| ScriptWrappable::init(this); |
| @@ -56,7 +56,7 @@ MediaKeySession::MediaKeySession(ExecutionContext* context, ContentDecryptionMod |
| MediaKeySession::~MediaKeySession() |
| { |
| - close(); |
| + release(); |
| } |
| void MediaKeySession::setError(MediaKeyError* error) |
| @@ -64,12 +64,12 @@ void MediaKeySession::setError(MediaKeyError* error) |
| m_error = error; |
| } |
| -void MediaKeySession::close() |
| +void MediaKeySession::release() |
| { |
| ASSERT(!m_keys == !m_session); |
| if (m_session) |
| - m_session->close(); |
| + m_session->release(); |
| m_session.clear(); |
| m_asyncEventQueue->cancelAllEvents(); |
| @@ -83,31 +83,35 @@ String MediaKeySession::sessionId() const |
| return m_session->sessionId(); |
| } |
| -void MediaKeySession::generateKeyRequest(const String& mimeType, Uint8Array* initData) |
| +void MediaKeySession::initialize(const String& mimeType, Uint8Array* initData) |
| { |
| - m_pendingKeyRequests.append(PendingKeyRequest(mimeType, initData)); |
| + m_pendingMimeType = mimeType; |
| + m_pendingInitData = initData; |
| // FIXME: Eliminate timers. Asynchronicity will be handled in Chromium. |
| - m_keyRequestTimer.startOneShot(0); |
| + m_initializeTimer.startOneShot(0); |
| } |
| -void MediaKeySession::keyRequestTimerFired(Timer<MediaKeySession>*) |
| +void MediaKeySession::initializationTimerFired(Timer<MediaKeySession>*) |
| { |
| - ASSERT(m_pendingKeyRequests.size()); |
| + ASSERT(!m_pendingMimeType.isEmpty()); |
| if (!m_session) |
| return; |
| - while (!m_pendingKeyRequests.isEmpty()) { |
| - PendingKeyRequest request = m_pendingKeyRequests.takeFirst(); |
| - |
| - // NOTE: Continued from step 5 in MediaKeys::createSession(). |
| - // The user agent will asynchronously execute the following steps in the task: |
| - |
| - // 1. Let cdm be the cdm loaded in the MediaKeys constructor. |
| - // 2. Let destinationURL be null. |
| - |
| - // 3. Use cdm to generate a key request and follow the steps for the first matching condition from the following list: |
| - m_session->generateKeyRequest(request.mimeType, *request.initData); |
| - } |
| + // NOTE: Continued from step 4 in MediaKeys::createSession(). |
| + // The user agent will asynchronously execute the following steps in the task: |
| + |
| + // 1. Let request be null. |
| + // 2. Let defaultURL be null. |
| + // 3. Wait for the MediaKeys constructor task to complete. |
| + // 4. If there is a MediaKeyError stored with the MediaKeys object that occurred because of an error |
| + // during the loading the MediaKeys constructor task then queue a task to fire a simple event named |
| + // error at the MediaKeySession object and abort these steps. |
| + // 5. Let cdm be the cdm loaded in the MediaKeys constructor. |
| + // 6. Use cdm to execute the following steps: |
| + // 1. Process type and initData. |
| + // Note: type should be used to determine how to interpret initData. |
| + m_session->initialize(m_pendingMimeType, *m_pendingInitData); |
|
acolwell GONE FROM CHROMIUM
2014/01/06 20:18:37
The *m_pendingInitData doesn't look safe since the
xhwang
2014/01/09 01:04:41
Added a FIXME about checking NULL initData in Medi
|
| + m_pendingInitData.clear(); |
| } |
| void MediaKeySession::update(Uint8Array* key, ExceptionState& exceptionState) |