diff options
Diffstat (limited to 'base/sys_info.h')
-rw-r--r-- | base/sys_info.h | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/base/sys_info.h b/base/sys_info.h index e35feff735..18bdaf0096 100644 --- a/base/sys_info.h +++ b/base/sys_info.h @@ -13,11 +13,18 @@ #include "base/base_export.h" #include "base/files/file_path.h" +#include "base/gtest_prod_util.h" #include "base/time/time.h" #include "build/build_config.h" namespace base { +namespace debug { +FORWARD_DECLARE_TEST(SystemMetricsTest, ParseMeminfo); +} + +struct SystemMemoryInfoKB; + class BASE_EXPORT SysInfo { public: // Return the number of logical processors/cores on the current machine. @@ -28,6 +35,9 @@ class BASE_EXPORT SysInfo { // Return the number of bytes of current available physical memory on the // machine. + // (The amount of memory that can be allocated without any significant + // impact on the system. It can lead to freeing inactive file-backed + // and/or speculative file-backed memory). static int64_t AmountOfAvailablePhysicalMemory(); // Return the number of bytes of virtual memory of this process. A return @@ -70,8 +80,6 @@ class BASE_EXPORT SysInfo { static std::string OperatingSystemVersion(); // Retrieves detailed numeric values for the OS version. - // TODO(port): Implement a Linux version of this method and enable the - // corresponding unit test. // DON'T USE THIS ON THE MAC OR WINDOWS to determine the current OS release // for OS version-specific feature checks and workarounds. If you must use // an OS version check instead of a feature check, use the base::mac::IsOS* @@ -147,6 +155,15 @@ class BASE_EXPORT SysInfo { // Low-end device refers to devices having less than 512M memory in the // current implementation. static bool IsLowEndDevice(); + + private: + FRIEND_TEST_ALL_PREFIXES(SysInfoTest, AmountOfAvailablePhysicalMemory); + FRIEND_TEST_ALL_PREFIXES(debug::SystemMetricsTest, ParseMeminfo); + +#if defined(OS_LINUX) || defined(OS_ANDROID) + static int64_t AmountOfAvailablePhysicalMemory( + const SystemMemoryInfoKB& meminfo); +#endif }; } // namespace base |