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

Unified Diff: testing/android/native_test/main_runner.cc

Issue 2735113003: Changing SpawnChild to return a struct.
Patch Set: Created 3 years, 9 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 | « testing/android/native_test/java/src/org/chromium/native_test/MainRunner.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/android/native_test/main_runner.cc
diff --git a/testing/android/native_test/main_runner.cc b/testing/android/native_test/main_runner.cc
index 2dc41f3842496d4d613a16bdee89bf0f1efcf515..0c548e417eba5b0802120c9b530e110da270c450 100644
--- a/testing/android/native_test/main_runner.cc
+++ b/testing/android/native_test/main_runner.cc
@@ -4,10 +4,12 @@
#include <vector>
+#include "base/android/global_object_registry.h"
#include "base/android/jni_array.h"
#include "base/logging.h"
#include "base/posix/global_descriptors.h"
#include "jni/MainRunner_jni.h"
+#include "mojo/edk/embedder/embedder.h"
#include "testing/android/native_test/native_test_util.h"
extern int main(int argc, char** argv);
@@ -15,6 +17,8 @@ extern int main(int argc, char** argv);
namespace testing {
namespace android {
+jobject g_side_channel;
+
bool RegisterMainRunnerJni(JNIEnv* env) {
return RegisterNativesImpl(env);
}
@@ -24,7 +28,9 @@ static jint RunMain(
const base::android::JavaParamRef<jclass>& jcaller,
const base::android::JavaParamRef<jobjectArray>& command_line,
const base::android::JavaParamRef<jintArray>& fds_to_map_keys,
- const base::android::JavaParamRef<jintArray>& fds_to_map_fds) {
+ const base::android::JavaParamRef<jintArray>& fds_to_map_fds,
+ const base::android::JavaParamRef<jintArray>& jobjects_to_map_keys,
+ const base::android::JavaParamRef<jobjectArray>& jobjects_to_map_jobjects) {
// Guards against process being reused.
// In most cases, running main again will cause problems (static variables,
// singletons, lazy instances won't be in the same state as a clean run).
@@ -37,11 +43,21 @@ static jint RunMain(
std::vector<int> fds;
base::android::JavaIntArrayToIntVector(env, fds_to_map_fds, &fds);
CHECK_EQ(keys.size(), fds.size());
-
for (size_t i = 0; i < keys.size(); i++) {
base::GlobalDescriptors::GetInstance()->Set(keys[i], fds[i]);
}
+ keys.clear();
+ base::android::JavaIntArrayToIntVector(env, jobjects_to_map_keys, &keys);
+ std::vector<base::android::ScopedJavaLocalRef<jobject>> jobjects;
+ base::android::JavaJObjectArrayToJObjectVector(env, jobjects_to_map_jobjects,
+ &jobjects);
+ CHECK_EQ(keys.size(), jobjects.size());
+ for (size_t i = 0; i < keys.size(); i++) {
+ base::android::GlobalObjectRegistry::GetInstance()->Set(keys[i],
+ jobjects[i]);
+ }
+
std::vector<std::string> cpp_command_line;
AppendJavaStringArrayToStringVector(env, command_line, &cpp_command_line);
« no previous file with comments | « testing/android/native_test/java/src/org/chromium/native_test/MainRunner.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698