 Chromium Code Reviews
 Chromium Code Reviews Issue 2556813002:
  Record executable version details to stability file  (Closed)
    
  
    Issue 2556813002:
  Record executable version details to stability file  (Closed) 
  | Index: chrome/browser/chrome_browser_field_trials_desktop.cc | 
| diff --git a/chrome/browser/chrome_browser_field_trials_desktop.cc b/chrome/browser/chrome_browser_field_trials_desktop.cc | 
| index 6ebdc45f3675caa8dc96275ccdf062f1c75b9528..c67ea261695b18a324221624b99d14383c63618c 100644 | 
| --- a/chrome/browser/chrome_browser_field_trials_desktop.cc | 
| +++ b/chrome/browser/chrome_browser_field_trials_desktop.cc | 
| @@ -4,6 +4,10 @@ | 
| #include "chrome/browser/chrome_browser_field_trials_desktop.h" | 
| +#if defined(OS_WIN) | 
| +#include <windows.h> | 
| +#endif | 
| + | 
| #include <map> | 
| #include <string> | 
| @@ -24,6 +28,9 @@ | 
| #include "media/media_features.h" | 
| #if defined(OS_WIN) | 
| +#include "base/strings/utf_string_conversions.h" | 
| +#include "chrome/install_static/install_util.h" | 
| +#include "components/browser_watcher/stability_data_names.h" | 
| #include "components/browser_watcher/stability_debugging_win.h" | 
| #endif | 
| @@ -102,6 +109,38 @@ void SetupStabilityDebugging() { | 
| base::debug::GlobalActivityTracker::CreateWithFile( | 
| stability_file, kMemorySize, kAllocatorId, | 
| browser_watcher::kStabilityDebuggingFeature.name, kStackDepth); | 
| + | 
| + // Record basic information: product, version, channel, special build and | 
| + // platform. | 
| + base::debug::GlobalActivityTracker* global_tracker = | 
| + base::debug::GlobalActivityTracker::Get(); | 
| + if (global_tracker) { | 
| + wchar_t exe_file[MAX_PATH] = {}; | 
| + CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file))); | 
| + | 
| + base::string16 product_name; | 
| + base::string16 version_number; | 
| + base::string16 channel_name; | 
| + base::string16 special_build; | 
| + install_static::GetExecutableVersionDetails(exe_file, &product_name, | 
| + &version_number, &special_build, | 
| + &channel_name); | 
| + | 
| + base::debug::ActivityUserData& global_data = global_tracker->user_data(); | 
| + global_data.SetString(browser_watcher::kStabilityProduct, | 
| 
bcwhite
2016/12/06 19:28:43
Feel free to create a SetString method inside Acti
 
manzagop (departed)
2016/12/06 21:39:02
Done.
 | 
| + base::UTF16ToUTF8(product_name)); | 
| + global_data.SetString(browser_watcher::kStabilityVersion, | 
| + base::UTF16ToUTF8(version_number)); | 
| + global_data.SetString(browser_watcher::kStabilityChannel, | 
| + base::UTF16ToUTF8(channel_name)); | 
| + global_data.SetString(browser_watcher::kStabilitySpecialBuild, | 
| + base::UTF16ToUTF8(special_build)); | 
| +#if defined(ARCH_CPU_X86) | 
| + global_data.SetString(browser_watcher::kStabilityPlatform, "Win32"); | 
| 
bcwhite
2016/12/06 19:28:43
Shouldn't these be x86 and x64, given that the def
 
manzagop (departed)
2016/12/06 21:39:03
Yeah... These are the "platform" strings that the
 
bcwhite
2016/12/06 22:37:32
Acknowledged.
 | 
| +#elif defined(ARCH_CPU_X86_64) | 
| + global_data.SetString(browser_watcher::kStabilityPlatform, "Win64"); | 
| +#endif | 
| + } | 
| } | 
| #endif // defined(OS_WIN) |