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..a6c88aff4fa562eeabca6bd2b7e49cc6ea35aac5 100644 |
--- a/components/crash/content/app/breakpad_linux.cc |
+++ b/components/crash/content/app/breakpad_linux.cc |
@@ -1098,9 +1098,24 @@ void EnableNonBrowserCrashDumping() { |
} |
#endif // defined(OS_ANDROID) |
+bool g_use_crash_keys_whitelist; |
Tobias Sargeant
2017/03/02 16:36:48
initialize these, and move them to the top of the
gsennton
2017/03/02 17:35:37
Done.
|
+const char** g_crash_keys_whitelist; |
+ |
+bool IsInWhiteList(const base::StringPiece& key) { |
+ DCHECK(g_crash_keys_whitelist); |
+ for (size_t i = 0; g_crash_keys_whitelist[i] != NULL; ++i) { |
+ 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 |