| Index: components/crash/content/app/crashpad.cc
|
| diff --git a/components/crash/content/app/crashpad.cc b/components/crash/content/app/crashpad.cc
|
| index 85afe46af675145d2b1251ea5a3b9e5989123eb2..6c56a4b139c223a6798981c0a15d0d41f8c9259b 100644
|
| --- a/components/crash/content/app/crashpad.cc
|
| +++ b/components/crash/content/app/crashpad.cc
|
| @@ -264,18 +264,7 @@ void InitializeCrashpadImpl(bool initial_client,
|
| g_database =
|
| crashpad::CrashReportDatabase::Initialize(database_path).release();
|
|
|
| - bool enable_uploads = false;
|
| - if (!crash_reporter_client->ReportingIsEnforcedByPolicy(&enable_uploads)) {
|
| - // Breakpad provided a --disable-breakpad switch to disable crash dumping
|
| - // (not just uploading) here. Crashpad doesn't need it: dumping is enabled
|
| - // unconditionally and uploading is gated on consent, which tests/bots
|
| - // shouldn't have. As a precaution, uploading is also disabled on bots
|
| - // even if consent is present.
|
| - enable_uploads = crash_reporter_client->GetCollectStatsConsent() &&
|
| - !crash_reporter_client->IsRunningUnattended();
|
| - }
|
| -
|
| - SetUploadsEnabled(enable_uploads);
|
| + SetUploadConsent(crash_reporter_client->GetCollectStatsConsent());
|
| }
|
| }
|
|
|
| @@ -292,11 +281,24 @@ void InitializeCrashpadWithEmbeddedHandler(bool initial_client,
|
| }
|
| #endif // OS_WIN
|
|
|
| -void SetUploadsEnabled(bool enable_uploads) {
|
| - if (g_database) {
|
| - crashpad::Settings* settings = g_database->GetSettings();
|
| - settings->SetUploadsEnabled(enable_uploads);
|
| +void SetUploadConsent(bool consent) {
|
| + if (!g_database)
|
| + return;
|
| +
|
| + bool enable_uploads = false;
|
| + CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
|
| + if (!crash_reporter_client->ReportingIsEnforcedByPolicy(&enable_uploads)) {
|
| + // Breakpad provided a --disable-breakpad switch to disable crash dumping
|
| + // (not just uploading) here. Crashpad doesn't need it: dumping is enabled
|
| + // unconditionally and uploading is gated on consent, which tests/bots
|
| + // shouldn't have. As a precaution, uploading is also disabled on bots even
|
| + // if consent is present.
|
| + enable_uploads = consent && !crash_reporter_client->IsRunningUnattended();
|
| }
|
| +
|
| + crashpad::Settings* settings = g_database->GetSettings();
|
| + settings->SetUploadsEnabled(enable_uploads &&
|
| + crash_reporter_client->GetCollectStatsInSample());
|
| }
|
|
|
| bool GetUploadsEnabled() {
|
| @@ -460,6 +462,16 @@ void ReadMainModuleAnnotationsForKasko(
|
|
|
| extern "C" {
|
|
|
| +// This function is used in chrome_metrics_services_manager_client.cc to trigger
|
| +// changes to the upload-enabled state. This is done when the metrics services
|
| +// are initialized, and when the user changes their consent for uploads. See
|
| +// crash_reporter::SetUploadConsent for effects.
|
| +void __declspec(dllexport) __cdecl SetUploadConsentImpl(bool consent) {
|
| + DCHECK_EQ(consent,
|
| + crash_reporter::GetCrashReporterClient()->GetCollectStatsConsent());
|
| + crash_reporter::SetUploadConsent(consent);
|
| +}
|
| +
|
| // NOTE: This function is used by SyzyASAN to annotate crash reports. If you
|
| // change the name or signature of this function you will break SyzyASAN
|
| // instrumented releases of Chrome. Please contact syzygy-team@chromium.org
|
|
|