| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/mojo/services/mojo_cdm_service.h" | 5 #include "media/mojo/services/mojo_cdm_service.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 using NewSessionMojoCdmPromise = MojoCdmPromise<std::string>; | 69 using NewSessionMojoCdmPromise = MojoCdmPromise<std::string>; |
| 70 | 70 |
| 71 int MojoCdmService::next_cdm_id_ = CdmContext::kInvalidCdmId + 1; | 71 int MojoCdmService::next_cdm_id_ = CdmContext::kInvalidCdmId + 1; |
| 72 | 72 |
| 73 // static | 73 // static |
| 74 scoped_refptr<MediaKeys> MojoCdmService::GetCdm(int cdm_id) { | 74 scoped_refptr<MediaKeys> MojoCdmService::GetCdm(int cdm_id) { |
| 75 DVLOG(1) << __FUNCTION__ << ": " << cdm_id; | 75 DVLOG(1) << __FUNCTION__ << ": " << cdm_id; |
| 76 return g_cdm_manager.Get().GetCdm(cdm_id); | 76 return g_cdm_manager.Get().GetCdm(cdm_id); |
| 77 } | 77 } |
| 78 | 78 |
| 79 MojoCdmService::MojoCdmService( | 79 MojoCdmService::MojoCdmService(base::WeakPtr<MojoCdmServiceContext> context, |
| 80 base::WeakPtr<MojoCdmServiceContext> context, | 80 CdmFactory* cdm_factory) |
| 81 mojo::ServiceProvider* service_provider, | 81 : context_(context), |
| 82 CdmFactory* cdm_factory, | |
| 83 mojo::InterfaceRequest<interfaces::ContentDecryptionModule> request) | |
| 84 : binding_(this, request.Pass()), | |
| 85 context_(context), | |
| 86 service_provider_(service_provider), | |
| 87 cdm_factory_(cdm_factory), | 82 cdm_factory_(cdm_factory), |
| 88 cdm_id_(CdmContext::kInvalidCdmId), | 83 cdm_id_(CdmContext::kInvalidCdmId), |
| 89 weak_factory_(this) { | 84 weak_factory_(this) { |
| 90 DCHECK(context_); | 85 DCHECK(context_); |
| 91 DCHECK(cdm_factory_); | 86 DCHECK(cdm_factory_); |
| 92 } | 87 } |
| 93 | 88 |
| 94 MojoCdmService::~MojoCdmService() { | 89 MojoCdmService::~MojoCdmService() { |
| 95 g_cdm_manager.Get().UnregisterCdm(cdm_id_); | 90 g_cdm_manager.Get().UnregisterCdm(cdm_id_); |
| 96 | 91 |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 274 | 269 |
| 275 void MojoCdmService::OnDecryptorConnectionError() { | 270 void MojoCdmService::OnDecryptorConnectionError() { |
| 276 DVLOG(2) << __FUNCTION__; | 271 DVLOG(2) << __FUNCTION__; |
| 277 | 272 |
| 278 // MojoDecryptorService has lost connectivity to it's client, so it can be | 273 // MojoDecryptorService has lost connectivity to it's client, so it can be |
| 279 // freed. | 274 // freed. |
| 280 decryptor_.reset(); | 275 decryptor_.reset(); |
| 281 } | 276 } |
| 282 | 277 |
| 283 } // namespace media | 278 } // namespace media |
| OLD | NEW |