Commit 09c0c274 authored by manzagop's avatar manzagop Committed by Commit bot

Record executable version details to stability file

BUG=620813

Review-Url: https://codereview.chromium.org/2556813002
Cr-Commit-Position: refs/heads/master@{#437719}
parent d96dd555
...@@ -26,6 +26,7 @@ ...@@ -26,6 +26,7 @@
#include "base/gtest_prod_util.h" #include "base/gtest_prod_util.h"
#include "base/location.h" #include "base/location.h"
#include "base/metrics/persistent_memory_allocator.h" #include "base/metrics/persistent_memory_allocator.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/platform_thread.h" #include "base/threading/platform_thread.h"
#include "base/threading/thread_checker.h" #include "base/threading/thread_checker.h"
#include "base/threading/thread_local_storage.h" #include "base/threading/thread_local_storage.h"
...@@ -361,6 +362,9 @@ class BASE_EXPORT ActivityUserData { ...@@ -361,6 +362,9 @@ class BASE_EXPORT ActivityUserData {
void SetString(StringPiece name, StringPiece value) { void SetString(StringPiece name, StringPiece value) {
Set(name, STRING_VALUE, value.data(), value.length()); Set(name, STRING_VALUE, value.data(), value.length());
} }
void SetString(StringPiece name, StringPiece16 value) {
SetString(name, UTF16ToUTF8(value));
}
void SetBool(StringPiece name, bool value) { void SetBool(StringPiece name, bool value) {
char cvalue = value ? 1 : 0; char cvalue = value ? 1 : 0;
Set(name, BOOL_VALUE, &cvalue, sizeof(cvalue)); Set(name, BOOL_VALUE, &cvalue, sizeof(cvalue));
......
...@@ -3496,6 +3496,7 @@ split_static_library("browser") { ...@@ -3496,6 +3496,7 @@ split_static_library("browser") {
"//chrome_elf:dll_hash", "//chrome_elf:dll_hash",
"//components/browser_watcher", "//components/browser_watcher",
"//components/browser_watcher:browser_watcher_client", "//components/browser_watcher:browser_watcher_client",
"//components/browser_watcher:stability_data",
"//google_update", "//google_update",
"//third_party/crashpad/crashpad/client:client", "//third_party/crashpad/crashpad/client:client",
"//third_party/iaccessible2", "//third_party/iaccessible2",
......
...@@ -4,6 +4,10 @@ ...@@ -4,6 +4,10 @@
#include "chrome/browser/chrome_browser_field_trials_desktop.h" #include "chrome/browser/chrome_browser_field_trials_desktop.h"
#if defined(OS_WIN)
#include <windows.h>
#endif
#include <map> #include <map>
#include <string> #include <string>
...@@ -24,6 +28,8 @@ ...@@ -24,6 +28,8 @@
#include "media/media_features.h" #include "media/media_features.h"
#if defined(OS_WIN) #if defined(OS_WIN)
#include "chrome/install_static/install_util.h"
#include "components/browser_watcher/stability_data_names.h"
#include "components/browser_watcher/stability_debugging_win.h" #include "components/browser_watcher/stability_debugging_win.h"
#endif #endif
...@@ -102,6 +108,35 @@ void SetupStabilityDebugging() { ...@@ -102,6 +108,35 @@ void SetupStabilityDebugging() {
base::debug::GlobalActivityTracker::CreateWithFile( base::debug::GlobalActivityTracker::CreateWithFile(
stability_file, kMemorySize, kAllocatorId, stability_file, kMemorySize, kAllocatorId,
browser_watcher::kStabilityDebuggingFeature.name, kStackDepth); 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, product_name);
global_data.SetString(browser_watcher::kStabilityVersion, version_number);
global_data.SetString(browser_watcher::kStabilityChannel, channel_name);
global_data.SetString(browser_watcher::kStabilitySpecialBuild,
special_build);
#if defined(ARCH_CPU_X86)
global_data.SetString(browser_watcher::kStabilityPlatform, "Win32");
#elif defined(ARCH_CPU_X86_64)
global_data.SetString(browser_watcher::kStabilityPlatform, "Win64");
#endif
}
} }
#endif // defined(OS_WIN) #endif // defined(OS_WIN)
......
...@@ -83,6 +83,13 @@ static_library("stability") { ...@@ -83,6 +83,13 @@ static_library("stability") {
] ]
} }
static_library("stability_data") {
sources = [
"stability_data_names.cc",
"stability_data_names.h",
]
}
source_set("unit_tests") { source_set("unit_tests") {
testonly = true testonly = true
sources = [ sources = [
......
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/browser_watcher/stability_data_names.h"
namespace browser_watcher {
const char kStabilityChannel[] = "channel";
const char kStabilityPlatform[] = "platform";
const char kStabilityProduct[] = "product";
const char kStabilitySpecialBuild[] = "special-build";
const char kStabilityVersion[] = "version";
} // namespace browser_watcher
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_BROWSER_WATCHER_STABILITY_DATA_NAMES_H_
#define COMPONENTS_BROWSER_WATCHER_STABILITY_DATA_NAMES_H_
namespace browser_watcher {
// Alphabetical list of stability data names.
extern const char kStabilityChannel[];
extern const char kStabilityPlatform[];
extern const char kStabilityProduct[];
extern const char kStabilitySpecialBuild[];
extern const char kStabilityVersion[];
} // namespace browser_watcher
#endif // COMPONENTS_BROWSER_WATCHER_STABILITY_DATA_NAMES_H_
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment