Chromium Code Reviews| 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..a20bea46a5ccf080bf62847408e30a92897f7464 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); |
| + UpdateUploadsEnabled(crash_reporter_client->GetCollectStatsConsent()); |
| } |
| } |
| @@ -292,10 +281,24 @@ void InitializeCrashpadWithEmbeddedHandler(bool initial_client, |
| } |
| #endif // OS_WIN |
| -void SetUploadsEnabled(bool enable_uploads) { |
| +void UpdateUploadsEnabled(bool consent) { |
| if (g_database) { |
|
Alexei Svitkine (slow)
2016/08/17 20:37:48
Nit: Early return instead.
jwd
2016/08/17 21:55:59
Done.
|
| + 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 |
|
Mark Mentovai
2016/08/17 20:59:07
What’s up with this indentation?
jwd
2016/08/17 21:55:59
Done.
|
| + // 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(); |
| + } |
|
Alexei Svitkine (slow)
2016/08/17 20:37:48
Nit: Indent is off. Run git cl format.
jwd
2016/08/17 21:55:59
Done.
|
| + |
| + |
|
Alexei Svitkine (slow)
2016/08/17 20:37:48
Nit: Remove extra blank line.
jwd
2016/08/17 21:55:59
Done.
|
| crashpad::Settings* settings = g_database->GetSettings(); |
| - settings->SetUploadsEnabled(enable_uploads); |
| + settings->SetUploadsEnabled( |
| + enable_uploads && crash_reporter_client->GetCollectStatsInSample()); |
| } |
| } |
| @@ -460,6 +463,14 @@ 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::UpdateUploadsEnabled for effects. |
| +void __declspec(dllexport) __cdecl UpdateUploadsEnabledImpl(bool consent) { |
| + crash_reporter::UpdateUploadsEnabled(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 |