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

Unified Diff: media/mojo/services/mojo_cdm_service.cc

Issue 1230313010: media: Add ServiceFactory mojo interface and implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase only Created 5 years, 5 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/mojo/services/mojo_cdm_service.h ('k') | media/mojo/services/mojo_cdm_service_context.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/mojo/services/mojo_cdm_service.cc
diff --git a/media/mojo/services/mojo_cdm_service.cc b/media/mojo/services/mojo_cdm_service.cc
index 6557aeca126183db3e3fdb2a5552f2c25f2a79ca..1d614c5792012d6c2f3ad2d05ba451769ab42dfd 100644
--- a/media/mojo/services/mojo_cdm_service.cc
+++ b/media/mojo/services/mojo_cdm_service.cc
@@ -21,7 +21,7 @@ using NewSessionMojoCdmPromise = MojoCdmPromise<std::string>;
using SimpleMojoCdmPromise = MojoCdmPromise<>;
MojoCdmService::MojoCdmService(
- MojoCdmServiceContext* context,
+ base::WeakPtr<MojoCdmServiceContext> context,
mojo::ServiceProvider* service_provider,
CdmFactory* cdm_factory,
mojo::InterfaceRequest<interfaces::ContentDecryptionModule> request)
@@ -36,7 +36,7 @@ MojoCdmService::MojoCdmService(
}
MojoCdmService::~MojoCdmService() {
- if (cdm_id_ != CdmContext::kInvalidCdmId)
+ if (cdm_id_ != CdmContext::kInvalidCdmId && context_)
context_->UnregisterCdm(cdm_id_);
}
@@ -142,7 +142,7 @@ void MojoCdmService::OnCdmCreated(int cdm_id,
const std::string& error_message) {
// TODO(xhwang): This should not happen when KeySystemInfo is properly
// populated. See http://crbug.com/469366
- if (!cdm) {
+ if (!cdm || !context_) {
promise->reject(MediaKeys::NOT_SUPPORTED_ERROR, 0, error_message);
return;
}
« no previous file with comments | « media/mojo/services/mojo_cdm_service.h ('k') | media/mojo/services/mojo_cdm_service_context.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698