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

Side by Side Diff: content/common/media/cdm_service.cc

Issue 1637083002: Add CdmService to keep track of CDMs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rename + simplification Created 4 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
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "content/public/common/cdm_service.h"
6
7 #include <stddef.h>
8
9 #include "content/public/common/content_client.h"
10
11 namespace content {
12
13 static base::LazyInstance<CdmService>::Leaky g_cdm_service =
14 LAZY_INSTANCE_INITIALIZER;
15
16 // static
17 CdmService* CdmService::GetInstance() {
18 return g_cdm_service.Pointer();
19 }
20
21 CdmService::CdmService() {
22 GetContentClient()->AddContentDecryptionModules(&registered_modules_);
23 }
24
25 CdmService::~CdmService() {}
26
27 void CdmService::Register(
28 const std::string& cdm_id,
29 const std::string& version,
30 const base::FilePath& module_library_path,
31 const std::vector<base::string16>& supported_codecs,
32 const std::vector<base::string16>& supported_init_data_types) {
33 DCHECK(!cdm_id.empty());
34 DCHECK(!version.empty());
ddorwin 2016/03/18 19:24:18 Really? What about Android, etc.?
jrummell 2016/03/23 21:38:09 Removed.
35 for (size_t i = 0; i < registered_modules_.size(); i++) {
36 if (registered_modules_[i].cdm_id == cdm_id &&
ddorwin 2016/03/18 19:24:18 As mentioned later, why not just always insert?
jrummell 2016/03/23 21:38:09 Done.
37 registered_modules_[i].version == version) {
38 registered_modules_[i].module_library_path = module_library_path;
39 registered_modules_[i].supported_codecs = supported_codecs;
40 registered_modules_[i].supported_init_data_types =
41 supported_init_data_types;
42 return;
43 }
44 }
45
46 registered_modules_.insert(
47 registered_modules_.begin(),
48 CdmInfo(cdm_id, version, module_library_path, supported_codecs,
49 supported_init_data_types));
50 }
51
52 const std::vector<CdmInfo>& CdmService::GetAllRegisteredCdms() const {
53 return registered_modules_;
54 }
55
56 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698