Chromium Code Reviews| Index: components/arc/crash_collector/arc_crash_collector_bridge.cc |
| diff --git a/components/arc/crash_collector/arc_crash_collector_bridge.cc b/components/arc/crash_collector/arc_crash_collector_bridge.cc |
| index 8557308a6b87703c0994a97aa5dbbffd3c395439..4d915a01e0e37ef90a9f6ddde82f43834657c94c 100644 |
| --- a/components/arc/crash_collector/arc_crash_collector_bridge.cc |
| +++ b/components/arc/crash_collector/arc_crash_collector_bridge.cc |
| @@ -14,13 +14,29 @@ |
| #include "mojo/edk/embedder/embedder.h" |
| namespace { |
| + |
| const char kCrashReporterPath[] = "/sbin/crash_reporter"; |
| + |
| +// Waits for the process to exit. |
| +void WaitForProcessToExit(base::Process process) { |
| + int exit_code = 0; |
| + if (!process.WaitForExit(&exit_code)) { |
| + LOG(ERROR) << "Failed to wait for " << kCrashReporterPath; |
| + } else if (exit_code != EX_OK) { |
| + LOG(ERROR) << kCrashReporterPath << " failed with exit code " << exit_code; |
| + } |
| +} |
| + |
| } |
| namespace arc { |
| -ArcCrashCollectorBridge::ArcCrashCollectorBridge(ArcBridgeService* bridge) |
| - : ArcService(bridge), binding_(this) { |
| +ArcCrashCollectorBridge::ArcCrashCollectorBridge( |
| + ArcBridgeService* bridge, |
| + scoped_refptr<base::TaskRunner> blocking_task_runner) |
| + : ArcService(bridge), |
| + blocking_task_runner_(blocking_task_runner), |
| + binding_(this) { |
| arc_bridge_service()->crash_collector()->AddObserver(this); |
| } |
| @@ -51,13 +67,9 @@ void ArcCrashCollectorBridge::DumpCrash(const mojo::String& type, |
| "--arc_device=" + device_, "--arc_board=" + board_, |
| "--arc_cpu_abi=" + cpu_abi_}, |
| options); |
| - |
| - int exit_code; |
| - if (!process.WaitForExit(&exit_code)) { |
| - LOG(ERROR) << "Failed to wait for " << kCrashReporterPath; |
| - } else if (exit_code != EX_OK) { |
| - LOG(ERROR) << kCrashReporterPath << " failed with exit code " << exit_code; |
| - } |
| + blocking_task_runner_->PostTask(FROM_HERE, |
|
hidehiko
2016/09/26 14:17:22
Optional: How about moving everything, incl. Launc
hashimoto
2016/09/27 06:48:26
Done.
|
| + base::Bind(&WaitForProcessToExit, |
| + base::Passed(std::move(process)))); |
| } |
| void ArcCrashCollectorBridge::SetBuildProperties(const mojo::String& device, |