Commit ec6d38ea authored by jrummell's avatar jrummell Committed by Commit bot

Changing the behavior of ReleaseSession() from Close() to Remove()

With the recent EME spec changes, ReleaseSession() got replaced by
CloseSession() and RemoveSession(). Until all the changes to support
both methods are in place, calls to ReleaseSession() should call
RemoveSession() in order for existing prefixed EME applications
to continue to work.

Unprefixed Close() calls now call RemoveSession(), and thus don't do
the correct thing. This will be fixed when both CloseSession() and
RemoveSession() are passed through Pepper.

BUG=406606
TEST=All EME browser_tests pass

Review URL: https://codereview.chromium.org/497153005

Cr-Commit-Position: refs/heads/master@{#291602}
parent 6e80cfe6
...@@ -383,21 +383,21 @@ void CdmAdapter::UpdateSession(uint32_t promise_id, ...@@ -383,21 +383,21 @@ void CdmAdapter::UpdateSession(uint32_t promise_id,
response_size); response_size);
} }
void CdmAdapter::ReleaseSession(uint32_t promise_id, void CdmAdapter::CloseSession(uint32_t promise_id,
const std::string& web_session_id) { const std::string& web_session_id) {
cdm_->CloseSession( if (!cdm_->CloseSession(
promise_id, web_session_id.data(), web_session_id.length());
}
void CdmAdapter::RemoveSession(uint32_t promise_id,
const std::string& web_session_id) {
if (!cdm_->RemoveSession(
promise_id, web_session_id.data(), web_session_id.length())) { promise_id, web_session_id.data(), web_session_id.length())) {
// CDM_4 and CDM_5 don't support this method, so reject the promise. // CDM_4 and CDM_5 don't support this method, so reject the promise.
RejectPromise(promise_id, cdm::kNotSupportedError, 0, "Not implemented."); RejectPromise(promise_id, cdm::kNotSupportedError, 0, "Not implemented.");
} }
} }
void CdmAdapter::ReleaseSession(uint32_t promise_id,
const std::string& web_session_id) {
cdm_->RemoveSession(
promise_id, web_session_id.data(), web_session_id.length());
}
void CdmAdapter::GetUsableKeyIds(uint32_t promise_id, void CdmAdapter::GetUsableKeyIds(uint32_t promise_id,
const std::string& web_session_id) { const std::string& web_session_id) {
if (!cdm_->GetUsableKeyIds( if (!cdm_->GetUsableKeyIds(
......
...@@ -67,12 +67,13 @@ class CdmAdapter : public pp::Instance, ...@@ -67,12 +67,13 @@ class CdmAdapter : public pp::Instance,
virtual void UpdateSession(uint32_t promise_id, virtual void UpdateSession(uint32_t promise_id,
const std::string& web_session_id, const std::string& web_session_id,
pp::VarArrayBuffer response) OVERRIDE; pp::VarArrayBuffer response) OVERRIDE;
// TODO(jrummell): Rename to CloseSession(). // TODO(jrummell): Pass this function through Pepper and add OVERRIDE.
virtual void CloseSession(uint32_t promise_id,
const std::string& web_session_id);
// TODO(jrummell): Rename to RemoveSession().
virtual void ReleaseSession(uint32_t promise_id, virtual void ReleaseSession(uint32_t promise_id,
const std::string& web_session_id) OVERRIDE; const std::string& web_session_id) OVERRIDE;
// TODO(jrummell): Pass these 2 functions through Pepper and add OVERRIDE. // TODO(jrummell): Pass this function through Pepper and add OVERRIDE.
virtual void RemoveSession(uint32_t promise_id,
const std::string& web_session_id);
virtual void GetUsableKeyIds(uint32_t promise_id, virtual void GetUsableKeyIds(uint32_t promise_id,
const std::string& web_session_id); const std::string& web_session_id);
virtual void Decrypt( virtual void Decrypt(
......
...@@ -56,12 +56,14 @@ class CdmWrapper { ...@@ -56,12 +56,14 @@ class CdmWrapper {
uint32_t web_session_id_size, uint32_t web_session_id_size,
const uint8_t* response, const uint8_t* response,
uint32_t response_size) = 0; uint32_t response_size) = 0;
virtual void CloseSession(uint32_t promise_id, // TODO(jrummell): Remove return value when CDM4/5 are removed.
virtual bool CloseSession(uint32_t promise_id,
const char* web_session_id, const char* web_session_id,
uint32_t web_session_id_size) = 0; uint32_t web_session_id_size) = 0;
virtual bool RemoveSession(uint32_t promise_id, virtual void RemoveSession(uint32_t promise_id,
const char* web_session_id, const char* web_session_id,
uint32_t web_session_id_size) = 0; uint32_t web_session_id_size) = 0;
// TODO(jrummell): Remove return value when CDM4/5 are removed.
virtual bool GetUsableKeyIds(uint32_t promise_id, virtual bool GetUsableKeyIds(uint32_t promise_id,
const char* web_session_id, const char* web_session_id,
uint32_t web_session_id_size) = 0; uint32_t web_session_id_size) = 0;
...@@ -226,17 +228,17 @@ class CdmWrapperImpl : public CdmWrapper { ...@@ -226,17 +228,17 @@ class CdmWrapperImpl : public CdmWrapper {
return true; return true;
} }
virtual void CloseSession(uint32_t promise_id, virtual bool CloseSession(uint32_t promise_id,
const char* web_session_id, const char* web_session_id,
uint32_t web_session_id_size) OVERRIDE { uint32_t web_session_id_size) OVERRIDE {
cdm_->CloseSession(promise_id, web_session_id, web_session_id_size); cdm_->CloseSession(promise_id, web_session_id, web_session_id_size);
return true;
} }
virtual bool RemoveSession(uint32_t promise_id, virtual void RemoveSession(uint32_t promise_id,
const char* web_session_id, const char* web_session_id,
uint32_t web_session_id_size) OVERRIDE { uint32_t web_session_id_size) OVERRIDE {
cdm_->RemoveSession(promise_id, web_session_id, web_session_id_size); cdm_->RemoveSession(promise_id, web_session_id, web_session_id_size);
return true;
} }
virtual void TimerExpired(void* context) OVERRIDE { virtual void TimerExpired(void* context) OVERRIDE {
...@@ -454,22 +456,22 @@ void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::UpdateSession( ...@@ -454,22 +456,22 @@ void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::UpdateSession(
} }
template <> template <>
void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::CloseSession( bool CdmWrapperImpl<cdm::ContentDecryptionModule_4>::CloseSession(
uint32_t promise_id, uint32_t promise_id,
const char* web_session_id, const char* web_session_id,
uint32_t web_session_id_size) { uint32_t web_session_id_size) {
std::string web_session_str(web_session_id, web_session_id_size); return false;
uint32_t session_id = LookupSessionId(web_session_str);
RegisterPromise(session_id, promise_id);
cdm_->ReleaseSession(session_id);
} }
template <> template <>
bool CdmWrapperImpl<cdm::ContentDecryptionModule_4>::RemoveSession( void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::RemoveSession(
uint32_t promise_id, uint32_t promise_id,
const char* web_session_id, const char* web_session_id,
uint32_t web_session_id_size) { uint32_t web_session_id_size) {
return false; std::string web_session_str(web_session_id, web_session_id_size);
uint32_t session_id = LookupSessionId(web_session_str);
RegisterPromise(session_id, promise_id);
cdm_->ReleaseSession(session_id);
} }
template <> template <>
...@@ -572,19 +574,19 @@ void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::UpdateSession( ...@@ -572,19 +574,19 @@ void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::UpdateSession(
} }
template <> template <>
void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::CloseSession( bool CdmWrapperImpl<cdm::ContentDecryptionModule_5>::CloseSession(
uint32_t promise_id, uint32_t promise_id,
const char* web_session_id, const char* web_session_id,
uint32_t web_session_id_size) { uint32_t web_session_id_size) {
cdm_->ReleaseSession(promise_id, web_session_id, web_session_id_size); return false;
} }
template <> template <>
bool CdmWrapperImpl<cdm::ContentDecryptionModule_5>::RemoveSession( void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::RemoveSession(
uint32_t promise_id, uint32_t promise_id,
const char* web_session_id, const char* web_session_id,
uint32_t web_session_id_size) { uint32_t web_session_id_size) {
return false; cdm_->ReleaseSession(promise_id, web_session_id, web_session_id_size);
} }
template <> template <>
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment