Index: base/android/jni_array.cc |
diff --git a/base/android/jni_array.cc b/base/android/jni_array.cc |
index 2ce04299439f1e45fc6699cda1d02616b78fc4db..ce8f9d3d8335a7354b3e96cf0ef298051a0df6b0 100644 |
--- a/base/android/jni_array.cc |
+++ b/base/android/jni_array.cc |
@@ -246,6 +246,22 @@ void JavaFloatArrayToFloatVector(JNIEnv* env, |
env->GetFloatArrayRegion(float_array, 0, len, &(*out)[0]); |
} |
+void JavaJObjectArrayToJObjectVector( |
+ JNIEnv* env, |
+ jobjectArray jobject_array, |
+ std::vector<ScopedJavaLocalRef<jobject>>* out) { |
+ DCHECK(out); |
+ size_t len = SafeGetArrayLength(env, jobject_array); |
+ if (!len) |
+ return; |
+ out->reserve(len); |
+ |
+ for (size_t i = 0; i < len; ++i) { |
+ out->push_back(ScopedJavaLocalRef<jobject>( |
+ env, env->GetObjectArrayElement(jobject_array, i))); |
+ } |
+} |
+ |
void JavaArrayOfByteArrayToStringVector( |
JNIEnv* env, |
jobjectArray array, |