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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 using NewSessionMojoCdmPromise = MojoCdmPromise<std::string>; | 70 using NewSessionMojoCdmPromise = MojoCdmPromise<std::string>; |
71 | 71 |
72 int MojoCdmService::next_cdm_id_ = CdmContext::kInvalidCdmId + 1; | 72 int MojoCdmService::next_cdm_id_ = CdmContext::kInvalidCdmId + 1; |
73 | 73 |
74 // static | 74 // static |
75 scoped_refptr<MediaKeys> MojoCdmService::LegacyGetCdm(int cdm_id) { | 75 scoped_refptr<MediaKeys> MojoCdmService::LegacyGetCdm(int cdm_id) { |
76 DVLOG(1) << __FUNCTION__ << ": " << cdm_id; | 76 DVLOG(1) << __FUNCTION__ << ": " << cdm_id; |
77 return g_cdm_manager.Get().GetCdm(cdm_id); | 77 return g_cdm_manager.Get().GetCdm(cdm_id); |
78 } | 78 } |
79 | 79 |
80 MojoCdmService::MojoCdmService( | 80 MojoCdmService::MojoCdmService(base::WeakPtr<MojoCdmServiceContext> context, |
81 base::WeakPtr<MojoCdmServiceContext> context, | 81 CdmFactory* cdm_factory) |
82 CdmFactory* cdm_factory, | 82 : context_(context), |
83 mojo::InterfaceRequest<mojom::ContentDecryptionModule> request) | |
84 : binding_(this, std::move(request)), | |
85 context_(context), | |
86 cdm_factory_(cdm_factory), | 83 cdm_factory_(cdm_factory), |
87 cdm_id_(CdmContext::kInvalidCdmId), | 84 cdm_id_(CdmContext::kInvalidCdmId), |
88 weak_factory_(this) { | 85 weak_factory_(this) { |
89 DCHECK(context_); | 86 DCHECK(context_); |
90 DCHECK(cdm_factory_); | 87 DCHECK(cdm_factory_); |
91 } | 88 } |
92 | 89 |
93 MojoCdmService::~MojoCdmService() { | 90 MojoCdmService::~MojoCdmService() { |
94 if (cdm_id_ == CdmContext::kInvalidCdmId) | 91 if (cdm_id_ == CdmContext::kInvalidCdmId) |
95 return; | 92 return; |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 252 |
256 void MojoCdmService::OnDecryptorConnectionError() { | 253 void MojoCdmService::OnDecryptorConnectionError() { |
257 DVLOG(2) << __FUNCTION__; | 254 DVLOG(2) << __FUNCTION__; |
258 | 255 |
259 // MojoDecryptorService has lost connectivity to it's client, so it can be | 256 // MojoDecryptorService has lost connectivity to it's client, so it can be |
260 // freed. | 257 // freed. |
261 decryptor_.reset(); | 258 decryptor_.reset(); |
262 } | 259 } |
263 | 260 |
264 } // namespace media | 261 } // namespace media |
OLD | NEW |