diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-24 16:14:37 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-24 16:14:37 +0000 |
commit | 611cc2f8f49fa5468cf3dc2f56052f5d95196a01 (patch) | |
tree | 5ed57a62e1e3d032f63b46515a74ec78b05ada78 /base | |
parent | 8af455ad2a4bc2bfed9fbe3561697b42f6acf9c9 (diff) | |
download | chromium_src-611cc2f8f49fa5468cf3dc2f56052f5d95196a01.zip chromium_src-611cc2f8f49fa5468cf3dc2f56052f5d95196a01.tar.gz chromium_src-611cc2f8f49fa5468cf3dc2f56052f5d95196a01.tar.bz2 |
Revert r10259 & subsequent fixes.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10262 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r-- | base/base.xcodeproj/project.pbxproj | 4 | ||||
-rw-r--r-- | base/sys_info.h | 11 | ||||
-rw-r--r-- | base/sys_info_mac.cc | 46 | ||||
-rw-r--r-- | base/sys_info_posix.cc | 10 | ||||
-rw-r--r-- | base/sys_info_unittest.cc | 17 | ||||
-rw-r--r-- | base/sys_info_win.cc | 12 |
6 files changed, 10 insertions, 90 deletions
diff --git a/base/base.xcodeproj/project.pbxproj b/base/base.xcodeproj/project.pbxproj index 7df077c..fb82a52 100644 --- a/base/base.xcodeproj/project.pbxproj +++ b/base/base.xcodeproj/project.pbxproj @@ -180,7 +180,6 @@ B52C916C0E9428F500208D01 /* clipboard_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = B52C916B0E9428F500208D01 /* clipboard_unittest.cc */; }; B53C85280E9C298C000F70AB /* idle_timer.cc in Sources */ = {isa = PBXBuildFile; fileRef = 820EB4EB0E3A60FE009668FC /* idle_timer.cc */; }; B5637CB20EF2D79A004EF692 /* process_util_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7BD8F4A00E65AA2400034DE9 /* process_util_unittest.cc */; }; - B57008B60F5426B900932CCC /* sys_info_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = B57008B50F5426B900932CCC /* sys_info_mac.cc */; }; B57E4D780E9C26340090055D /* idletimer_unittest.cc in Sources */ = {isa = PBXBuildFile; fileRef = B57E4D770E9C26340090055D /* idletimer_unittest.cc */; }; B5A8618E0EC1257900B332C2 /* clipboard.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5A8618D0EC1257900B332C2 /* clipboard.cc */; }; B5C4B9C90F44C2AD003F59F9 /* debug_util_mac.cc in Sources */ = {isa = PBXBuildFile; fileRef = B5C4B9C80F44C2AD003F59F9 /* debug_util_mac.cc */; }; @@ -659,7 +658,6 @@ AE11B49026857EAED66B50E5 /* version.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = version.h; sourceTree = "<group>"; }; B290BFCBD30E45A63758BFC7 /* waitable_event_posix.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = waitable_event_posix.cc; sourceTree = "<group>"; }; B52C916B0E9428F500208D01 /* clipboard_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clipboard_unittest.cc; sourceTree = "<group>"; }; - B57008B50F5426B900932CCC /* sys_info_mac.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = sys_info_mac.cc; sourceTree = "<group>"; }; B57D788E0F26983200685566 /* scoped_file.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = scoped_file.h; sourceTree = "<group>"; }; B57E4D770E9C26340090055D /* idletimer_unittest.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = idletimer_unittest.cc; sourceTree = "<group>"; }; B5A8618D0EC1257900B332C2 /* clipboard.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = clipboard.cc; sourceTree = "<group>"; }; @@ -1067,7 +1065,6 @@ 7BAF50A90E50BACB00CA8A07 /* string_util_posix.h */, 7BAF50B10E50BAE700CA8A07 /* string_util_unittest.cc */, 7B6AF6310E80211700F9F9CF /* sys_info.h */, - B57008B50F5426B900932CCC /* sys_info_mac.cc */, 7B6AF6320E80211700F9F9CF /* sys_info_posix.cc */, 7B6AF6330E80211700F9F9CF /* sys_info_unittest.cc */, 7B4C5F470E4B6BF900679E8F /* sys_string_conversions.h */, @@ -1491,7 +1488,6 @@ 820EB4F70E3A613F009668FC /* string_piece.cc in Sources */, 829E36460DC0F6AC00819EBF /* string_util.cc in Sources */, 820EB4FA0E3A6178009668FC /* string_util_icu.cc in Sources */, - B57008B60F5426B900932CCC /* sys_info_mac.cc in Sources */, 7B6AF6340E80211C00F9F9CF /* sys_info_posix.cc in Sources */, 7B4C5F4A0E4B6BF900679E8F /* sys_string_conversions_mac.mm in Sources */, E4CE9D7A0E8C1FD400D5378C /* system_monitor.cc in Sources */, diff --git a/base/sys_info.h b/base/sys_info.h index 16b8690..35d371b 100644 --- a/base/sys_info.h +++ b/base/sys_info.h @@ -14,8 +14,6 @@ namespace base { class SysInfo { public: // Return the number of logical processors/cores on the current machine. - // WARNING: On POSIX, this method uses static variables and is not threadsafe - // until it's been initialized by being called once without a race. static int NumberOfProcessors(); // Return the number of bytes of physical memory on the current machine. @@ -45,15 +43,6 @@ class SysInfo { // 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 *major_version, - int32 *minor_version, - int32 *bugfix_version); - // Returns the CPU architecture of the system. Exact return value may differ // across platforms. static std::string CPUArchitecture(); diff --git a/base/sys_info_mac.cc b/base/sys_info_mac.cc deleted file mode 100644 index cd93ce9..0000000 --- a/base/sys_info_mac.cc +++ /dev/null @@ -1,46 +0,0 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "base/sys_info.h" - -#include <CoreServices/CoreServices.h> - -namespace base { - -// static -void SysInfo::OperatingSystemVersionNumbers(int32 *major_version, - int32 *minor_version, - int32 *bugfix_version) { - static bool is_initialized = false; - static int32 major_version_cached = 0; - static int32 minor_version_cached = 0; - static int32 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 dummy; - OperatingSystemVersionNumbers(&dummy, &dummy, &dummy); -} - -} // namespace base diff --git a/base/sys_info_posix.cc b/base/sys_info_posix.cc index 1d218ce..61c527a 100644 --- a/base/sys_info_posix.cc +++ b/base/sys_info_posix.cc @@ -134,4 +134,14 @@ size_t SysInfo::VMAllocationGranularity() { return getpagesize(); } +#if defined(OS_MACOSX) +// 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(); +} +#endif + } // namespace base diff --git a/base/sys_info_unittest.cc b/base/sys_info_unittest.cc index 209d0b1..ec43c05 100644 --- a/base/sys_info_unittest.cc +++ b/base/sys_info_unittest.cc @@ -36,20 +36,3 @@ TEST_F(SysInfoTest, HasEnvVar) { // Every setup should have PATH... EXPECT_TRUE(base::SysInfo::HasEnvVar(L"PATH")); } - -// TODO(port): If and when there's a LINUX version of this method, enable this -// unit test. -#if defined(OS_WIN) || defined(OS_MACOSX) -TEST_F(SysInfoTest, OperatingSystemVersionNumbers) { - int32 os_major_version = -1; - int32 os_minor_version = -1; - int32 os_bugfix_version = -1; - base::SysInfo::OperatingSystemVersionNumbers(&os_major_version, - &os_minor_version, - &os_bugfix_version); - EXPECT_GT(os_major_version, 0); - EXPECT_GT(os_minor_version, 0); - // On Windows, the bug fix version is set to 0. - EXPECT_GT(os_bugfix_version, -1); -} -#endif // OS_WIN || OS_MACOSX diff --git a/base/sys_info_win.cc b/base/sys_info_win.cc index 8e1a7ba..a195204 100644 --- a/base/sys_info_win.cc +++ b/base/sys_info_win.cc @@ -108,16 +108,4 @@ size_t SysInfo::VMAllocationGranularity() { return sysinfo.dwAllocationGranularity; } -// static -void SysInfo::OperatingSystemVersionNumbers(int32 *major_version, - int32 *minor_version, - int32 *bugfix_version) { - OSVERSIONINFO info = {0}; - info.dwOSVersionInfoSize = sizeof(info); - GetVersionEx(&info); - *major_version = info.dwMajorVersion; - *minor_version = info.dwMinorVersion; - *bugfix_version = 0; -} - } // namespace base |