Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: components/arc/crash_collector/arc_crash_collector_bridge.cc

Issue 2367333002: arc: Stop waiting for crash reporter on UI thread (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/arc/crash_collector/arc_crash_collector_bridge.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « components/arc/crash_collector/arc_crash_collector_bridge.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698