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 #ifndef BASE_ANDROID_JNI_ARRAY_H_ | 5 #ifndef BASE_ANDROID_JNI_ARRAY_H_ |
6 #define BASE_ANDROID_JNI_ARRAY_H_ | 6 #define BASE_ANDROID_JNI_ARRAY_H_ |
7 | 7 |
8 #include <jni.h> | 8 #include <jni.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <stdint.h> | 10 #include <stdint.h> |
(...skipping 24 matching lines...) Expand all Loading... |
35 | 35 |
36 // Returns a new Java long array converted from the given int64_t array. | 36 // Returns a new Java long array converted from the given int64_t array. |
37 BASE_EXPORT ScopedJavaLocalRef<jlongArray> ToJavaLongArray(JNIEnv* env, | 37 BASE_EXPORT ScopedJavaLocalRef<jlongArray> ToJavaLongArray(JNIEnv* env, |
38 const int64_t* longs, | 38 const int64_t* longs, |
39 size_t len); | 39 size_t len); |
40 | 40 |
41 BASE_EXPORT ScopedJavaLocalRef<jlongArray> ToJavaLongArray( | 41 BASE_EXPORT ScopedJavaLocalRef<jlongArray> ToJavaLongArray( |
42 JNIEnv* env, | 42 JNIEnv* env, |
43 const std::vector<int64_t>& longs); | 43 const std::vector<int64_t>& longs); |
44 | 44 |
| 45 // Returns a new Java float array converted from the given C++ float array. |
| 46 BASE_EXPORT ScopedJavaLocalRef<jfloatArray> ToJavaFloatArray( |
| 47 JNIEnv* env, const float* floats, size_t len); |
| 48 |
| 49 BASE_EXPORT ScopedJavaLocalRef<jfloatArray> ToJavaFloatArray( |
| 50 JNIEnv* env, |
| 51 const std::vector<float>& floats); |
| 52 |
45 // Returns a array of Java byte array converted from |v|. | 53 // Returns a array of Java byte array converted from |v|. |
46 BASE_EXPORT ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfByteArray( | 54 BASE_EXPORT ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfByteArray( |
47 JNIEnv* env, const std::vector<std::string>& v); | 55 JNIEnv* env, const std::vector<std::string>& v); |
48 | 56 |
49 BASE_EXPORT ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfStrings( | 57 BASE_EXPORT ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfStrings( |
50 JNIEnv* env, const std::vector<std::string>& v); | 58 JNIEnv* env, const std::vector<std::string>& v); |
51 | 59 |
52 BASE_EXPORT ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfStrings( | 60 BASE_EXPORT ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfStrings( |
53 JNIEnv* env, const std::vector<string16>& v); | 61 JNIEnv* env, const std::vector<string16>& v); |
54 | 62 |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // contents of |out| with the corresponding vectors of ints. | 116 // contents of |out| with the corresponding vectors of ints. |
109 BASE_EXPORT void JavaArrayOfIntArrayToIntVector( | 117 BASE_EXPORT void JavaArrayOfIntArrayToIntVector( |
110 JNIEnv* env, | 118 JNIEnv* env, |
111 jobjectArray array, | 119 jobjectArray array, |
112 std::vector<std::vector<int>>* out); | 120 std::vector<std::vector<int>>* out); |
113 | 121 |
114 } // namespace android | 122 } // namespace android |
115 } // namespace base | 123 } // namespace base |
116 | 124 |
117 #endif // BASE_ANDROID_JNI_ARRAY_H_ | 125 #endif // BASE_ANDROID_JNI_ARRAY_H_ |
OLD | NEW |