Chromium Code Reviews| Index: components/crash/content/app/crashpad_win.cc |
| diff --git a/components/crash/content/app/crashpad_win.cc b/components/crash/content/app/crashpad_win.cc |
| index bdbd94ee57507ef7fab4541a4615c4b6c3d0383a..fc165a96d9d0d5a5c22be94a472d0a43e4ebd2ec 100644 |
| --- a/components/crash/content/app/crashpad_win.cc |
| +++ b/components/crash/content/app/crashpad_win.cc |
| @@ -118,9 +118,15 @@ base::FilePath PlatformCrashpadInitialization(bool initial_client, |
| exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe")); |
| } |
| - g_crashpad_client.Get().StartHandler( |
| - exe_file, database_path, metrics_path, url, process_annotations, |
| - arguments, false, false); |
| + if (!g_crashpad_client.Get().StartHandler( |
| + exe_file, database_path, metrics_path, url, process_annotations, |
| + arguments, false, true)) { |
| + // This means that CreateThread() failed, so this process is very messed |
| + // up. This should be effectively unreachable. Note that if this is |
| + // converted to non-fatal, calls to BlockUntilHandlerStarted() will have |
|
robertshield
2016/12/15 20:06:30
nit: consider updating the comment about "if this
scottmg
2016/12/16 17:16:51
Done.
|
| + // to be amended. |
| + LOG(FATAL) << "synchronous part of handler startup failed"; |
| + } |
| // If we're the browser, push the pipe name into the environment so child |
| // processes can connect to it. If we inherited another crashpad_handler's |
| @@ -208,6 +214,16 @@ MSVC_ENABLE_OPTIMIZE() |
| } // namespace |
| } // namespace internal |
| + |
| +void BlockUntilHandlerStarted() { |
| + // We know that the StartHandler() at least started asynchronous startup if |
| + // we're here, as if it doesn't, we abort. |
| + const unsigned int kTimeoutMS = 5000; |
| + if (!internal::g_crashpad_client.Get().WaitForHandlerStart(kTimeoutMS)) { |
| + LOG(ERROR) << "Crashpad handler failed to start, crash reporting disabled"; |
| + } |
| +} |
| + |
| } // namespace crash_reporter |
| extern "C" { |