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

Side by Side Diff: media/mojo/services/mojo_cdm_service.cc

Issue 2752653002: Change MojoDecryptorService to take a Decryptor (Closed)
Patch Set: comments updated Created 3 years, 9 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 unified diff | Download patch
« no previous file with comments | « media/mojo/services/mojo_cdm_service.h ('k') | media/mojo/services/mojo_decryptor_service.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 cdm_id_ = next_cdm_id_++; 196 cdm_id_ = next_cdm_id_++;
197 197
198 context_->RegisterCdm(cdm_id_, this); 198 context_->RegisterCdm(cdm_id_, this);
199 GetManager()->RegisterCdm(cdm_id_, cdm); 199 GetManager()->RegisterCdm(cdm_id_, cdm);
200 200
201 // If |cdm| has a decryptor, create the MojoDecryptorService 201 // If |cdm| has a decryptor, create the MojoDecryptorService
202 // and pass the connection back to the client. 202 // and pass the connection back to the client.
203 mojom::DecryptorPtr decryptor_service; 203 mojom::DecryptorPtr decryptor_service;
204 CdmContext* const cdm_context = cdm_->GetCdmContext(); 204 CdmContext* const cdm_context = cdm_->GetCdmContext();
205 if (cdm_context && cdm_context->GetDecryptor()) { 205 if (cdm_context && cdm_context->GetDecryptor()) {
206 // MojoDecryptorService takes a reference to the CDM, but it is still owned
207 // by |this|.
208 decryptor_.reset(new MojoDecryptorService( 206 decryptor_.reset(new MojoDecryptorService(
209 cdm_, MakeRequest(&decryptor_service), 207 cdm_context->GetDecryptor(), MakeRequest(&decryptor_service),
210 base::Bind(&MojoCdmService::OnDecryptorConnectionError, weak_this_))); 208 base::Bind(&MojoCdmService::OnDecryptorConnectionError, weak_this_)));
211 } 209 }
212 210
213 DVLOG(1) << __func__ << ": CDM successfully created with ID " << cdm_id_; 211 DVLOG(1) << __func__ << ": CDM successfully created with ID " << cdm_id_;
214 cdm_promise_result->success = true; 212 cdm_promise_result->success = true;
215 callback.Run(std::move(cdm_promise_result), cdm_id_, 213 callback.Run(std::move(cdm_promise_result), cdm_id_,
216 std::move(decryptor_service)); 214 std::move(decryptor_service));
217 } 215 }
218 216
219 void MojoCdmService::OnSessionMessage( 217 void MojoCdmService::OnSessionMessage(
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 249
252 void MojoCdmService::OnDecryptorConnectionError() { 250 void MojoCdmService::OnDecryptorConnectionError() {
253 DVLOG(2) << __func__; 251 DVLOG(2) << __func__;
254 252
255 // MojoDecryptorService has lost connectivity to it's client, so it can be 253 // MojoDecryptorService has lost connectivity to it's client, so it can be
256 // freed. 254 // freed.
257 decryptor_.reset(); 255 decryptor_.reset();
258 } 256 }
259 257
260 } // namespace media 258 } // namespace media
OLDNEW
« no previous file with comments | « media/mojo/services/mojo_cdm_service.h ('k') | media/mojo/services/mojo_decryptor_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698