Chromium Code Reviews| 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 187 if (should_initialize_database_and_set_upload_policy) { | 183 if (should_initialize_database_and_set_upload_policy) { |
| 188 g_database = | 184 g_database = |
| 189 crashpad::CrashReportDatabase::Initialize(database_path).release(); | 185 crashpad::CrashReportDatabase::Initialize(database_path).release(); |
| 190 | 186 |
| 191 SetUploadConsent(crash_reporter_client->GetCollectStatsConsent()); | 187 SetUploadConsent(crash_reporter_client->GetCollectStatsConsent()); |
| 192 } | 188 } |
| 193 } | 189 } |
| 194 | 190 |
| 195 } // namespace | 191 } // namespace |
| 196 | 192 |
| 193 void DumpWithoutCrashing() { | |
| 194 CRASHPAD_SIMULATE_CRASH(); | |
|
robertshield
2017/06/22 18:15:41
nit: could you move this down to line 308 to keep
Will Harris
2017/06/26 12:26:20
Done.
| |
| 195 } | |
| 196 | |
| 197 void InitializeCrashpad(bool initial_client, const std::string& process_type) { | 197 void InitializeCrashpad(bool initial_client, const std::string& process_type) { |
| 198 InitializeCrashpadImpl(initial_client, process_type, std::string(), false); | 198 InitializeCrashpadImpl(initial_client, process_type, std::string(), false); |
| 199 } | 199 } |
| 200 | 200 |
| 201 #if defined(OS_WIN) | 201 #if defined(OS_WIN) |
| 202 void InitializeCrashpadWithEmbeddedHandler(bool initial_client, | 202 void InitializeCrashpadWithEmbeddedHandler(bool initial_client, |
| 203 const std::string& process_type, | 203 const std::string& process_type, |
| 204 const std::string& user_data_dir) { | 204 const std::string& user_data_dir) { |
| 205 InitializeCrashpadImpl(initial_client, process_type, user_data_dir, true); | 205 InitializeCrashpadImpl(initial_client, process_type, user_data_dir, true); |
| 206 } | 206 } |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |