| 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 #ifndef EXTENSIONS_BROWSER_API_SYSTEM_CPU_CPU_INFO_PROVIDER_H_ | 5 #ifndef EXTENSIONS_BROWSER_API_SYSTEM_CPU_CPU_INFO_PROVIDER_H_ |
| 6 #define EXTENSIONS_BROWSER_API_SYSTEM_CPU_CPU_INFO_PROVIDER_H_ | 6 #define EXTENSIONS_BROWSER_API_SYSTEM_CPU_CPU_INFO_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/cpu.h" | 10 #include "base/cpu.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 | 26 |
| 27 private: | 27 private: |
| 28 friend class MockCpuInfoProviderImpl; | 28 friend class MockCpuInfoProviderImpl; |
| 29 | 29 |
| 30 CpuInfoProvider(); | 30 CpuInfoProvider(); |
| 31 ~CpuInfoProvider() override; | 31 ~CpuInfoProvider() override; |
| 32 | 32 |
| 33 // Platform specific implementation for querying the CPU time information | 33 // Platform specific implementation for querying the CPU time information |
| 34 // for each processor. | 34 // for each processor. |
| 35 virtual bool QueryCpuTimePerProcessor( | 35 virtual bool QueryCpuTimePerProcessor( |
| 36 std::vector<linked_ptr<api::system_cpu::ProcessorInfo>>* infos); | 36 std::vector<api::system_cpu::ProcessorInfo>* infos); |
| 37 | 37 |
| 38 // Overriden from SystemInfoProvider. | 38 // Overriden from SystemInfoProvider. |
| 39 bool QueryInfo() override; | 39 bool QueryInfo() override; |
| 40 | 40 |
| 41 // Creates a list of codenames for currently active features. | 41 // Creates a list of codenames for currently active features. |
| 42 std::vector<std::string> GetFeatures() const; | 42 std::vector<std::string> GetFeatures() const; |
| 43 | 43 |
| 44 // The last information filled up by QueryInfo and is accessed on multiple | 44 // The last information filled up by QueryInfo and is accessed on multiple |
| 45 // threads, but the whole class is being guarded by SystemInfoProvider base | 45 // threads, but the whole class is being guarded by SystemInfoProvider base |
| 46 // class. | 46 // class. |
| 47 // | 47 // |
| 48 // |info_| is accessed on the UI thread while |is_waiting_for_completion_| is | 48 // |info_| is accessed on the UI thread while |is_waiting_for_completion_| is |
| 49 // false and on the sequenced worker pool while |is_waiting_for_completion_| | 49 // false and on the sequenced worker pool while |is_waiting_for_completion_| |
| 50 // is true. | 50 // is true. |
| 51 api::system_cpu::CpuInfo info_; | 51 api::system_cpu::CpuInfo info_; |
| 52 | 52 |
| 53 static base::LazyInstance<scoped_refptr<CpuInfoProvider> > provider_; | 53 static base::LazyInstance<scoped_refptr<CpuInfoProvider> > provider_; |
| 54 base::CPU cpu_; | 54 base::CPU cpu_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(CpuInfoProvider); | 56 DISALLOW_COPY_AND_ASSIGN(CpuInfoProvider); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace extensions | 59 } // namespace extensions |
| 60 | 60 |
| 61 #endif // EXTENSIONS_BROWSER_API_SYSTEM_CPU_CPU_INFO_PROVIDER_H_ | 61 #endif // EXTENSIONS_BROWSER_API_SYSTEM_CPU_CPU_INFO_PROVIDER_H_ |
| OLD | NEW |