2020-05-07 20:31:26 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jeremy Apthorp <jeremya@chromium.org>
|
|
|
|
Date: Thu, 30 Apr 2020 10:08:06 -0700
|
|
|
|
Subject: crash: allow setting more options
|
|
|
|
|
|
|
|
This allows the client of //components/crash to set upload url,
|
|
|
|
rate-limiting, compression and global annotations.
|
|
|
|
|
|
|
|
This should be upstreamed.
|
|
|
|
|
|
|
|
diff --git a/components/crash/core/app/crash_reporter_client.cc b/components/crash/core/app/crash_reporter_client.cc
|
2023-07-01 20:22:55 +00:00
|
|
|
index 3f3ed53d48fc4b19642cae847e69982782790e31..51d089f9fa0e1734f98f270a81a200beda71f2f4 100644
|
2020-05-07 20:31:26 +00:00
|
|
|
--- a/components/crash/core/app/crash_reporter_client.cc
|
|
|
|
+++ b/components/crash/core/app/crash_reporter_client.cc
|
2023-07-01 20:22:55 +00:00
|
|
|
@@ -141,6 +141,17 @@ bool CrashReporterClient::ReportingIsEnforcedByPolicy(bool* breakpad_enabled) {
|
2020-05-07 20:31:26 +00:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
+bool CrashReporterClient::GetShouldRateLimit() {
|
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+bool CrashReporterClient::GetShouldCompressUploads() {
|
|
|
|
+ return true;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+void CrashReporterClient::GetProcessSimpleAnnotations(std::map<std::string, std::string>* annotations) {
|
|
|
|
+}
|
|
|
|
+
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_ANDROID)
|
2020-05-07 20:31:26 +00:00
|
|
|
unsigned int CrashReporterClient::GetCrashDumpPercentage() {
|
|
|
|
return 100;
|
|
|
|
diff --git a/components/crash/core/app/crash_reporter_client.h b/components/crash/core/app/crash_reporter_client.h
|
2023-04-13 01:10:31 +00:00
|
|
|
index a604df7a5ea6a1f5613acc032a65668364aadf89..93a8bf787bdaa0e4251a41453eb22062646f4bcb 100644
|
2020-05-07 20:31:26 +00:00
|
|
|
--- a/components/crash/core/app/crash_reporter_client.h
|
|
|
|
+++ b/components/crash/core/app/crash_reporter_client.h
|
2023-04-13 01:10:31 +00:00
|
|
|
@@ -7,6 +7,7 @@
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2020-05-07 20:31:26 +00:00
|
|
|
|
|
|
|
+#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
2021-03-04 17:27:05 +00:00
|
|
|
#include "build/build_config.h"
|
2023-04-13 01:10:31 +00:00
|
|
|
@@ -153,6 +154,19 @@ class CrashReporterClient {
|
2020-05-07 20:31:26 +00:00
|
|
|
// that case, |breakpad_enabled| is set to the value enforced by policies.
|
|
|
|
virtual bool ReportingIsEnforcedByPolicy(bool* breakpad_enabled);
|
|
|
|
|
|
|
|
+ // Returns true if crash uploads should be rate limited. If false, no
|
|
|
|
+ // throttling will be applied for uploads.
|
|
|
|
+ virtual bool GetShouldRateLimit();
|
|
|
|
+
|
|
|
|
+ // Returns true if crash uploads should be compressed with gzip. If false,
|
|
|
|
+ // reports will be uploaded uncompressed.
|
|
|
|
+ virtual bool GetShouldCompressUploads();
|
|
|
|
+
|
|
|
|
+ // Allows the client to add or edit global annotations passed to the crashpad
|
|
|
|
+ // handler.
|
|
|
|
+ virtual void GetProcessSimpleAnnotations(
|
|
|
|
+ std::map<std::string, std::string>* annotations);
|
|
|
|
+
|
2022-02-10 02:58:52 +00:00
|
|
|
#if BUILDFLAG(IS_ANDROID)
|
2020-05-07 20:31:26 +00:00
|
|
|
// Used by WebView to sample crashes without generating the unwanted dumps. If
|
|
|
|
// the returned value is less than 100, crash dumping will be sampled to that
|
2021-07-19 17:11:10 +00:00
|
|
|
diff --git a/components/crash/core/app/crashpad_linux.cc b/components/crash/core/app/crashpad_linux.cc
|
2024-02-29 09:31:13 +00:00
|
|
|
index 171095381e8acff07ae29531537cdadf76b2c462..8963eade0da26f1494ed26e4b6001f37aca82410 100644
|
2021-07-19 17:11:10 +00:00
|
|
|
--- a/components/crash/core/app/crashpad_linux.cc
|
|
|
|
+++ b/components/crash/core/app/crashpad_linux.cc
|
2024-02-21 20:27:05 +00:00
|
|
|
@@ -231,6 +231,7 @@ bool PlatformCrashpadInitialization(
|
2021-07-19 17:11:10 +00:00
|
|
|
// where crash_reporter provides it's own values for lsb-release.
|
|
|
|
annotations["lsb-release"] = base::GetLinuxDistro();
|
|
|
|
#endif
|
|
|
|
+ crash_reporter_client->GetProcessSimpleAnnotations(&annotations);
|
|
|
|
|
|
|
|
std::vector<std::string> arguments;
|
|
|
|
if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) {
|
2024-02-21 20:27:05 +00:00
|
|
|
@@ -252,6 +253,13 @@ bool PlatformCrashpadInitialization(
|
2021-07-19 17:11:10 +00:00
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
+ if (!crash_reporter_client->GetShouldRateLimit()) {
|
|
|
|
+ arguments.push_back("--no-rate-limit");
|
|
|
|
+ }
|
|
|
|
+ if (!crash_reporter_client->GetShouldCompressUploads()) {
|
|
|
|
+ arguments.push_back("--no-upload-gzip");
|
|
|
|
+ }
|
|
|
|
+
|
2022-06-27 20:50:08 +00:00
|
|
|
CHECK(client.StartHandler(handler_path, *database_path, metrics_path, url,
|
|
|
|
annotations, arguments, false, false));
|
|
|
|
} else {
|
2020-05-07 20:31:26 +00:00
|
|
|
diff --git a/components/crash/core/app/crashpad_mac.mm b/components/crash/core/app/crashpad_mac.mm
|
2024-06-07 21:18:35 +00:00
|
|
|
index 42fe73aefe44f218d6a5e8cb1550ff48859c4b70..a1235f0c7ad44ae9c9fdc805af5b9dc5669f5aad 100644
|
2020-05-07 20:31:26 +00:00
|
|
|
--- a/components/crash/core/app/crashpad_mac.mm
|
|
|
|
+++ b/components/crash/core/app/crashpad_mac.mm
|
2024-06-07 21:18:35 +00:00
|
|
|
@@ -86,6 +86,8 @@
|
2020-05-07 20:31:26 +00:00
|
|
|
} // @autoreleasepool
|
|
|
|
return process_annotations;
|
|
|
|
}();
|
|
|
|
+ CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
|
|
|
|
+ crash_reporter_client->GetProcessSimpleAnnotations(&annotations);
|
|
|
|
return annotations;
|
|
|
|
}
|
|
|
|
|
2024-06-07 21:18:35 +00:00
|
|
|
@@ -156,6 +158,13 @@ bool PlatformCrashpadInitialization(
|
2020-05-07 20:31:26 +00:00
|
|
|
|
|
|
|
std::vector<std::string> arguments;
|
|
|
|
|
|
|
|
+ if (!crash_reporter_client->GetShouldRateLimit()) {
|
|
|
|
+ arguments.push_back("--no-rate-limit");
|
|
|
|
+ }
|
|
|
|
+ if (!crash_reporter_client->GetShouldCompressUploads()) {
|
|
|
|
+ arguments.push_back("--no-upload-gzip");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) {
|
|
|
|
arguments.push_back("--monitor-self");
|
|
|
|
}
|
|
|
|
diff --git a/components/crash/core/app/crashpad_win.cc b/components/crash/core/app/crashpad_win.cc
|
2024-05-10 15:21:10 +00:00
|
|
|
index 0e00d26f79231a01e88981b30ff950e427cd31f4..70f014c75031f9529501e102f97e0e1adadb8ffb 100644
|
2020-05-07 20:31:26 +00:00
|
|
|
--- a/components/crash/core/app/crashpad_win.cc
|
|
|
|
+++ b/components/crash/core/app/crashpad_win.cc
|
2024-05-10 15:21:10 +00:00
|
|
|
@@ -92,6 +92,7 @@ bool PlatformCrashpadInitialization(
|
2020-05-07 20:31:26 +00:00
|
|
|
|
|
|
|
std::map<std::string, std::string> process_annotations;
|
|
|
|
GetPlatformCrashpadAnnotations(&process_annotations);
|
|
|
|
+ crash_reporter_client->GetProcessSimpleAnnotations(&process_annotations);
|
|
|
|
|
2020-05-15 03:09:02 +00:00
|
|
|
std::string url = crash_reporter_client->GetUploadUrl();
|
2020-05-07 20:31:26 +00:00
|
|
|
|
2022-07-20 11:03:34 +00:00
|
|
|
@@ -129,6 +130,13 @@ bool PlatformCrashpadInitialization(
|
2020-05-07 20:31:26 +00:00
|
|
|
|
|
|
|
std::vector<std::string> arguments(start_arguments);
|
|
|
|
|
|
|
|
+ if (!crash_reporter_client->GetShouldRateLimit()) {
|
|
|
|
+ arguments.push_back("--no-rate-limit");
|
|
|
|
+ }
|
|
|
|
+ if (!crash_reporter_client->GetShouldCompressUploads()) {
|
|
|
|
+ arguments.push_back("--no-upload-gzip");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
if (crash_reporter_client->ShouldMonitorCrashHandlerExpensively()) {
|
|
|
|
arguments.push_back("--monitor-self");
|
|
|
|
for (const std::string& start_argument : start_arguments) {
|