summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Rummell <jrummell@chromium.org>2014-09-02 17:02:56 -0700
committerJohn Rummell <jrummell@chromium.org>2014-09-03 00:26:02 +0000
commitbaa7b336638b4d8e85ad86ece54b80a13a5c819c (patch)
treebad01cccfe765ea71da1d08bca837dad2f89fcae
parented161531ce079ce4a467c4ad4e47dc56c48800c2 (diff)
downloadchromium_src-baa7b336638b4d8e85ad86ece54b80a13a5c819c.zip
chromium_src-baa7b336638b4d8e85ad86ece54b80a13a5c819c.tar.gz
chromium_src-baa7b336638b4d8e85ad86ece54b80a13a5c819c.tar.bz2
Merge 291602 "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} (cherry picked from commit ec6d38eaaacd81198e1a78dec84418b54b218e55) R=xhwang@chromium.org Review URL: https://codereview.chromium.org/531313002 Cr-Commit-Position: refs/branch-heads/2125@{#192} Cr-Branched-From: b68026d94bda36dd106a3d91a098719f952a9477-refs/heads/master@{#290040}
-rw-r--r--media/cdm/ppapi/cdm_adapter.cc18
-rw-r--r--media/cdm/ppapi/cdm_adapter.h9
-rw-r--r--media/cdm/ppapi/cdm_wrapper.h34
3 files changed, 32 insertions, 29 deletions
diff --git a/media/cdm/ppapi/cdm_adapter.cc b/media/cdm/ppapi/cdm_adapter.cc
index a54ab39..2452be8 100644
--- a/media/cdm/ppapi/cdm_adapter.cc
+++ b/media/cdm/ppapi/cdm_adapter.cc
@@ -383,21 +383,21 @@ void CdmAdapter::UpdateSession(uint32_t promise_id,
response_size);
}
-void CdmAdapter::ReleaseSession(uint32_t promise_id,
- const std::string& web_session_id) {
- 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(
+void CdmAdapter::CloseSession(uint32_t promise_id,
+ const std::string& web_session_id) {
+ if (!cdm_->CloseSession(
promise_id, web_session_id.data(), web_session_id.length())) {
// CDM_4 and CDM_5 don't support this method, so reject the promise.
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,
const std::string& web_session_id) {
if (!cdm_->GetUsableKeyIds(
diff --git a/media/cdm/ppapi/cdm_adapter.h b/media/cdm/ppapi/cdm_adapter.h
index 07b5ad1..cd4738b 100644
--- a/media/cdm/ppapi/cdm_adapter.h
+++ b/media/cdm/ppapi/cdm_adapter.h
@@ -67,12 +67,13 @@ class CdmAdapter : public pp::Instance,
virtual void UpdateSession(uint32_t promise_id,
const std::string& web_session_id,
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,
const std::string& web_session_id) OVERRIDE;
- // TODO(jrummell): Pass these 2 functions through Pepper and add OVERRIDE.
- virtual void RemoveSession(uint32_t promise_id,
- const std::string& web_session_id);
+ // TODO(jrummell): Pass this function through Pepper and add OVERRIDE.
virtual void GetUsableKeyIds(uint32_t promise_id,
const std::string& web_session_id);
virtual void Decrypt(
diff --git a/media/cdm/ppapi/cdm_wrapper.h b/media/cdm/ppapi/cdm_wrapper.h
index 72afa90..f11672c 100644
--- a/media/cdm/ppapi/cdm_wrapper.h
+++ b/media/cdm/ppapi/cdm_wrapper.h
@@ -56,12 +56,14 @@ class CdmWrapper {
uint32_t web_session_id_size,
const uint8_t* response,
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,
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,
uint32_t web_session_id_size) = 0;
+ // TODO(jrummell): Remove return value when CDM4/5 are removed.
virtual bool GetUsableKeyIds(uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) = 0;
@@ -226,17 +228,17 @@ class CdmWrapperImpl : public CdmWrapper {
return true;
}
- virtual void CloseSession(uint32_t promise_id,
+ virtual bool CloseSession(uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) OVERRIDE {
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,
uint32_t web_session_id_size) OVERRIDE {
cdm_->RemoveSession(promise_id, web_session_id, web_session_id_size);
- return true;
}
virtual void TimerExpired(void* context) OVERRIDE {
@@ -454,22 +456,22 @@ void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::UpdateSession(
}
template <>
-void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::CloseSession(
+bool CdmWrapperImpl<cdm::ContentDecryptionModule_4>::CloseSession(
uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) {
- 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);
+ return false;
}
template <>
-bool CdmWrapperImpl<cdm::ContentDecryptionModule_4>::RemoveSession(
+void CdmWrapperImpl<cdm::ContentDecryptionModule_4>::RemoveSession(
uint32_t promise_id,
const char* web_session_id,
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 <>
@@ -572,19 +574,19 @@ void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::UpdateSession(
}
template <>
-void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::CloseSession(
+bool CdmWrapperImpl<cdm::ContentDecryptionModule_5>::CloseSession(
uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) {
- cdm_->ReleaseSession(promise_id, web_session_id, web_session_id_size);
+ return false;
}
template <>
-bool CdmWrapperImpl<cdm::ContentDecryptionModule_5>::RemoveSession(
+void CdmWrapperImpl<cdm::ContentDecryptionModule_5>::RemoveSession(
uint32_t promise_id,
const char* web_session_id,
uint32_t web_session_id_size) {
- return false;
+ cdm_->ReleaseSession(promise_id, web_session_id, web_session_id_size);
}
template <>