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

Side by Side Diff: content/browser/media/cdm_registry_impl.cc

Issue 2668813002: Remove LazyInstance usage from media/ (Closed)
Patch Set: Fix presubmit comments. Created 3 years, 10 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 | « content/browser/media/cdm_registry_impl.h ('k') | content/browser/media/media_internals.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 2016 The Chromium Authors. All rights reserved. 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 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 "content/browser/media/cdm_registry_impl.h" 5 #include "content/browser/media/cdm_registry_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "content/public/common/cdm_info.h" 9 #include "content/public/common/cdm_info.h"
10 #include "content/public/common/content_client.h" 10 #include "content/public/common/content_client.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 static base::LazyInstance<CdmRegistryImpl>::Leaky g_cdm_registry =
15 LAZY_INSTANCE_INITIALIZER;
16
17 // static 14 // static
18 CdmRegistry* CdmRegistry::GetInstance() { 15 CdmRegistry* CdmRegistry::GetInstance() {
19 return CdmRegistryImpl::GetInstance(); 16 return CdmRegistryImpl::GetInstance();
20 } 17 }
21 18
22 // static 19 // static
23 CdmRegistryImpl* CdmRegistryImpl::GetInstance() { 20 CdmRegistryImpl* CdmRegistryImpl::GetInstance() {
24 return g_cdm_registry.Pointer(); 21 static CdmRegistryImpl* registry = new CdmRegistryImpl();
22 return registry;
25 } 23 }
26 24
27 CdmRegistryImpl::CdmRegistryImpl() {} 25 CdmRegistryImpl::CdmRegistryImpl() {}
28 26
29 CdmRegistryImpl::~CdmRegistryImpl() {} 27 CdmRegistryImpl::~CdmRegistryImpl() {}
30 28
31 void CdmRegistryImpl::Init() { 29 void CdmRegistryImpl::Init() {
32 // Let embedders register CDMs. 30 // Let embedders register CDMs.
33 GetContentClient()->AddContentDecryptionModules(&cdms_, nullptr); 31 GetContentClient()->AddContentDecryptionModules(&cdms_, nullptr);
34 } 32 }
35 33
36 void CdmRegistryImpl::RegisterCdm(const CdmInfo& info) { 34 void CdmRegistryImpl::RegisterCdm(const CdmInfo& info) {
37 // Always register new CDMs at the beginning of the list, so that 35 // Always register new CDMs at the beginning of the list, so that
38 // subsequent requests get the latest. 36 // subsequent requests get the latest.
39 cdms_.insert(cdms_.begin(), info); 37 cdms_.insert(cdms_.begin(), info);
40 } 38 }
41 39
42 const std::vector<CdmInfo>& CdmRegistryImpl::GetAllRegisteredCdms() { 40 const std::vector<CdmInfo>& CdmRegistryImpl::GetAllRegisteredCdms() {
43 return cdms_; 41 return cdms_;
44 } 42 }
45 43
46 } // namespace media 44 } // namespace media
OLDNEW
« no previous file with comments | « content/browser/media/cdm_registry_impl.h ('k') | content/browser/media/media_internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698