Reland "Add CrashReporterClient::GetProductInfo(ProductInfo*)"
This is a reland of commit 49d3a5a2bc
This reland fixes the compile errors on casto builds.
See patchset 1..2 for diff.
Original change's description:
> Add CrashReporterClient::GetProductInfo(ProductInfo*)
>
> This method unifies the other two existing GetProductNameAndVersion()
> functions, simplifying the CrashReporterClient interface.
>
> This is a step towards providing an interface for accessing product info
> through crash_export_thunks, which will be used in JS Error reporting on
> Windows.
>
> Bug: 40149439, 374696525
> Low-Coverage-Reason: TESTS_IN_SEPARATE_CL, the new interface will be used in future CLs.
> Change-Id: Ic198b69764721b7d03cf71fb9f79a8392fe3d8d1
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6012865
> Reviewed-by: Alexander Timin <altimin@chromium.org>
> Commit-Queue: Keren Zhu <kerenzhu@chromium.org>
> Reviewed-by: Mark Mentovai <mark@chromium.org>
> Reviewed-by: Nate Fischer <ntfschr@chromium.org>
> Cr-Commit-Position: refs/heads/main@{#1382090}
Bug: 40149439, 374696525
Change-Id: I4b1ad56c84081736e1df5051706bbd9695727c58
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6012631
Reviewed-by: Nate Fischer <ntfschr@chromium.org>
Reviewed-by: Vigen Issahhanjan <vigeni@google.com>
Reviewed-by: Mark Mentovai <mark@chromium.org>
Commit-Queue: Keren Zhu <kerenzhu@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1383219}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
9d0b5dfab5
commit
408052b7bf
android_webview/common/crash_reporter
chrome
app
chrome_crash_reporter_client.ccchrome_crash_reporter_client.hchrome_crash_reporter_client_win.ccchrome_crash_reporter_client_win.h
browser
error_reporting
chromecast/app/android
components/crash
content
browser
error_reporting
core
content/shell/app
headless/lib
@ -56,12 +56,10 @@ class AwCrashReporterClient : public crash_reporter::CrashReporterClient {
|
||||
return false;
|
||||
}
|
||||
|
||||
void GetProductNameAndVersion(std::string* product_name,
|
||||
std::string* version,
|
||||
std::string* channel) override {
|
||||
*product_name = "AndroidWebView";
|
||||
*version = PRODUCT_VERSION;
|
||||
*channel =
|
||||
void GetProductInfo(ProductInfo* product_info) override {
|
||||
product_info->product_name = "AndroidWebView";
|
||||
product_info->version = PRODUCT_VERSION;
|
||||
product_info->channel =
|
||||
version_info::GetChannelString(version_info::android::GetChannel());
|
||||
}
|
||||
|
||||
|
@ -22,12 +22,12 @@
|
||||
#include "chrome/common/env_vars.h"
|
||||
#include "chrome/installer/util/google_update_settings.h"
|
||||
#include "components/crash/core/common/crash_keys.h"
|
||||
#include "components/version_info/version_info_values.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
#include "components/upload_list/crash_upload_list.h"
|
||||
#include "components/version_info/version_info.h"
|
||||
#include "components/version_info/version_info_values.h"
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_POSIX)
|
||||
@ -113,40 +113,6 @@ void ChromeCrashReporterClient::SetCrashReporterClientIdFromGUID(
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
void ChromeCrashReporterClient::GetProductNameAndVersion(
|
||||
const char** product_name,
|
||||
const char** version) {
|
||||
DCHECK(product_name);
|
||||
DCHECK(version);
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
*product_name = "Chrome_Android";
|
||||
#elif BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
*product_name = "Chrome_ChromeOS";
|
||||
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
*product_name = "Chrome_Lacros";
|
||||
#else // BUILDFLAG(IS_ANDROID)
|
||||
#if !defined(ADDRESS_SANITIZER)
|
||||
*product_name = "Chrome_Linux";
|
||||
#else
|
||||
*product_name = "Chrome_Linux_ASan";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
*version = PRODUCT_VERSION;
|
||||
}
|
||||
|
||||
void ChromeCrashReporterClient::GetProductNameAndVersion(
|
||||
std::string* product_name,
|
||||
std::string* version,
|
||||
std::string* channel) {
|
||||
const char* c_product_name;
|
||||
const char* c_version;
|
||||
GetProductNameAndVersion(&c_product_name, &c_version);
|
||||
*product_name = c_product_name;
|
||||
*version = c_version;
|
||||
*channel = chrome::GetChannelName(chrome::WithExtendedStable(true));
|
||||
}
|
||||
|
||||
base::FilePath ChromeCrashReporterClient::GetReporterLogFilename() {
|
||||
return base::FilePath(CrashUploadList::kReporterLogFilename);
|
||||
}
|
||||
@ -161,11 +127,40 @@ bool ChromeCrashReporterClient::GetCrashDumpLocation(
|
||||
return base::PathService::Get(chrome::DIR_CRASH_DUMPS, crash_dir);
|
||||
}
|
||||
|
||||
void ChromeCrashReporterClient::GetProductInfo(ProductInfo* product_info) {
|
||||
CHECK(product_info);
|
||||
|
||||
#if BUILDFLAG(IS_ANDROID)
|
||||
product_info->product_name = "Chrome_Android";
|
||||
#elif BUILDFLAG(IS_CHROMEOS_ASH)
|
||||
product_info->product_name = "Chrome_ChromeOS";
|
||||
#elif BUILDFLAG(IS_CHROMEOS_LACROS)
|
||||
product_info->product_name = "Chrome_Lacros";
|
||||
#elif BUILDFLAG(IS_LINUX)
|
||||
#if defined(ADDRESS_SANITIZER)
|
||||
product_info->product_name = "Chrome_Linux_ASan";
|
||||
#else
|
||||
product_info->product_name = "Chrome_Linux";
|
||||
#endif // defined(ADDRESS_SANITIZER)
|
||||
#elif BUILDFLAG(IS_MAC)
|
||||
product_info->product_name = "Chrome_Mac";
|
||||
#elif BUILDFLAG(IS_WIN)
|
||||
product_info->product_name = "Chrome";
|
||||
#else
|
||||
NOTREACHED();
|
||||
#endif
|
||||
|
||||
product_info->version = PRODUCT_VERSION;
|
||||
product_info->channel =
|
||||
chrome::GetChannelName(chrome::WithExtendedStable(true));
|
||||
}
|
||||
|
||||
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
bool ChromeCrashReporterClient::GetCrashMetricsLocation(
|
||||
base::FilePath* metrics_dir) {
|
||||
if (!GetCollectStatsConsent())
|
||||
if (!GetCollectStatsConsent()) {
|
||||
return false;
|
||||
}
|
||||
return base::PathService::Get(chrome::DIR_CRASH_METRICS, metrics_dir);
|
||||
}
|
||||
#endif // BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
|
@ -44,17 +44,13 @@ class ChromeCrashReporterClient : public crash_reporter::CrashReporterClient {
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
void GetProductNameAndVersion(const char** product_name,
|
||||
const char** version) override;
|
||||
void GetProductNameAndVersion(std::string* product_name,
|
||||
std::string* version,
|
||||
std::string* channel) override;
|
||||
base::FilePath GetReporterLogFilename() override;
|
||||
|
||||
bool GetShouldDumpLargerDumps() override;
|
||||
#endif
|
||||
|
||||
bool GetCrashDumpLocation(base::FilePath* crash_dir) override;
|
||||
void GetProductInfo(ProductInfo* product_info) override;
|
||||
|
||||
#if BUILDFLAG(IS_MAC) || BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
|
||||
bool GetCrashMetricsLocation(base::FilePath* metrics_dir) override;
|
||||
|
@ -38,8 +38,9 @@ ChromeCrashReporterClient::~ChromeCrashReporterClient() {}
|
||||
// static
|
||||
void ChromeCrashReporterClient::InitializeCrashReportingForProcess() {
|
||||
static ChromeCrashReporterClient* instance = nullptr;
|
||||
if (instance)
|
||||
if (instance) {
|
||||
return;
|
||||
}
|
||||
|
||||
instance = new ChromeCrashReporterClient();
|
||||
ANNOTATE_LEAKING_OBJECT_PTR(instance);
|
||||
@ -54,8 +55,9 @@ void ChromeCrashReporterClient::InitializeCrashReportingForProcess() {
|
||||
crash_reporter::SetCrashReporterClient(instance);
|
||||
|
||||
std::wstring user_data_dir;
|
||||
if (process_type.empty())
|
||||
if (process_type.empty()) {
|
||||
install_static::GetUserDataDirectory(&user_data_dir, nullptr);
|
||||
}
|
||||
|
||||
// TODO(wfh): Add a DCHECK for success. See https://crbug.com/1329269.
|
||||
std::ignore = crash_reporter::InitializeCrashpadWithEmbeddedHandler(
|
||||
@ -88,6 +90,17 @@ void ChromeCrashReporterClient::GetProductNameAndVersion(
|
||||
special_build, channel_name);
|
||||
}
|
||||
|
||||
void ChromeCrashReporterClient::GetProductInfo(ProductInfo* product_info) {
|
||||
std::wstring product_name, version, special_build, channel_name;
|
||||
wchar_t exe_file[MAX_PATH] = {};
|
||||
CHECK(::GetModuleFileName(nullptr, exe_file, std::size(exe_file)));
|
||||
GetProductNameAndVersion(exe_file, &product_name, &version, &special_build,
|
||||
&channel_name);
|
||||
product_info->product_name = base::WideToUTF8(product_name);
|
||||
product_info->version = base::WideToUTF8(version);
|
||||
product_info->channel = base::WideToUTF8(channel_name);
|
||||
}
|
||||
|
||||
bool ChromeCrashReporterClient::GetShouldDumpLargerDumps() {
|
||||
// Capture larger dumps for Google Chrome beta, dev, and canary channels, and
|
||||
// Chromium builds. The Google Chrome stable channel uses smaller dumps.
|
||||
@ -112,8 +125,9 @@ bool ChromeCrashReporterClient::GetCrashDumpLocation(std::wstring* crash_dir) {
|
||||
// short-circuit how it's handled on Windows. Honoring this
|
||||
// variable is required in order to symbolize stack traces in
|
||||
// Telemetry based tests: http://crbug.com/561763.
|
||||
if (GetAlternativeCrashDumpLocation(crash_dir))
|
||||
if (GetAlternativeCrashDumpLocation(crash_dir)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
*crash_dir = install_static::GetCrashDumpLocation();
|
||||
return !crash_dir->empty();
|
||||
@ -121,8 +135,9 @@ bool ChromeCrashReporterClient::GetCrashDumpLocation(std::wstring* crash_dir) {
|
||||
|
||||
bool ChromeCrashReporterClient::GetCrashMetricsLocation(
|
||||
std::wstring* metrics_dir) {
|
||||
if (!GetCollectStatsConsent())
|
||||
if (!GetCollectStatsConsent()) {
|
||||
return false;
|
||||
}
|
||||
install_static::GetUserDataDirectory(metrics_dir, nullptr);
|
||||
return !metrics_dir->empty();
|
||||
}
|
||||
@ -184,14 +199,16 @@ std::wstring ChromeCrashReporterClient::GetWerRuntimeExceptionModule() {
|
||||
DWORD len = GetModuleFileName(CURRENT_MODULE(), elf_file, MAX_PATH);
|
||||
// On error return an empty path to indicate than a module is not to be
|
||||
// registered. This is harmless.
|
||||
if (len == 0 || len == MAX_PATH)
|
||||
if (len == 0 || len == MAX_PATH) {
|
||||
return std::wstring();
|
||||
}
|
||||
|
||||
wchar_t elf_dir[MAX_PATH];
|
||||
wchar_t* file_start = nullptr;
|
||||
DWORD dir_len = GetFullPathName(elf_file, MAX_PATH, elf_dir, &file_start);
|
||||
if (dir_len == 0 || dir_len > len || !file_start)
|
||||
if (dir_len == 0 || dir_len > len || !file_start) {
|
||||
return std::wstring();
|
||||
}
|
||||
|
||||
// file_start points to the start of the filename in the elf_dir buffer.
|
||||
return std::wstring(elf_dir, file_start).append(kWerDll);
|
||||
|
@ -29,6 +29,7 @@ class ChromeCrashReporterClient : public crash_reporter::CrashReporterClient {
|
||||
std::wstring* version,
|
||||
std::wstring* special_build,
|
||||
std::wstring* channel_name) override;
|
||||
void GetProductInfo(ProductInfo* product_info) override;
|
||||
bool GetShouldDumpLargerDumps() override;
|
||||
|
||||
bool GetCrashDumpLocation(std::wstring* crash_dir) override;
|
||||
|
@ -164,7 +164,7 @@ TEST_F(ChromeJsErrorReportProcessorTest, Basic) {
|
||||
// This is from MockChromeJsErrorReportProcessor::GetOsVersion()
|
||||
EXPECT_THAT(actual_report->query, HasSubstr("os_version=7.20.1"));
|
||||
#endif
|
||||
// These are from MockCrashEndpoint::Client::GetProductNameAndVersion, which
|
||||
// These are from MockCrashEndpoint::Client::GetProductInfo, which
|
||||
// is only defined for non-MAC POSIX systems. TODO(crbug.com/40146362):
|
||||
// Get this info for non-POSIX platforms.
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
@ -232,7 +232,7 @@ void ChromeJsErrorReportProcessorTest::TestAllFields() {
|
||||
// This is from MockChromeJsErrorReportProcessor::GetOsVersion()
|
||||
EXPECT_THAT(actual_report->query, HasSubstr("os_version=7.20.1"));
|
||||
#endif
|
||||
// These are from MockCrashEndpoint::Client::GetProductNameAndVersion, which
|
||||
// These are from MockCrashEndpoint::Client::GetProductInfo, which
|
||||
// is only defined for non-MAC POSIX systems. TODO(crbug.com/40146362):
|
||||
// Get this info for non-POSIX platforms.
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
|
@ -18,24 +18,20 @@ namespace chromecast {
|
||||
|
||||
CastCrashReporterClientAndroid::CastCrashReporterClientAndroid(
|
||||
const std::string& process_type)
|
||||
: process_type_(process_type) {
|
||||
}
|
||||
: process_type_(process_type) {}
|
||||
|
||||
CastCrashReporterClientAndroid::~CastCrashReporterClientAndroid() {
|
||||
}
|
||||
CastCrashReporterClientAndroid::~CastCrashReporterClientAndroid() {}
|
||||
|
||||
void CastCrashReporterClientAndroid::GetProductNameAndVersion(
|
||||
std::string* product_name,
|
||||
std::string* version,
|
||||
std::string* channel) {
|
||||
*product_name = "media_shell";
|
||||
*version = CAST_BUILD_RELEASE ".";
|
||||
*version += base::android::BuildInfo::GetInstance()->package_version_code();
|
||||
void CastCrashReporterClientAndroid::GetProductInfo(ProductInfo* product_info) {
|
||||
product_info->product_name = "media_shell";
|
||||
product_info->version = CAST_BUILD_RELEASE ".";
|
||||
product_info->version +=
|
||||
base::android::BuildInfo::GetInstance()->package_version_code();
|
||||
#if CAST_IS_DEBUG_BUILD()
|
||||
*version += ".debug";
|
||||
product_info->version += ".debug";
|
||||
#endif
|
||||
CastSysInfoAndroid sys_info;
|
||||
*channel = sys_info.GetSystemReleaseChannel();
|
||||
product_info->channel = sys_info.GetSystemReleaseChannel();
|
||||
}
|
||||
|
||||
base::FilePath CastCrashReporterClientAndroid::GetReporterLogFilename() {
|
||||
|
@ -29,9 +29,7 @@ class CastCrashReporterClientAndroid
|
||||
base::FilePath* crash_dir);
|
||||
|
||||
// crash_reporter::CrashReporterClient implementation:
|
||||
void GetProductNameAndVersion(std::string* product_name,
|
||||
std::string* version,
|
||||
std::string* channel) override;
|
||||
void GetProductInfo(ProductInfo* product_info) override;
|
||||
base::FilePath GetReporterLogFilename() override;
|
||||
bool GetCrashDumpLocation(base::FilePath* crash_dir) override;
|
||||
bool EnableBreakpadForProcess(const std::string& process_type) override;
|
||||
|
@ -31,15 +31,11 @@ class MockCrashEndpoint::Client : public crash_reporter::CrashReporterClient {
|
||||
FROM_HERE, base::BlockingType::MAY_BLOCK);
|
||||
return owner_->consented_;
|
||||
}
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
void GetProductNameAndVersion(std::string* product_name,
|
||||
std::string* version,
|
||||
std::string* channel) override {
|
||||
*product_name = "Chrome_ChromeOS";
|
||||
*version = "1.2.3.4";
|
||||
*channel = "Stable";
|
||||
void GetProductInfo(ProductInfo* product_info) override {
|
||||
product_info->product_name = "Chrome_ChromeOS";
|
||||
product_info->version = "1.2.3.4";
|
||||
product_info->channel = "Stable";
|
||||
}
|
||||
#endif
|
||||
private:
|
||||
raw_ptr<MockCrashEndpoint> owner_;
|
||||
};
|
||||
|
@ -1066,15 +1066,13 @@ void HandleCrashDump(const BreakpadInfo& info) {
|
||||
|
||||
MimeWriter writer(temp_file_fd, mime_boundary);
|
||||
{
|
||||
const char* product_name = "";
|
||||
const char* version = "";
|
||||
|
||||
GetCrashReporterClient()->GetProductNameAndVersion(&product_name, &version);
|
||||
crash_reporter::CrashReporterClient::ProductInfo product_info;
|
||||
GetCrashReporterClient()->GetProductInfo(&product_info);
|
||||
|
||||
writer.AddBoundary();
|
||||
writer.AddPairString("prod", product_name);
|
||||
writer.AddPairString("prod", product_info.product_name.c_str());
|
||||
writer.AddBoundary();
|
||||
writer.AddPairString("ver", version);
|
||||
writer.AddPairString("ver", product_info.version.c_str());
|
||||
writer.AddBoundary();
|
||||
if (info.pid > 0) {
|
||||
char pid_value_buf[kUint64StringSize];
|
||||
|
@ -17,7 +17,11 @@ bool GetClientCollectStatsConsent() {
|
||||
void GetClientProductNameAndVersion(std::string* product,
|
||||
std::string* version,
|
||||
std::string* channel) {
|
||||
GetCrashReporterClient()->GetProductNameAndVersion(product, version, channel);
|
||||
CrashReporterClient::ProductInfo product_info;
|
||||
GetCrashReporterClient()->GetProductInfo(&product_info);
|
||||
*product = product_info.product_name;
|
||||
*version = product_info.version;
|
||||
*channel = product_info.channel;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -41,6 +41,9 @@ CrashReporterClient* GetCrashReporterClient() {
|
||||
CrashReporterClient::CrashReporterClient() = default;
|
||||
CrashReporterClient::~CrashReporterClient() = default;
|
||||
|
||||
CrashReporterClient::ProductInfo::ProductInfo() = default;
|
||||
CrashReporterClient::ProductInfo::~ProductInfo() = default;
|
||||
|
||||
#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_WIN) && !BUILDFLAG(IS_ANDROID)
|
||||
void CrashReporterClient::SetCrashReporterClientIdFromGUID(
|
||||
const std::string& client_guid) {}
|
||||
@ -71,14 +74,6 @@ bool CrashReporterClient::GetShouldDumpLargerDumps() {
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
void CrashReporterClient::GetProductNameAndVersion(const char** product_name,
|
||||
const char** version) {
|
||||
}
|
||||
|
||||
void CrashReporterClient::GetProductNameAndVersion(std::string* product_name,
|
||||
std::string* version,
|
||||
std::string* channel) {}
|
||||
|
||||
base::FilePath CrashReporterClient::GetReporterLogFilename() {
|
||||
return base::FilePath();
|
||||
}
|
||||
@ -105,6 +100,8 @@ bool CrashReporterClient::GetCrashMetricsLocation(base::FilePath* crash_dir) {
|
||||
return false;
|
||||
}
|
||||
|
||||
void CrashReporterClient::GetProductInfo(ProductInfo* product_info) {}
|
||||
|
||||
bool CrashReporterClient::IsRunningUnattended() {
|
||||
return true;
|
||||
}
|
||||
|
@ -34,6 +34,15 @@ CrashReporterClient* GetCrashReporterClient();
|
||||
// Interface that the embedder implements.
|
||||
class CrashReporterClient {
|
||||
public:
|
||||
struct ProductInfo {
|
||||
ProductInfo();
|
||||
~ProductInfo();
|
||||
|
||||
std::string product_name;
|
||||
std::string version;
|
||||
std::string channel;
|
||||
};
|
||||
|
||||
CrashReporterClient();
|
||||
virtual ~CrashReporterClient();
|
||||
|
||||
@ -73,16 +82,6 @@ class CrashReporterClient {
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
// Returns a textual description of the product type and version to include
|
||||
// in the crash report. Neither out parameter should be set to NULL.
|
||||
// TODO(jperaza): Remove the 2-parameter overload of this method once all
|
||||
// Linux-ish breakpad clients have transitioned to crashpad.
|
||||
virtual void GetProductNameAndVersion(const char** product_name,
|
||||
const char** version);
|
||||
virtual void GetProductNameAndVersion(std::string* product_name,
|
||||
std::string* version,
|
||||
std::string* channel);
|
||||
|
||||
virtual base::FilePath GetReporterLogFilename();
|
||||
|
||||
// Custom crash minidump handler after the minidump is generated.
|
||||
@ -114,6 +113,10 @@ class CrashReporterClient {
|
||||
virtual bool GetCrashMetricsLocation(base::FilePath* metrics_dir);
|
||||
#endif
|
||||
|
||||
// Returns a textual description of the product info (product name, version,
|
||||
// etc.) to include in the crash report.
|
||||
virtual void GetProductInfo(ProductInfo* product_info);
|
||||
|
||||
// Returns true if running in unattended mode (for automated testing).
|
||||
virtual bool IsRunningUnattended();
|
||||
|
||||
|
@ -435,13 +435,10 @@ void BuildHandlerArgs(CrashReporterClient* crash_reporter_client,
|
||||
// TODO(jperaza): Set URL for Android when Crashpad takes over report upload.
|
||||
*url = std::string();
|
||||
|
||||
std::string product_name;
|
||||
std::string product_version;
|
||||
std::string channel;
|
||||
crash_reporter_client->GetProductNameAndVersion(&product_name,
|
||||
&product_version, &channel);
|
||||
(*process_annotations)["prod"] = product_name;
|
||||
(*process_annotations)["ver"] = product_version;
|
||||
CrashReporterClient::ProductInfo product_info;
|
||||
crash_reporter_client->GetProductInfo(&product_info);
|
||||
(*process_annotations)["prod"] = product_info.product_name;
|
||||
(*process_annotations)["ver"] = product_info.version;
|
||||
|
||||
SetBuildInfoAnnotations(process_annotations);
|
||||
|
||||
@ -451,8 +448,8 @@ void BuildHandlerArgs(CrashReporterClient* crash_reporter_client,
|
||||
#else
|
||||
const bool allow_empty_channel = false;
|
||||
#endif
|
||||
if (allow_empty_channel || !channel.empty()) {
|
||||
(*process_annotations)["channel"] = channel;
|
||||
if (allow_empty_channel || !product_info.channel.empty()) {
|
||||
(*process_annotations)["channel"] = product_info.channel;
|
||||
}
|
||||
|
||||
(*process_annotations)["plat"] = std::string("Android");
|
||||
|
@ -184,27 +184,26 @@ bool PlatformCrashpadInitialization(
|
||||
url = std::string();
|
||||
#endif
|
||||
|
||||
std::string product_name, product_version, channel;
|
||||
crash_reporter_client->GetProductNameAndVersion(&product_name,
|
||||
&product_version, &channel);
|
||||
CrashReporterClient::ProductInfo product_info;
|
||||
crash_reporter_client->GetProductInfo(&product_info);
|
||||
|
||||
std::map<std::string, std::string> annotations;
|
||||
annotations["prod"] = product_name;
|
||||
annotations["ver"] = product_version;
|
||||
annotations["prod"] = product_info.product_name;
|
||||
annotations["ver"] = product_info.version;
|
||||
|
||||
#if BUILDFLAG(GOOGLE_CHROME_BRANDING)
|
||||
// Empty means stable.
|
||||
const bool allow_empty_channel = true;
|
||||
if (channel == "extended") {
|
||||
if (product_info.channel == "extended") {
|
||||
// Extended stable reports as stable (empty string) with an extra bool.
|
||||
channel.clear();
|
||||
product_info.channel.clear();
|
||||
annotations["extended_stable_channel"] = "true";
|
||||
}
|
||||
#else
|
||||
const bool allow_empty_channel = false;
|
||||
#endif
|
||||
if (allow_empty_channel || !channel.empty()) {
|
||||
annotations["channel"] = channel;
|
||||
if (allow_empty_channel || !product_info.channel.empty()) {
|
||||
annotations["channel"] = product_info.channel;
|
||||
}
|
||||
|
||||
annotations["plat"] = std::string("Linux");
|
||||
|
@ -38,22 +38,6 @@ void ShellCrashReporterClient::GetProductNameAndVersion(
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
void ShellCrashReporterClient::GetProductNameAndVersion(
|
||||
const char** product_name,
|
||||
const char** version) {
|
||||
*product_name = "content_shell";
|
||||
*version = CONTENT_SHELL_VERSION;
|
||||
}
|
||||
|
||||
void ShellCrashReporterClient::GetProductNameAndVersion(
|
||||
std::string* product_name,
|
||||
std::string* version,
|
||||
std::string* channel) {
|
||||
*product_name = "content_shell";
|
||||
*version = CONTENT_SHELL_VERSION;
|
||||
*channel = "";
|
||||
}
|
||||
|
||||
base::FilePath ShellCrashReporterClient::GetReporterLogFilename() {
|
||||
return base::FilePath(FILE_PATH_LITERAL("uploads.log"));
|
||||
}
|
||||
@ -78,6 +62,11 @@ bool ShellCrashReporterClient::GetCrashDumpLocation(base::FilePath* crash_dir) {
|
||||
return true;
|
||||
}
|
||||
|
||||
void ShellCrashReporterClient::GetProductInfo(ProductInfo* product_info) {
|
||||
product_info->product_name = "content_shell";
|
||||
product_info->version = CONTENT_SHELL_VERSION;
|
||||
}
|
||||
|
||||
bool ShellCrashReporterClient::EnableBreakpadForProcess(
|
||||
const std::string& process_type) {
|
||||
return process_type == switches::kRendererProcess ||
|
||||
|
@ -30,13 +30,6 @@ class ShellCrashReporterClient : public crash_reporter::CrashReporterClient {
|
||||
#endif
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
// Returns a textual description of the product type and version to include
|
||||
// in the crash report.
|
||||
void GetProductNameAndVersion(const char** product_name,
|
||||
const char** version) override;
|
||||
void GetProductNameAndVersion(std::string* product_name,
|
||||
std::string* version,
|
||||
std::string* channel) override;
|
||||
base::FilePath GetReporterLogFilename() override;
|
||||
#endif
|
||||
|
||||
@ -48,6 +41,7 @@ class ShellCrashReporterClient : public crash_reporter::CrashReporterClient {
|
||||
bool GetCrashDumpLocation(base::FilePath* crash_dir) override;
|
||||
#endif
|
||||
|
||||
void GetProductInfo(ProductInfo* product_info) override;
|
||||
bool EnableBreakpadForProcess(const std::string& process_type) override;
|
||||
};
|
||||
|
||||
|
@ -18,28 +18,18 @@
|
||||
namespace headless {
|
||||
|
||||
namespace {
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
|
||||
constexpr char kChromeHeadlessProductName[] = "Chrome_Headless";
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace
|
||||
|
||||
HeadlessCrashReporterClient::HeadlessCrashReporterClient() = default;
|
||||
HeadlessCrashReporterClient::~HeadlessCrashReporterClient() = default;
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
void HeadlessCrashReporterClient::GetProductNameAndVersion(
|
||||
std::string* product_name,
|
||||
std::string* version,
|
||||
std::string* channel) {
|
||||
*product_name = kChromeHeadlessProductName;
|
||||
*version = PRODUCT_VERSION;
|
||||
*channel = "";
|
||||
void HeadlessCrashReporterClient::GetProductInfo(
|
||||
ProductInfo* product_info) {
|
||||
product_info->product_name = kChromeHeadlessProductName;
|
||||
product_info->version = PRODUCT_VERSION;
|
||||
product_info->channel = "";
|
||||
}
|
||||
#endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
|
||||
bool HeadlessCrashReporterClient::GetCrashDumpLocation(
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
|
@ -28,11 +28,7 @@ class HeadlessCrashReporterClient : public crash_reporter::CrashReporterClient {
|
||||
}
|
||||
const base::FilePath& crash_dumps_dir() const { return crash_dumps_dir_; }
|
||||
|
||||
#if BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
void GetProductNameAndVersion(std::string* product_name,
|
||||
std::string* version,
|
||||
std::string* channel) override;
|
||||
#endif // BUILDFLAG(IS_POSIX) && !BUILDFLAG(IS_MAC)
|
||||
void GetProductInfo(ProductInfo* product_info) override;
|
||||
|
||||
#if BUILDFLAG(IS_WIN)
|
||||
bool GetCrashDumpLocation(std::wstring* crash_dir) override;
|
||||
|
Reference in New Issue
Block a user