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

Side by Side Diff: base/android/jni_array.h

Issue 1689563002: android: Add ToJavaFloatArray JNI utility. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added std::vector version. Created 4 years, 10 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 unified diff | Download patch
« no previous file with comments | « no previous file | base/android/jni_array.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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_
OLDNEW
« no previous file with comments | « no previous file | base/android/jni_array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698