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

Unified Diff: media/blink/webcontentdecryptionmodule_impl.cc

Issue 1070853004: media: CdmFactory creates CDM (MediaKeys) asynchronously. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use ScopedVector Created 5 years, 8 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 | « media/blink/webcontentdecryptionmodule_impl.h ('k') | media/blink/webmediaplayer_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/blink/webcontentdecryptionmodule_impl.cc
diff --git a/media/blink/webcontentdecryptionmodule_impl.cc b/media/blink/webcontentdecryptionmodule_impl.cc
index 9d6022017736d6a6c9fe5d5a9e35964aa7e892a3..7bdd9c9ee3082e929491d714fd113827bd90fb4e 100644
--- a/media/blink/webcontentdecryptionmodule_impl.cc
+++ b/media/blink/webcontentdecryptionmodule_impl.cc
@@ -62,21 +62,15 @@ void WebContentDecryptionModuleImpl::Create(
}
GURL security_origin_as_gurl(security_origin.toString());
- scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter());
- // TODO(jrummell): Pass WebContentDecryptionModuleResult (or similar) to
- // Initialize() so that more specific errors can be reported.
- if (!adapter->Initialize(cdm_factory, key_system_ascii,
- allow_distinctive_identifier,
- allow_persistent_state, security_origin_as_gurl)) {
- result.completeWithError(
- blink::WebContentDecryptionModuleExceptionNotSupportedError, 0,
- "Failed to initialize CDM.");
- return;
- }
-
- result.completeWithContentDecryptionModule(
- new WebContentDecryptionModuleImpl(adapter));
+ // CdmSessionAdapter::CreateCdm() will keep a reference to |adapter|. Then
+ // if WebContentDecryptionModuleImpl is successfully created (returned in
+ // |result|), it will keep a reference to |adapter|. Otherwise, |adapter| will
+ // be destructed.
+ scoped_refptr<CdmSessionAdapter> adapter(new CdmSessionAdapter());
+ adapter->CreateCdm(cdm_factory, key_system_ascii,
+ allow_distinctive_identifier, allow_persistent_state,
+ security_origin_as_gurl, result);
}
WebContentDecryptionModuleImpl::WebContentDecryptionModuleImpl(
« no previous file with comments | « media/blink/webcontentdecryptionmodule_impl.h ('k') | media/blink/webmediaplayer_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698