Chromium Code Reviews| Index: components/crash/content/app/breakpad_linux.cc |
| diff --git a/components/crash/content/app/breakpad_linux.cc b/components/crash/content/app/breakpad_linux.cc |
| index 3c31d7619e49bf56210ff310e3a73905c58a43ec..5fa67baf9f607cf528ad0001495e323fbb7ddd30 100644 |
| --- a/components/crash/content/app/breakpad_linux.cc |
| +++ b/components/crash/content/app/breakpad_linux.cc |
| @@ -101,6 +101,9 @@ ExceptionHandler* g_breakpad = nullptr; |
| const char* g_asan_report_str = nullptr; |
| #endif |
| +bool g_use_crash_keys_whitelist = false; |
|
Robert Sesek
2017/03/02 22:29:40
Update the names here, too. Also, if in the CamelC
gsennton
2017/03/03 00:09:32
Done.
|
| +const char** g_crash_keys_whitelist = nullptr; |
| + |
| #if defined(OS_ANDROID) |
| #define G_DUMPS_SUPPRESSED_MAGIC 0x5AFECEDE |
| uint32_t g_dumps_suppressed = 0; |
| @@ -1098,9 +1101,21 @@ void EnableNonBrowserCrashDumping() { |
| } |
| #endif // defined(OS_ANDROID) |
| +bool IsInWhiteList(const base::StringPiece& key) { |
| + DCHECK(g_crash_keys_whitelist); |
| + for (size_t i = 0; g_crash_keys_whitelist[i] != NULL; ++i) { |
|
Robert Sesek
2017/03/02 22:29:40
NULL -> nullptr, or just omit and use implicit boo
gsennton
2017/03/03 00:09:32
Done.
|
| + if (0 == my_strcmp(g_crash_keys_whitelist[i], key.data())) { |
| + return true; |
| + } |
| + } |
| + return false; |
| +} |
| + |
| void SetCrashKeyValue(const base::StringPiece& key, |
| const base::StringPiece& value) { |
| - g_crash_keys->SetKeyValue(key.data(), value.data()); |
| + if (!g_use_crash_keys_whitelist || IsInWhiteList(key)) { |
| + g_crash_keys->SetKeyValue(key.data(), value.data()); |
| + } |
| } |
| void ClearCrashKey(const base::StringPiece& key) { |
| @@ -1112,6 +1127,9 @@ void ClearCrashKey(const base::StringPiece& key) { |
| void InitCrashKeys() { |
| g_crash_keys = new CrashKeyStorage; |
| GetCrashReporterClient()->RegisterCrashKeys(); |
| + g_use_crash_keys_whitelist = |
| + GetCrashReporterClient()->UseCrashKeysWhiteList(); |
| + g_crash_keys_whitelist = GetCrashReporterClient()->GetWhiteListedCrashKeys(); |
| base::debug::SetCrashKeyReportingFunctions(&SetCrashKeyValue, &ClearCrashKey); |
| } |
| @@ -1905,6 +1923,10 @@ void InitCrashReporter(const std::string& process_type) { |
| InitCrashReporter(process_type, sanitization_info); |
| } |
| +void InitCrashKeysForTesting() { |
| + InitCrashKeys(); |
| +} |
| + |
| void InitCrashReporter(const std::string& process_type, |
| const SanitizationInfo& sanitization_info) { |
| #else |