From f4812211951630ac47b96a1b7b78f3a3dcc2b9b9 Mon Sep 17 00:00:00 2001 From: "pkasting@chromium.org" Date: Thu, 7 Apr 2011 22:15:34 +0000 Subject: Make the windows_version.h functions threadsafe by using a singleton. Add accessors to the singleton for more values that various code wants, then convert almost everyone using OSVERSIONINFO or SYSTEM_INFO structs to calling these accessors. Declare an AtExitManager in the out-of-process test runner since it didn't have one and that breaks singleton-using code in the test executable (as opposed to in chrome.dll). A few other minor cleanups along the way (binding of "*", shorter code, etc.). Because I ran into problems with it while modifying gcapi.cc, I cleaned up our usage of strsafe.h a bit, so that files that don't need it don't include it and files that do use STRSAFE_NO_DEPRECATE instead of a modified #include order. BUG=none TEST=none Review URL: http://codereview.chromium.org/6816027 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@80851 0039d316-1c4b-4281-b951-d872f2087c98 --- base/process_util_win.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'base/process_util_win.cc') diff --git a/base/process_util_win.cc b/base/process_util_win.cc index 8ade06e..a49b78c 100644 --- a/base/process_util_win.cc +++ b/base/process_util_win.cc @@ -17,6 +17,7 @@ #include "base/logging.h" #include "base/memory/scoped_ptr.h" #include "base/metrics/histogram.h" +#include "base/sys_info.h" #include "base/win/scoped_handle.h" #include "base/win/windows_version.h" @@ -554,12 +555,11 @@ bool CleanupProcesses(const std::wstring& executable_name, /////////////////////////////////////////////////////////////////////////////// // ProcesMetrics -ProcessMetrics::ProcessMetrics(ProcessHandle process) : process_(process), - last_time_(0), - last_system_time_(0) { - SYSTEM_INFO system_info; - GetSystemInfo(&system_info); - processor_count_ = system_info.dwNumberOfProcessors; +ProcessMetrics::ProcessMetrics(ProcessHandle process) + : process_(process), + processor_count_(base::SysInfo::NumberOfProcessors()), + last_time_(0), + last_system_time_(0) { } // static -- cgit v1.1