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

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

Issue 604283003: Refactor CdmPromise and related classes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + override 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/base/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 7cd33b4c60e21d15eaf6d8bb74690be86bbd1a96..1d21a6bb524496efc949ffe39f4aac2110df249e 100644
--- a/content/renderer/media/webcontentdecryptionmodulesession_impl.cc
+++ b/content/renderer/media/webcontentdecryptionmodulesession_impl.cc
@@ -18,28 +18,6 @@ namespace content {
const char kCreateSessionUMAName[] = "CreateSession";
-typedef base::Callback<blink::WebContentDecryptionModuleResult::SessionStatus(
- const std::string& web_session_id)> SessionInitializedCB;
-
-class NewSessionCdmResultPromise : public CdmResultPromise<std::string> {
- public:
- NewSessionCdmResultPromise(blink::WebContentDecryptionModuleResult result,
- std::string uma_name,
- const SessionInitializedCB& new_session_created_cb)
- : CdmResultPromise<std::string>(result, uma_name),
- new_session_created_cb_(new_session_created_cb) {}
-
- protected:
- virtual void OnResolve(const std::string& web_session_id) OVERRIDE {
- blink::WebContentDecryptionModuleResult::SessionStatus status =
- new_session_created_cb_.Run(web_session_id);
- web_cdm_result_.completeWithSession(status);
- }
-
- private:
- SessionInitializedCB new_session_created_cb_;
-};
-
WebContentDecryptionModuleSessionImpl::WebContentDecryptionModuleSessionImpl(
const scoped_refptr<CdmSessionAdapter>& adapter)
: adapter_(adapter),
@@ -125,27 +103,27 @@ 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 SimpleCdmResultPromise(result)));
+ adapter_->UpdateSession(web_session_id_,
+ response,
+ response_length,
+ scoped_ptr<media::SimpleCdmPromise>(
+ new 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 SimpleCdmResultPromise(result)));
+ adapter_->CloseSession(web_session_id_,
+ scoped_ptr<media::SimpleCdmPromise>(
+ new 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 SimpleCdmResultPromise(result)));
+ adapter_->RemoveSession(web_session_id_,
+ scoped_ptr<media::SimpleCdmPromise>(
+ new CdmResultPromise<>(result, std::string())));
}
void WebContentDecryptionModuleSessionImpl::getUsableKeyIds(
@@ -154,7 +132,7 @@ void WebContentDecryptionModuleSessionImpl::getUsableKeyIds(
adapter_->GetUsableKeyIds(
web_session_id_,
scoped_ptr<media::KeyIdsPromise>(
- new CdmResultPromise<media::KeyIdsVector>(result)));
+ new CdmResultPromise<media::KeyIdsVector>(result, std::string())));
}
void WebContentDecryptionModuleSessionImpl::release(
« no previous file with comments | « content/renderer/media/webcontentdecryptionmodule_impl.cc ('k') | media/base/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698