Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: content/renderer/media/webcontentdecryptionmodulesession_impl.cc

Issue 651113002: Move CdmResultPromise to media/blink. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/renderer/media/webcontentdecryptionmodule_impl.cc ('k') | media/blink/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/media/webcontentdecryptionmodulesession_impl.cc
diff --git a/content/renderer/media/webcontentdecryptionmodulesession_impl.cc b/content/renderer/media/webcontentdecryptionmodulesession_impl.cc
index 41f2d6cdfa3102a6d03964cf6e934dbc52de6f1a..d9bb455254f9ac02d935511dc32d6a6053ad7645 100644
--- a/content/renderer/media/webcontentdecryptionmodulesession_impl.cc
+++ b/content/renderer/media/webcontentdecryptionmodulesession_impl.cc
@@ -9,9 +9,11 @@
#include "base/logging.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
-#include "content/renderer/media/cdm_result_promise.h"
#include "content/renderer/media/cdm_session_adapter.h"
#include "media/base/cdm_promise.h"
+#include "media/base/media_keys.h"
+#include "media/blink/cdm_result_promise.h"
+#include "media/blink/new_session_cdm_result_promise.h"
#include "third_party/WebKit/public/platform/WebURL.h"
namespace content {
@@ -91,12 +93,13 @@ void WebContentDecryptionModuleSessionImpl::initializeNewSession(
init_data,
init_data_length,
media::MediaKeys::TEMPORARY_SESSION,
- scoped_ptr<media::NewSessionCdmPromise>(new NewSessionCdmResultPromise(
- result,
- adapter_->GetKeySystemUMAPrefix() + kCreateSessionUMAName,
- base::Bind(
- &WebContentDecryptionModuleSessionImpl::OnSessionInitialized,
- base::Unretained(this)))));
+ scoped_ptr<media::NewSessionCdmPromise>(
+ new media::NewSessionCdmResultPromise(
+ result,
+ adapter_->GetKeySystemUMAPrefix() + kCreateSessionUMAName,
+ base::Bind(
+ &WebContentDecryptionModuleSessionImpl::OnSessionInitialized,
+ base::Unretained(this)))));
}
void WebContentDecryptionModuleSessionImpl::load(
@@ -107,12 +110,13 @@ void WebContentDecryptionModuleSessionImpl::load(
adapter_->LoadSession(
base::UTF16ToASCII(session_id),
- scoped_ptr<media::NewSessionCdmPromise>(new NewSessionCdmResultPromise(
- result,
- adapter_->GetKeySystemUMAPrefix() + kLoadSessionUMAName,
- base::Bind(
- &WebContentDecryptionModuleSessionImpl::OnSessionInitialized,
- base::Unretained(this)))));
+ scoped_ptr<media::NewSessionCdmPromise>(
+ new media::NewSessionCdmResultPromise(
+ result,
+ adapter_->GetKeySystemUMAPrefix() + kLoadSessionUMAName,
+ base::Bind(
+ &WebContentDecryptionModuleSessionImpl::OnSessionInitialized,
+ base::Unretained(this)))));
}
void WebContentDecryptionModuleSessionImpl::update(
@@ -121,27 +125,30 @@ void WebContentDecryptionModuleSessionImpl::update(
blink::WebContentDecryptionModuleResult result) {
DCHECK(response);
DCHECK(!web_session_id_.empty());
- adapter_->UpdateSession(web_session_id_,
- response,
- response_length,
- scoped_ptr<media::SimpleCdmPromise>(
- new CdmResultPromise<>(result, std::string())));
+ adapter_->UpdateSession(
+ web_session_id_,
+ response,
+ response_length,
+ scoped_ptr<media::SimpleCdmPromise>(
+ new media::CdmResultPromise<>(result, std::string())));
}
void WebContentDecryptionModuleSessionImpl::close(
blink::WebContentDecryptionModuleResult result) {
DCHECK(!web_session_id_.empty());
- adapter_->CloseSession(web_session_id_,
- scoped_ptr<media::SimpleCdmPromise>(
- new CdmResultPromise<>(result, std::string())));
+ adapter_->CloseSession(
+ web_session_id_,
+ scoped_ptr<media::SimpleCdmPromise>(
+ new media::CdmResultPromise<>(result, std::string())));
}
void WebContentDecryptionModuleSessionImpl::remove(
blink::WebContentDecryptionModuleResult result) {
DCHECK(!web_session_id_.empty());
- adapter_->RemoveSession(web_session_id_,
- scoped_ptr<media::SimpleCdmPromise>(
- new CdmResultPromise<>(result, std::string())));
+ adapter_->RemoveSession(
+ web_session_id_,
+ scoped_ptr<media::SimpleCdmPromise>(
+ new media::CdmResultPromise<>(result, std::string())));
}
void WebContentDecryptionModuleSessionImpl::getUsableKeyIds(
@@ -150,7 +157,8 @@ void WebContentDecryptionModuleSessionImpl::getUsableKeyIds(
adapter_->GetUsableKeyIds(
web_session_id_,
scoped_ptr<media::KeyIdsPromise>(
- new CdmResultPromise<media::KeyIdsVector>(result, std::string())));
+ new media::CdmResultPromise<media::KeyIdsVector>(result,
+ std::string())));
}
void WebContentDecryptionModuleSessionImpl::release(
@@ -181,10 +189,11 @@ void WebContentDecryptionModuleSessionImpl::OnSessionReady() {
}
void WebContentDecryptionModuleSessionImpl::OnSessionClosed() {
- if (!is_closed_) {
- is_closed_ = true;
- client_->close();
- }
+ if (is_closed_)
+ return;
+
+ is_closed_ = true;
+ client_->close();
}
void WebContentDecryptionModuleSessionImpl::OnSessionError(
« no previous file with comments | « content/renderer/media/webcontentdecryptionmodule_impl.cc ('k') | media/blink/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698