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..48116450a0177b880c2d63f18889a6a77be0a3a5 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_initializeNewSessionTimer(this, &MediaKeySession::initializeNewSessionTimerFired) |
| , m_addKeyTimer(this, &MediaKeySession::addKeyTimerFired) |
| { |
| ScriptWrappable::init(this); |
| @@ -56,7 +56,7 @@ MediaKeySession::MediaKeySession(ExecutionContext* context, ContentDecryptionMod |
| MediaKeySession::~MediaKeySession() |
| { |
| - close(); |
| + release(); |
|
ddorwin
2014/01/09 01:35:31
We should NOT call release(). We may, however, wan
xhwang
2014/01/09 02:32:17
Done.
|
| } |
| 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); |
|
ddorwin
2014/01/09 01:35:31
This probably doesn't make sense anymore given the
xhwang
2014/01/09 02:32:17
Done.
|
| if (m_session) |
| - m_session->close(); |
| + m_session->release(); |
| m_session.clear(); |
|
ddorwin
2014/01/09 01:35:31
I think this line and below should only be in the
xhwang
2014/01/09 02:32:17
Done.
|
| m_asyncEventQueue->cancelAllEvents(); |
| @@ -83,30 +83,22 @@ String MediaKeySession::sessionId() const |
| return m_session->sessionId(); |
| } |
| -void MediaKeySession::generateKeyRequest(const String& mimeType, Uint8Array* initData) |
| +void MediaKeySession::initializeNewSession(const String& mimeType, Uint8Array* initData) |
| { |
| - m_pendingKeyRequests.append(PendingKeyRequest(mimeType, initData)); |
| - // FIXME: Eliminate timers. Asynchronicity will be handled in Chromium. |
| - m_keyRequestTimer.startOneShot(0); |
| + m_pendingInitializeNewSessionData.append(InitializeNewSessionData(mimeType, initData)); |
| + m_initializeNewSessionTimer.startOneShot(0); |
| } |
| -void MediaKeySession::keyRequestTimerFired(Timer<MediaKeySession>*) |
| +void MediaKeySession::initializeNewSessionTimerFired(Timer<MediaKeySession>*) |
| { |
| - ASSERT(m_pendingKeyRequests.size()); |
| + ASSERT(m_pendingInitializeNewSessionData.size()); |
| if (!m_session) |
| return; |
|
ddorwin
2014/01/09 01:35:31
It might be worth noting why this can happen (rele
xhwang
2014/01/09 02:32:17
Now we remove m_session.clear() to the dtor, so we
|
| - 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); |
| + while (!m_pendingInitializeNewSessionData.isEmpty()) { |
| + InitializeNewSessionData data = m_pendingInitializeNewSessionData.takeFirst(); |
| + // FIXME: Refer to the spec to see what needs to be done in blink. |
| + m_session->initializeNewSession(data.mimeType, *data.initData); |
| } |
| } |