summaryrefslogtreecommitdiffstats
path: root/base/win
diff options
context:
space:
mode:
authorhongbo.min@intel.com <hongbo.min@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-08 09:53:01 +0000
committerhongbo.min@intel.com <hongbo.min@intel.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-08 09:53:01 +0000
commitd5df0c8c043a25aa7b7d43f7f6f29198bcf74348 (patch)
treed937d7dc6866099dfc624cbc624020449f792559 /base/win
parent4c35f73337302284aaa503dc2d6b2172623687b5 (diff)
downloadchromium_src-d5df0c8c043a25aa7b7d43f7f6f29198bcf74348.zip
chromium_src-d5df0c8c043a25aa7b7d43f7f6f29198bcf74348.tar.gz
chromium_src-d5df0c8c043a25aa7b7d43f7f6f29198bcf74348.tar.bz2
Refine systemInfo.cpu API and provide systemInfo.cpu.get impl for Windows and Linux.
BUG=136519 TEST=browser_test --gtest_filter=SystemInfoCpuApiTest.* Review URL: https://chromiumcodereview.appspot.com/10914060 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155575 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/win')
-rw-r--r--base/win/windows_version.cc14
-rw-r--r--base/win/windows_version.h4
2 files changed, 18 insertions, 0 deletions
diff --git a/base/win/windows_version.cc b/base/win/windows_version.cc
index f0c94e2..c130e0e 100644
--- a/base/win/windows_version.cc
+++ b/base/win/windows_version.cc
@@ -7,6 +7,8 @@
#include <windows.h>
#include "base/logging.h"
+#include "base/utf_string_conversions.h"
+#include "base/win/registry.h"
namespace base {
namespace win {
@@ -76,6 +78,18 @@ OSInfo::OSInfo()
OSInfo::~OSInfo() {
}
+std::string OSInfo::processor_model_name() {
+ if (processor_model_name_.empty()) {
+ const wchar_t kProcessorNameString[] =
+ L"HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0";
+ base::win::RegKey key(HKEY_LOCAL_MACHINE, kProcessorNameString, KEY_READ);
+ string16 value;
+ key.ReadValue(L"ProcessorNameString", &value);
+ processor_model_name_ = UTF16ToUTF8(value);
+ }
+ return processor_model_name_;
+}
+
// static
OSInfo::WOW64Status OSInfo::GetWOW64StatusForProcess(HANDLE process_handle) {
typedef BOOL (WINAPI* IsWow64ProcessFunc)(HANDLE, PBOOL);
diff --git a/base/win/windows_version.h b/base/win/windows_version.h
index 0e4a75e..d466dad 100644
--- a/base/win/windows_version.h
+++ b/base/win/windows_version.h
@@ -5,6 +5,8 @@
#ifndef BASE_WIN_WINDOWS_VERSION_H_
#define BASE_WIN_WINDOWS_VERSION_H_
+#include <string>
+
#include "base/base_export.h"
#include "base/basictypes.h"
@@ -76,6 +78,7 @@ class BASE_EXPORT OSInfo {
int processors() const { return processors_; }
size_t allocation_granularity() const { return allocation_granularity_; }
WOW64Status wow64_status() const { return wow64_status_; }
+ std::string processor_model_name();
// Like wow64_status(), but for the supplied handle instead of the current
// process. This doesn't touch member state, so you can bypass the singleton.
@@ -92,6 +95,7 @@ class BASE_EXPORT OSInfo {
int processors_;
size_t allocation_granularity_;
WOW64Status wow64_status_;
+ std::string processor_model_name_;
DISALLOW_COPY_AND_ASSIGN(OSInfo);
};