OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/arc/crash_collector/arc_crash_collector_bridge.h" | 5 #include "components/arc/crash_collector/arc_crash_collector_bridge.h" |
6 | 6 |
7 #include <sysexits.h> | 7 #include <sysexits.h> |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 | 9 |
10 #include <utility> | 10 #include <utility> |
11 | 11 |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/process/launch.h" | 13 #include "base/process/launch.h" |
14 #include "components/arc/arc_bridge_service.h" | 14 #include "components/arc/arc_bridge_service.h" |
15 #include "mojo/edk/embedder/embedder.h" | 15 #include "mojo/edk/embedder/embedder.h" |
16 | 16 |
17 namespace { | 17 namespace { |
18 | 18 |
19 const char kCrashReporterPath[] = "/sbin/crash_reporter"; | 19 const char kCrashReporterPath[] = "/sbin/crash_reporter"; |
20 | 20 |
21 // Runs crash_reporter to save the crash info provided via the pipe. | 21 // Runs crash_reporter to save the crash info provided via the pipe. |
22 void RunCrashReporter(const std::string& crash_type, | 22 void RunCrashReporter(const std::string& crash_type, |
23 const std::string& device, | 23 const std::string& device, |
24 const std::string& board, | 24 const std::string& board, |
25 const std::string& cpu_abi, | 25 const std::string& cpu_abi, |
26 mojo::edk::ScopedPlatformHandle pipe) { | 26 mojo::edk::ScopedPlatformHandle pipe) { |
27 base::FileHandleMappingVector fd_map = { | |
28 std::make_pair(pipe.get().handle, STDIN_FILENO)}; | |
29 | |
30 base::LaunchOptions options; | 27 base::LaunchOptions options; |
31 options.fds_to_remap = &fd_map; | 28 options.fds_to_remap.push_back( |
| 29 std::make_pair(pipe.get().handle, STDIN_FILENO)); |
32 | 30 |
33 auto process = | 31 auto process = |
34 base::LaunchProcess({kCrashReporterPath, "--arc_java_crash=" + crash_type, | 32 base::LaunchProcess({kCrashReporterPath, "--arc_java_crash=" + crash_type, |
35 "--arc_device=" + device, "--arc_board=" + board, | 33 "--arc_device=" + device, "--arc_board=" + board, |
36 "--arc_cpu_abi=" + cpu_abi}, | 34 "--arc_cpu_abi=" + cpu_abi}, |
37 options); | 35 options); |
38 | 36 |
39 int exit_code = 0; | 37 int exit_code = 0; |
40 if (!process.WaitForExit(&exit_code)) { | 38 if (!process.WaitForExit(&exit_code)) { |
41 LOG(ERROR) << "Failed to wait for " << kCrashReporterPath; | 39 LOG(ERROR) << "Failed to wait for " << kCrashReporterPath; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 | 80 |
83 void ArcCrashCollectorBridge::SetBuildProperties(const std::string& device, | 81 void ArcCrashCollectorBridge::SetBuildProperties(const std::string& device, |
84 const std::string& board, | 82 const std::string& board, |
85 const std::string& cpu_abi) { | 83 const std::string& cpu_abi) { |
86 device_ = device; | 84 device_ = device; |
87 board_ = board; | 85 board_ = board; |
88 cpu_abi_ = cpu_abi; | 86 cpu_abi_ = cpu_abi; |
89 } | 87 } |
90 | 88 |
91 } // namespace arc | 89 } // namespace arc |
OLD | NEW |