Bug 1205942 (part 3) - Remove unused OS version detection functions from ipc/chromium/. r=jld.

The motivation here is to remove the GetVersionEx() calls in the
Windows-specific code, because that function is deprecated and causes warnings.
The non-Windows versions come along for the ride.
This commit is contained in:
Nicholas Nethercote 2015-10-01 07:10:13 -07:00
parent 51086324ae
commit fd2c4c2ebe
4 changed files with 0 additions and 90 deletions

View File

@ -42,18 +42,6 @@ class SysInfo {
// Returns the name of the host operating system.
static std::string OperatingSystemName();
// Returns the version of the host operating system.
static std::string OperatingSystemVersion();
// Retrieves detailed numeric values for the OS version.
// WARNING: On OS X, this method uses static variables and is not threadsafe
// until it's been initialized by being called once without a race.
// TODO(port): Implement a Linux version of this method and enable the
// corresponding unit test.
static void OperatingSystemVersionNumbers(int32_t *major_version,
int32_t *minor_version,
int32_t *bugfix_version);
// Returns the CPU architecture of the system. Exact return value may differ
// across platforms.
static std::string CPUArchitecture();
@ -68,14 +56,6 @@ class SysInfo {
// Return the smallest amount of memory (in bytes) which the VM system will
// allocate.
static size_t VMAllocationGranularity();
#if defined(OS_MACOSX)
// Under the OS X Sandbox, our access to the system is limited, this call
// caches the system info on startup before we turn the Sandbox on.
// The above functions are all wired up to return the cached value so the rest
// of the code can call them in the Sandbox without worrying.
static void CacheSysInfo();
#endif
};
} // namespace base

View File

@ -8,39 +8,4 @@
namespace base {
// static
void SysInfo::OperatingSystemVersionNumbers(int32_t *major_version,
int32_t *minor_version,
int32_t *bugfix_version) {
static bool is_initialized = false;
static int32_t major_version_cached = 0;
static int32_t minor_version_cached = 0;
static int32_t bugfix_version_cached = 0;
if (!is_initialized) {
// Gestalt can't be called in the sandbox, so we cache its return value.
Gestalt(gestaltSystemVersionMajor,
reinterpret_cast<SInt32*>(&major_version_cached));
Gestalt(gestaltSystemVersionMinor,
reinterpret_cast<SInt32*>(&minor_version_cached));
Gestalt(gestaltSystemVersionBugFix,
reinterpret_cast<SInt32*>(&bugfix_version_cached));
is_initialized = true;
}
*major_version = major_version_cached;
*minor_version = minor_version_cached;
*bugfix_version = bugfix_version_cached;
}
// static
void SysInfo::CacheSysInfo() {
// Due to startup time concerns [premature optimization?] we only cache values
// from functions we know to be called in the renderer & fail when the sandbox
// is enabled.
NumberOfProcessors();
int32_t dummy;
OperatingSystemVersionNumbers(&dummy, &dummy, &dummy);
}
} // namespace base

View File

@ -127,16 +127,6 @@ std::string SysInfo::OperatingSystemName() {
return std::string(info.sysname);
}
// static
std::string SysInfo::OperatingSystemVersion() {
utsname info;
if (uname(&info) < 0) {
NOTREACHED();
return "";
}
return std::string(info.release);
}
// static
std::string SysInfo::CPUArchitecture() {
utsname info;

View File

@ -67,19 +67,6 @@ std::string SysInfo::OperatingSystemName() {
return "Windows NT";
}
// static
std::string SysInfo::OperatingSystemVersion() {
OSVERSIONINFO info = {0};
info.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
GetVersionEx(&info);
return StringPrintf("%lu.%lu", info.dwMajorVersion, info.dwMinorVersion);
}
// TODO: Implement OperatingSystemVersionComplete, which would include
// patchlevel/service pack number. See chrome/browser/views/bug_report_view.cc,
// BugReportView::SetOSVersion.
// static
std::string SysInfo::CPUArchitecture() {
// TODO: Make this vary when we support any other architectures.
@ -108,16 +95,4 @@ size_t SysInfo::VMAllocationGranularity() {
return sysinfo.dwAllocationGranularity;
}
// static
void SysInfo::OperatingSystemVersionNumbers(int32_t *major_version,
int32_t *minor_version,
int32_t *bugfix_version) {
OSVERSIONINFO info = {0};
info.dwOSVersionInfoSize = sizeof(info);
GetVersionEx(&info);
*major_version = info.dwMajorVersion;
*minor_version = info.dwMinorVersion;
*bugfix_version = 0;
}
} // namespace base