| OLD | NEW |
| 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 BASE_SYS_INFO_H_ | 5 #ifndef BASE_SYS_INFO_H_ |
| 6 #define BASE_SYS_INFO_H_ | 6 #define BASE_SYS_INFO_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| 11 | 11 |
| 12 class FilePath; |
| 13 |
| 12 namespace base { | 14 namespace base { |
| 13 | 15 |
| 14 class SysInfo { | 16 class SysInfo { |
| 15 public: | 17 public: |
| 16 // Return the number of logical processors/cores on the current machine. | 18 // Return the number of logical processors/cores on the current machine. |
| 17 static int NumberOfProcessors(); | 19 static int NumberOfProcessors(); |
| 18 | 20 |
| 19 // Return the number of bytes of physical memory on the current machine. | 21 // Return the number of bytes of physical memory on the current machine. |
| 20 static int64 AmountOfPhysicalMemory(); | 22 static int64 AmountOfPhysicalMemory(); |
| 21 | 23 |
| 22 // Return the number of megabytes of physical memory on the current machine. | 24 // Return the number of megabytes of physical memory on the current machine. |
| 23 static int AmountOfPhysicalMemoryMB() { | 25 static int AmountOfPhysicalMemoryMB() { |
| 24 return static_cast<int>(AmountOfPhysicalMemory() / 1024 / 1024); | 26 return static_cast<int>(AmountOfPhysicalMemory() / 1024 / 1024); |
| 25 } | 27 } |
| 26 | 28 |
| 27 // Return the available disk space in bytes on the volume containing |path|, | 29 // Return the available disk space in bytes on the volume containing |path|, |
| 28 // or -1 on failure. | 30 // or -1 on failure. |
| 29 static int64 AmountOfFreeDiskSpace(const std::wstring& path); | 31 static int64 AmountOfFreeDiskSpace(const FilePath& path); |
| 30 | 32 |
| 31 // Return true if the given environment variable is defined. | 33 // Return true if the given environment variable is defined. |
| 32 // TODO: find a better place for HasEnvVar. | 34 // TODO: find a better place for HasEnvVar. |
| 33 static bool HasEnvVar(const wchar_t* var); | 35 static bool HasEnvVar(const wchar_t* var); |
| 34 | 36 |
| 35 // Return the value of the given environment variable | 37 // Return the value of the given environment variable |
| 36 // or an empty string if not defined. | 38 // or an empty string if not defined. |
| 37 // TODO: find a better place for GetEnvVar. | 39 // TODO: find a better place for GetEnvVar. |
| 38 static std::wstring GetEnvVar(const wchar_t* var); | 40 static std::wstring GetEnvVar(const wchar_t* var); |
| 39 | 41 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 static void ParseLsbRelease(const std::string& lsb_release, | 82 static void ParseLsbRelease(const std::string& lsb_release, |
| 81 int32 *major_version, | 83 int32 *major_version, |
| 82 int32 *minor_version, | 84 int32 *minor_version, |
| 83 int32 *bugfix_version); | 85 int32 *bugfix_version); |
| 84 #endif | 86 #endif |
| 85 }; | 87 }; |
| 86 | 88 |
| 87 } // namespace base | 89 } // namespace base |
| 88 | 90 |
| 89 #endif // BASE_SYS_INFO_H_ | 91 #endif // BASE_SYS_INFO_H_ |
| OLD | NEW |