Index: base/sys_info.h |
diff --git a/base/sys_info.h b/base/sys_info.h |
index e35feff735e4ac3783d1870ae04d711ef7cdd7fc..c066abeef7f35c68a05a4f8bcab6d78c92342077 100644 |
--- a/base/sys_info.h |
+++ b/base/sys_info.h |
@@ -13,11 +13,20 @@ |
#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" |
+FORWARD_DECLARE_TEST(SysInfoTest, AmountOfAvailablePhysicalMemory); |
danakj
2017/03/13 16:01:21
I think you don't need these if the tests are in t
Michael K. (Yandex Team)
2017/03/14 03:49:09
Done.
|
+ |
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 +37,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 |
@@ -147,6 +159,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(::base::debug::SystemMetricsTest, ParseMeminfo); |
+ |
+#if defined(OS_LINUX) || defined(OS_ANDROID) |
+ static int64_t AmountOfAvailablePhysicalMemory( |
+ const SystemMemoryInfoKB& meminfo); |
+#endif |
}; |
} // namespace base |