| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "extensions/browser/api/system_cpu/cpu_info_provider.h" | 5 #include "extensions/browser/api/system_cpu/cpu_info_provider.h" |
| 6 | 6 |
| 7 #include "base/sys_info.h" | 7 #include "base/sys_info.h" |
| 8 | 8 |
| 9 namespace extensions { | 9 namespace extensions { |
| 10 | 10 |
| 11 using api::system_cpu::CpuInfo; | 11 using api::system_cpu::CpuInfo; |
| 12 | 12 |
| 13 // Static member intialization. | 13 // Static member intialization. |
| 14 base::LazyInstance<scoped_refptr<CpuInfoProvider> > CpuInfoProvider::provider_ = | 14 base::LazyInstance<scoped_refptr<CpuInfoProvider>>::DestructorAtExit |
| 15 LAZY_INSTANCE_INITIALIZER; | 15 CpuInfoProvider::provider_ = LAZY_INSTANCE_INITIALIZER; |
| 16 | 16 |
| 17 CpuInfoProvider::CpuInfoProvider() { | 17 CpuInfoProvider::CpuInfoProvider() { |
| 18 } | 18 } |
| 19 | 19 |
| 20 CpuInfoProvider::~CpuInfoProvider() { | 20 CpuInfoProvider::~CpuInfoProvider() { |
| 21 } | 21 } |
| 22 | 22 |
| 23 void CpuInfoProvider::InitializeForTesting( | 23 void CpuInfoProvider::InitializeForTesting( |
| 24 scoped_refptr<CpuInfoProvider> provider) { | 24 scoped_refptr<CpuInfoProvider> provider) { |
| 25 DCHECK(provider.get() != NULL); | 25 DCHECK(provider.get() != NULL); |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 } | 65 } |
| 66 | 66 |
| 67 // static | 67 // static |
| 68 CpuInfoProvider* CpuInfoProvider::Get() { | 68 CpuInfoProvider* CpuInfoProvider::Get() { |
| 69 if (provider_.Get().get() == NULL) | 69 if (provider_.Get().get() == NULL) |
| 70 provider_.Get() = new CpuInfoProvider(); | 70 provider_.Get() = new CpuInfoProvider(); |
| 71 return provider_.Get().get(); | 71 return provider_.Get().get(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 } // namespace extensions | 74 } // namespace extensions |
| OLD | NEW |