| 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/android/jni_array.h" | 5 #include "base/android/jni_array.h" |
| 6 | 6 |
| 7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
| 8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 | 10 |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 void JavaArrayOfIntArrayToIntVector( | 238 void JavaArrayOfIntArrayToIntVector( |
| 239 JNIEnv* env, | 239 JNIEnv* env, |
| 240 jobjectArray array, | 240 jobjectArray array, |
| 241 std::vector<std::vector<int>>* out) { | 241 std::vector<std::vector<int>>* out) { |
| 242 DCHECK(out); | 242 DCHECK(out); |
| 243 size_t len = SafeGetArrayLength(env, array); | 243 size_t len = SafeGetArrayLength(env, array); |
| 244 out->resize(len); | 244 out->resize(len); |
| 245 for (size_t i = 0; i < len; ++i) { | 245 for (size_t i = 0; i < len; ++i) { |
| 246 ScopedJavaLocalRef<jintArray> int_array( | 246 ScopedJavaLocalRef<jintArray> int_array( |
| 247 env, static_cast<jintArray>(env->GetObjectArrayElement(array, i))); | 247 env, static_cast<jintArray>(env->GetObjectArrayElement(array, i))); |
| 248 jint* ints = env->GetIntArrayElements(int_array.obj(), nullptr); | |
| 249 JavaIntArrayToIntVector(env, int_array.obj(), &((*out)[i])); | 248 JavaIntArrayToIntVector(env, int_array.obj(), &((*out)[i])); |
| 250 env->ReleaseIntArrayElements(int_array.obj(), ints, JNI_ABORT); | |
| 251 } | 249 } |
| 252 } | 250 } |
| 253 | 251 |
| 254 } // namespace android | 252 } // namespace android |
| 255 } // namespace base | 253 } // namespace base |
| OLD | NEW |