Chromium Code Reviews| OLD | NEW |
|---|---|
| (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(®istered_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 | |
| OLD | NEW |