| 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 "components/crash/content/app/crashpad.h" | 5 #include "components/crash/content/app/crashpad.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 CHECK_LE(message_start, string.size()); | 83 CHECK_LE(message_start, string.size()); |
| 84 std::string message = base::StringPrintf("%s:%d: %s", file, line, | 84 std::string message = base::StringPrintf("%s:%d: %s", file, line, |
| 85 string.c_str() + message_start); | 85 string.c_str() + message_start); |
| 86 SetCrashKeyValue("LOG_FATAL", message); | 86 SetCrashKeyValue("LOG_FATAL", message); |
| 87 | 87 |
| 88 // Rather than including the code to force the crash here, allow the caller to | 88 // Rather than including the code to force the crash here, allow the caller to |
| 89 // do it. | 89 // do it. |
| 90 return false; | 90 return false; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void DumpWithoutCrashing() { | |
| 94 CRASHPAD_SIMULATE_CRASH(); | |
| 95 } | |
| 96 | |
| 97 void InitializeCrashpadImpl(bool initial_client, | 93 void InitializeCrashpadImpl(bool initial_client, |
| 98 const std::string& process_type, | 94 const std::string& process_type, |
| 99 const std::string& user_data_dir, | 95 const std::string& user_data_dir, |
| 100 bool embedded_handler) { | 96 bool embedded_handler) { |
| 101 static bool initialized = false; | 97 static bool initialized = false; |
| 102 DCHECK(!initialized); | 98 DCHECK(!initialized); |
| 103 initialized = true; | 99 initialized = true; |
| 104 | 100 |
| 105 const bool browser_process = process_type.empty(); | 101 const bool browser_process = process_type.empty(); |
| 106 CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); | 102 CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 } | 295 } |
| 300 | 296 |
| 301 void RequestSingleCrashUpload(const std::string& local_id) { | 297 void RequestSingleCrashUpload(const std::string& local_id) { |
| 302 if (!g_database) | 298 if (!g_database) |
| 303 return; | 299 return; |
| 304 crashpad::UUID uuid; | 300 crashpad::UUID uuid; |
| 305 uuid.InitializeFromString(local_id); | 301 uuid.InitializeFromString(local_id); |
| 306 g_database->RequestUpload(uuid); | 302 g_database->RequestUpload(uuid); |
| 307 } | 303 } |
| 308 | 304 |
| 305 void DumpWithoutCrashing() { |
| 306 CRASHPAD_SIMULATE_CRASH(); |
| 307 } |
| 308 |
| 309 } // namespace crash_reporter | 309 } // namespace crash_reporter |
| 310 | 310 |
| 311 #if defined(OS_WIN) | 311 #if defined(OS_WIN) |
| 312 | 312 |
| 313 extern "C" { | 313 extern "C" { |
| 314 | 314 |
| 315 // This function is used in chrome_metrics_services_manager_client.cc to trigger | 315 // This function is used in chrome_metrics_services_manager_client.cc to trigger |
| 316 // changes to the upload-enabled state. This is done when the metrics services | 316 // changes to the upload-enabled state. This is done when the metrics services |
| 317 // are initialized, and when the user changes their consent for uploads. See | 317 // are initialized, and when the user changes their consent for uploads. See |
| 318 // crash_reporter::SetUploadConsent for effects. The given consent value should | 318 // crash_reporter::SetUploadConsent for effects. The given consent value should |
| (...skipping 20 matching lines...) Expand all Loading... |
| 339 | 339 |
| 340 // This helper is invoked by code in chrome.dll to request a single crash report | 340 // This helper is invoked by code in chrome.dll to request a single crash report |
| 341 // upload. See CrashUploadListCrashpad. | 341 // upload. See CrashUploadListCrashpad. |
| 342 void __declspec(dllexport) | 342 void __declspec(dllexport) |
| 343 RequestSingleCrashUploadImpl(const std::string& local_id) { | 343 RequestSingleCrashUploadImpl(const std::string& local_id) { |
| 344 crash_reporter::RequestSingleCrashUpload(local_id); | 344 crash_reporter::RequestSingleCrashUpload(local_id); |
| 345 } | 345 } |
| 346 } // extern "C" | 346 } // extern "C" |
| 347 | 347 |
| 348 #endif // OS_WIN | 348 #endif // OS_WIN |
| OLD | NEW |