| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h" | 5 #include "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h" |
| 6 | 6 |
| 7 #include "android_webview/common/aw_descriptors.h" | 7 #include "android_webview/common/aw_descriptors.h" |
| 8 #include "android_webview/common/aw_paths.h" | 8 #include "android_webview/common/aw_paths.h" |
| 9 #include "android_webview/common/aw_version_info_values.h" | 9 #include "android_webview/common/aw_version_info_values.h" |
| 10 #include "android_webview/common/crash_reporter/crash_keys.h" | 10 #include "android_webview/common/crash_reporter/crash_keys.h" |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 LOG(WARNING) << "Can't use breakpad to handle WebView crashes"; | 161 LOG(WARNING) << "Can't use breakpad to handle WebView crashes"; |
| 162 return; | 162 return; |
| 163 } | 163 } |
| 164 #endif | 164 #endif |
| 165 | 165 |
| 166 AwCrashReporterClient* client = g_crash_reporter_client.Pointer(); | 166 AwCrashReporterClient* client = g_crash_reporter_client.Pointer(); |
| 167 if (process_type == switches::kRendererProcess && crash_signal_fd != -1) { | 167 if (process_type == switches::kRendererProcess && crash_signal_fd != -1) { |
| 168 client->set_crash_signal_fd(crash_signal_fd); | 168 client->set_crash_signal_fd(crash_signal_fd); |
| 169 } | 169 } |
| 170 ::crash_reporter::SetCrashReporterClient(client); | 170 ::crash_reporter::SetCrashReporterClient(client); |
| 171 breakpad::SetShouldSanitizeDumps(true); | 171 breakpad::SanitizationInfo sanitization_info; |
| 172 sanitization_info.should_sanitize_dumps = true; |
| 172 #if !defined(COMPONENT_BUILD) | 173 #if !defined(COMPONENT_BUILD) |
| 173 breakpad::SetSkipDumpIfPrincipalMappingNotReferenced( | 174 sanitization_info.skip_dump_if_principal_mapping_not_referenced = true; |
| 174 reinterpret_cast<uintptr_t>(&EnableCrashReporter)); | 175 sanitization_info.address_within_principal_mapping = |
| 175 #endif | 176 reinterpret_cast<uintptr_t>(&EnableCrashReporter); |
| 177 #endif // defined(COMPONENT_BUILD) |
| 176 | 178 |
| 177 bool is_browser_process = | 179 bool is_browser_process = |
| 178 process_type.empty() || | 180 process_type.empty() || |
| 179 process_type == breakpad::kWebViewSingleProcessType || | 181 process_type == breakpad::kWebViewSingleProcessType || |
| 180 process_type == breakpad::kBrowserProcessType; | 182 process_type == breakpad::kBrowserProcessType; |
| 181 if (is_browser_process) { | 183 if (is_browser_process) { |
| 182 breakpad::InitCrashReporter(""); | 184 breakpad::InitCrashReporter("", sanitization_info); |
| 183 } else { | 185 } else { |
| 184 breakpad::InitNonBrowserCrashReporterForAndroid(process_type); | 186 breakpad::InitNonBrowserCrashReporterForAndroid(process_type, |
| 187 sanitization_info); |
| 185 } | 188 } |
| 186 g_enabled = true; | 189 g_enabled = true; |
| 187 } | 190 } |
| 188 | 191 |
| 189 bool GetCrashDumpLocation(base::FilePath* crash_dir) { | 192 bool GetCrashDumpLocation(base::FilePath* crash_dir) { |
| 190 return g_crash_reporter_client.Get().GetCrashDumpLocation(crash_dir); | 193 return g_crash_reporter_client.Get().GetCrashDumpLocation(crash_dir); |
| 191 } | 194 } |
| 192 | 195 |
| 193 void AddGpuFingerprintToMicrodumpCrashHandler( | 196 void AddGpuFingerprintToMicrodumpCrashHandler( |
| 194 const std::string& gpu_fingerprint) { | 197 const std::string& gpu_fingerprint) { |
| 195 breakpad::AddGpuFingerprintToMicrodumpCrashHandler(gpu_fingerprint); | 198 breakpad::AddGpuFingerprintToMicrodumpCrashHandler(gpu_fingerprint); |
| 196 } | 199 } |
| 197 | 200 |
| 198 bool DumpWithoutCrashingToFd(int fd) { | 201 bool DumpWithoutCrashingToFd(int fd) { |
| 199 return g_crash_reporter_client.Pointer()->DumpWithoutCrashingToFd(fd); | 202 return g_crash_reporter_client.Pointer()->DumpWithoutCrashingToFd(fd); |
| 200 } | 203 } |
| 201 | 204 |
| 202 bool IsCrashReporterEnabled() { | 205 bool IsCrashReporterEnabled() { |
| 203 return breakpad::IsCrashReporterEnabled(); | 206 return breakpad::IsCrashReporterEnabled(); |
| 204 } | 207 } |
| 205 | 208 |
| 206 void SuppressDumpGeneration() { | 209 void SuppressDumpGeneration() { |
| 207 breakpad::SuppressDumpGeneration(); | 210 breakpad::SuppressDumpGeneration(); |
| 208 } | 211 } |
| 209 | 212 |
| 210 } // namespace crash_reporter | 213 } // namespace crash_reporter |
| 211 } // namespace android_webview | 214 } // namespace android_webview |
| OLD | NEW |