| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 g_cdm_manager.Get().RegisterCdm(cdm_id_, cdm); | 198 g_cdm_manager.Get().RegisterCdm(cdm_id_, cdm); |
| 199 | 199 |
| 200 // If |cdm| has a decryptor, create the MojoDecryptorService | 200 // If |cdm| has a decryptor, create the MojoDecryptorService |
| 201 // and pass the connection back to the client. | 201 // and pass the connection back to the client. |
| 202 mojom::DecryptorPtr decryptor_service; | 202 mojom::DecryptorPtr decryptor_service; |
| 203 CdmContext* const cdm_context = cdm_->GetCdmContext(); | 203 CdmContext* const cdm_context = cdm_->GetCdmContext(); |
| 204 if (cdm_context && cdm_context->GetDecryptor()) { | 204 if (cdm_context && cdm_context->GetDecryptor()) { |
| 205 // MojoDecryptorService takes a reference to the CDM, but it is still owned | 205 // MojoDecryptorService takes a reference to the CDM, but it is still owned |
| 206 // by |this|. | 206 // by |this|. |
| 207 decryptor_.reset(new MojoDecryptorService( | 207 decryptor_.reset(new MojoDecryptorService( |
| 208 cdm_, GetProxy(&decryptor_service), | 208 cdm_, MakeRequest(&decryptor_service), |
| 209 base::Bind(&MojoCdmService::OnDecryptorConnectionError, weak_this_))); | 209 base::Bind(&MojoCdmService::OnDecryptorConnectionError, weak_this_))); |
| 210 } | 210 } |
| 211 | 211 |
| 212 DVLOG(1) << __func__ << ": CDM successfully created with ID " << cdm_id_; | 212 DVLOG(1) << __func__ << ": CDM successfully created with ID " << cdm_id_; |
| 213 cdm_promise_result->success = true; | 213 cdm_promise_result->success = true; |
| 214 callback.Run(std::move(cdm_promise_result), cdm_id_, | 214 callback.Run(std::move(cdm_promise_result), cdm_id_, |
| 215 std::move(decryptor_service)); | 215 std::move(decryptor_service)); |
| 216 } | 216 } |
| 217 | 217 |
| 218 void MojoCdmService::OnSessionMessage( | 218 void MojoCdmService::OnSessionMessage( |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 250 |
| 251 void MojoCdmService::OnDecryptorConnectionError() { | 251 void MojoCdmService::OnDecryptorConnectionError() { |
| 252 DVLOG(2) << __func__; | 252 DVLOG(2) << __func__; |
| 253 | 253 |
| 254 // MojoDecryptorService has lost connectivity to it's client, so it can be | 254 // MojoDecryptorService has lost connectivity to it's client, so it can be |
| 255 // freed. | 255 // freed. |
| 256 decryptor_.reset(); | 256 decryptor_.reset(); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace media | 259 } // namespace media |
| OLD | NEW |