1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/sandbox/chromium/base/sys_info.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,113 @@ 1.4 +// Copyright (c) 2012 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +#ifndef BASE_SYS_INFO_H_ 1.9 +#define BASE_SYS_INFO_H_ 1.10 + 1.11 +#include <string> 1.12 + 1.13 +#include "base/base_export.h" 1.14 +#include "base/basictypes.h" 1.15 +#include "base/files/file_path.h" 1.16 +#include "build/build_config.h" 1.17 + 1.18 +namespace base { 1.19 + 1.20 +class BASE_EXPORT SysInfo { 1.21 + public: 1.22 + // Return the number of logical processors/cores on the current machine. 1.23 + static int NumberOfProcessors(); 1.24 + 1.25 + // Return the number of bytes of physical memory on the current machine. 1.26 + static int64 AmountOfPhysicalMemory(); 1.27 + 1.28 + // Return the number of bytes of current available physical memory on the 1.29 + // machine. 1.30 + static int64 AmountOfAvailablePhysicalMemory(); 1.31 + 1.32 + // Return the number of megabytes of physical memory on the current machine. 1.33 + static int AmountOfPhysicalMemoryMB() { 1.34 + return static_cast<int>(AmountOfPhysicalMemory() / 1024 / 1024); 1.35 + } 1.36 + 1.37 + // Return the available disk space in bytes on the volume containing |path|, 1.38 + // or -1 on failure. 1.39 + static int64 AmountOfFreeDiskSpace(const FilePath& path); 1.40 + 1.41 + // Returns system uptime in milliseconds. 1.42 + static int64 Uptime(); 1.43 + 1.44 + // Returns the name of the host operating system. 1.45 + static std::string OperatingSystemName(); 1.46 + 1.47 + // Returns the version of the host operating system. 1.48 + static std::string OperatingSystemVersion(); 1.49 + 1.50 + // Retrieves detailed numeric values for the OS version. 1.51 + // TODO(port): Implement a Linux version of this method and enable the 1.52 + // corresponding unit test. 1.53 + // DON'T USE THIS ON THE MAC OR WINDOWS to determine the current OS release 1.54 + // for OS version-specific feature checks and workarounds. If you must use 1.55 + // an OS version check instead of a feature check, use the base::mac::IsOS* 1.56 + // family from base/mac/mac_util.h, or base::win::GetVersion from 1.57 + // base/win/windows_version.h. 1.58 + static void OperatingSystemVersionNumbers(int32* major_version, 1.59 + int32* minor_version, 1.60 + int32* bugfix_version); 1.61 + 1.62 + // Returns the architecture of the running operating system. 1.63 + // Exact return value may differ across platforms. 1.64 + // e.g. a 32-bit x86 kernel on a 64-bit capable CPU will return "x86", 1.65 + // whereas a x86-64 kernel on the same CPU will return "x86_64" 1.66 + static std::string OperatingSystemArchitecture(); 1.67 + 1.68 + // Avoid using this. Use base/cpu.h to get information about the CPU instead. 1.69 + // http://crbug.com/148884 1.70 + // Returns the CPU model name of the system. If it can not be figured out, 1.71 + // an empty string is returned. 1.72 + static std::string CPUModelName(); 1.73 + 1.74 + // Return the smallest amount of memory (in bytes) which the VM system will 1.75 + // allocate. 1.76 + static size_t VMAllocationGranularity(); 1.77 + 1.78 +#if defined(OS_POSIX) && !defined(OS_MACOSX) 1.79 + // Returns the maximum SysV shared memory segment size. 1.80 + static size_t MaxSharedMemorySize(); 1.81 +#endif // defined(OS_POSIX) && !defined(OS_MACOSX) 1.82 + 1.83 +#if defined(OS_CHROMEOS) 1.84 + // Returns the name of the version entry we wish to look up in the 1.85 + // Linux Standard Base release information file. 1.86 + static std::string GetLinuxStandardBaseVersionKey(); 1.87 + 1.88 + // Parses /etc/lsb-release to get version information for Google Chrome OS. 1.89 + // Declared here so it can be exposed for unit testing. 1.90 + static void ParseLsbRelease(const std::string& lsb_release, 1.91 + int32* major_version, 1.92 + int32* minor_version, 1.93 + int32* bugfix_version); 1.94 + 1.95 + // Returns the path to the lsb-release file. 1.96 + static FilePath GetLsbReleaseFilePath(); 1.97 +#endif // defined(OS_CHROMEOS) 1.98 + 1.99 +#if defined(OS_ANDROID) 1.100 + // Returns the Android build's codename. 1.101 + static std::string GetAndroidBuildCodename(); 1.102 + 1.103 + // Returns the Android build ID. 1.104 + static std::string GetAndroidBuildID(); 1.105 + 1.106 + // Returns the device's name. 1.107 + static std::string GetDeviceName(); 1.108 + 1.109 + static int DalvikHeapSizeMB(); 1.110 + static int DalvikHeapGrowthLimitMB(); 1.111 +#endif // defined(OS_ANDROID) 1.112 +}; 1.113 + 1.114 +} // namespace base 1.115 + 1.116 +#endif // BASE_SYS_INFO_H_