OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/test/multiprocess_test.h" | 5 #include "base/test/multiprocess_test.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 // NOTE: This MUST NOT run on the main thread of the NativeTest application. | 26 // NOTE: This MUST NOT run on the main thread of the NativeTest application. |
27 SpawnChildResult SpawnMultiProcessTestChild( | 27 SpawnChildResult SpawnMultiProcessTestChild( |
28 const std::string& procname, | 28 const std::string& procname, |
29 const CommandLine& base_command_line, | 29 const CommandLine& base_command_line, |
30 const LaunchOptions& options) { | 30 const LaunchOptions& options) { |
31 JNIEnv* env = android::AttachCurrentThread(); | 31 JNIEnv* env = android::AttachCurrentThread(); |
32 DCHECK(env); | 32 DCHECK(env); |
33 | 33 |
34 std::vector<int> fd_keys; | 34 std::vector<int> fd_keys; |
35 std::vector<int> fd_fds; | 35 std::vector<int> fd_fds; |
36 if (options.fds_to_remap) { | 36 for (auto& iter : options.fds_to_remap) { |
37 for (auto& iter : *options.fds_to_remap) { | 37 fd_keys.push_back(iter.second); |
38 fd_keys.push_back(iter.second); | 38 fd_fds.push_back(iter.first); |
39 fd_fds.push_back(iter.first); | |
40 } | |
41 } | 39 } |
42 | 40 |
43 android::ScopedJavaLocalRef<jobjectArray> fds = | 41 android::ScopedJavaLocalRef<jobjectArray> fds = |
44 android::Java_MultiprocessTestClientLauncher_makeFdInfoArray( | 42 android::Java_MultiprocessTestClientLauncher_makeFdInfoArray( |
45 env, base::android::ToJavaIntArray(env, fd_keys), | 43 env, base::android::ToJavaIntArray(env, fd_keys), |
46 base::android::ToJavaIntArray(env, fd_fds)); | 44 base::android::ToJavaIntArray(env, fd_fds)); |
47 | 45 |
48 CommandLine command_line(base_command_line); | 46 CommandLine command_line(base_command_line); |
49 if (!command_line.HasSwitch(switches::kTestChildProcess)) { | 47 if (!command_line.HasSwitch(switches::kTestChildProcess)) { |
50 command_line.AppendSwitchASCII(switches::kTestChildProcess, procname); | 48 command_line.AppendSwitchASCII(switches::kTestChildProcess, procname); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 int exit_code, | 81 int exit_code, |
84 bool wait) { | 82 bool wait) { |
85 JNIEnv* env = android::AttachCurrentThread(); | 83 JNIEnv* env = android::AttachCurrentThread(); |
86 DCHECK(env); | 84 DCHECK(env); |
87 | 85 |
88 return android::Java_MultiprocessTestClientLauncher_terminate( | 86 return android::Java_MultiprocessTestClientLauncher_terminate( |
89 env, process.Pid(), exit_code, wait); | 87 env, process.Pid(), exit_code, wait); |
90 } | 88 } |
91 | 89 |
92 } // namespace base | 90 } // namespace base |
OLD | NEW |