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

Unified Diff: chrome/browser/bug_report_util.cc

Issue 6713107: Make the windows_version.h functions threadsafe by using a singleton. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 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
Index: chrome/browser/bug_report_util.cc
===================================================================
--- chrome/browser/bug_report_util.cc (revision 80528)
+++ chrome/browser/bug_report_util.cc (working copy)
@@ -13,6 +13,7 @@
#include "base/memory/singleton.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
+#include "base/win/windows_version.h"
#include "chrome/browser/browser_list.h"
#include "chrome/browser/browser_process_impl.h"
#include "chrome/browser/profiles/profile.h"
@@ -156,21 +157,14 @@
}
// static
-void BugReportUtil::SetOSVersion(std::string *os_version) {
+void BugReportUtil::SetOSVersion(std::string* os_version) {
#if defined(OS_WIN)
- OSVERSIONINFO osvi;
- ZeroMemory(&osvi, sizeof(OSVERSIONINFO));
- osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
-
- if (GetVersionEx(&osvi)) {
- *os_version = StringPrintf("%d.%d.%d %S",
- osvi.dwMajorVersion,
- osvi.dwMinorVersion,
- osvi.dwBuildNumber,
- osvi.szCSDVersion);
- } else {
- *os_version = "unknown";
- }
+ OSInfo* os_info = base::win::OSInfo::GetInstance();
+ const int* version = os_info->version_number();
+ *os_version = StringPrintf("%d.%d.%d", version[0], version[1], version[2]);
+ int service_pack = os_info->service_pack()[0];
+ if (service_pack > 0)
+ os_version->append(StringPrintf("Service Pack %d", service_pack));
#elif defined(OS_MACOSX)
int32 major;
int32 minor;

Powered by Google App Engine
This is Rietveld 408576698