Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(642)

Unified Diff: base/sys_info_mac.cc

Issue 151202: Remove sysctl-read workarounds (Closed)
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/sys_info.h ('k') | base/sys_info_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/sys_info_mac.cc
diff --git a/base/sys_info_mac.cc b/base/sys_info_mac.cc
index 294306632f4e05f73235ce436d2734a9f15aa255..caec74d125987bb8e54b572c15ec3821ce39d4b9 100644
--- a/base/sys_info_mac.cc
+++ b/base/sys_info_mac.cc
@@ -12,35 +12,21 @@ namespace base {
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;
- }
+ int32 major_version_cached = 0;
Mark Mentovai 2009/07/02 14:58:06 These shouldn't be called whatever_cached anymore.
+ int32 minor_version_cached = 0;
+ int32 bugfix_version_cached = 0;
+
+ // 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));
*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
« no previous file with comments | « base/sys_info.h ('k') | base/sys_info_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698