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

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

Issue 1603413004: media: Only unregister a CDM when it has been registered. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | no next file » | 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 context_(context), 86 context_(context),
87 service_provider_(service_provider), 87 service_provider_(service_provider),
88 cdm_factory_(cdm_factory), 88 cdm_factory_(cdm_factory),
89 cdm_id_(CdmContext::kInvalidCdmId), 89 cdm_id_(CdmContext::kInvalidCdmId),
90 weak_factory_(this) { 90 weak_factory_(this) {
91 DCHECK(context_); 91 DCHECK(context_);
92 DCHECK(cdm_factory_); 92 DCHECK(cdm_factory_);
93 } 93 }
94 94
95 MojoCdmService::~MojoCdmService() { 95 MojoCdmService::~MojoCdmService() {
96 if (cdm_id_ == CdmContext::kInvalidCdmId)
97 return;
98
96 g_cdm_manager.Get().UnregisterCdm(cdm_id_); 99 g_cdm_manager.Get().UnregisterCdm(cdm_id_);
97 100
98 if (cdm_id_ != CdmContext::kInvalidCdmId && context_) 101 if (context_)
99 context_->UnregisterCdm(cdm_id_); 102 context_->UnregisterCdm(cdm_id_);
100 } 103 }
101 104
102 void MojoCdmService::SetClient( 105 void MojoCdmService::SetClient(
103 interfaces::ContentDecryptionModuleClientPtr client) { 106 interfaces::ContentDecryptionModuleClientPtr client) {
104 client_ = std::move(client); 107 client_ = std::move(client);
105 } 108 }
106 109
107 void MojoCdmService::Initialize(const mojo::String& key_system, 110 void MojoCdmService::Initialize(const mojo::String& key_system,
108 const mojo::String& security_origin, 111 const mojo::String& security_origin,
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 279
277 void MojoCdmService::OnDecryptorConnectionError() { 280 void MojoCdmService::OnDecryptorConnectionError() {
278 DVLOG(2) << __FUNCTION__; 281 DVLOG(2) << __FUNCTION__;
279 282
280 // MojoDecryptorService has lost connectivity to it's client, so it can be 283 // MojoDecryptorService has lost connectivity to it's client, so it can be
281 // freed. 284 // freed.
282 decryptor_.reset(); 285 decryptor_.reset();
283 } 286 }
284 287
285 } // namespace media 288 } // namespace media
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698