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

Unified Diff: base/android/jni_array.h

Issue 9358028: Upstream Android JNI code, allowing us to use more ScopedJava references. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased and added a TODO Created 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/android/jni_android.cc ('k') | base/android/jni_array.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/jni_array.h
diff --git a/base/android/jni_array.h b/base/android/jni_array.h
index edf05c6c4fed436703f0de46a9d0558bfebdf52e..e5ca3693f13c2bb1821be8e843c2322b98022959 100644
--- a/base/android/jni_array.h
+++ b/base/android/jni_array.h
@@ -9,18 +9,32 @@
#include <string>
#include <vector>
+#include "base/android/scoped_java_ref.h"
+#include "base/basictypes.h"
+
namespace base {
namespace android {
// Returns a new Java byte array converted from the given bytes array.
-jbyteArray ToJavaByteArray(JNIEnv* env, const unsigned char* bytes, size_t len);
+ScopedJavaLocalRef<jbyteArray> ToJavaByteArray(
+ JNIEnv* env, const uint8* bytes, size_t len);
// Returns a array of Java byte array converted from |v|.
-jobjectArray ToJavaArrayOfByteArray(JNIEnv* env,
- const std::vector<std::string>& v);
+ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfByteArray(
+ JNIEnv* env, const std::vector<std::string>& v);
+
+ScopedJavaLocalRef<jobjectArray> ToJavaArrayOfStrings(
+ JNIEnv* env, const std::vector<std::string>& v);
+
+// Appends the Java bytes in |bytes_array| onto the end of |out|.
+void AppendJavaByteArrayToByteVector(JNIEnv* env,
+ jbyteArray byte_array,
+ std::vector<uint8>* out);
-jobjectArray ToJavaArrayOfStrings(JNIEnv* env,
- const std::vector<std::string>& v);
+// Replaces the content of |out| with the Java bytes in |bytes_array|.
+void JavaByteArrayToByteVector(JNIEnv* env,
+ jbyteArray byte_array,
+ std::vector<uint8>* out);
} // namespace android
} // namespace base
« no previous file with comments | « base/android/jni_android.cc ('k') | base/android/jni_array.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698