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

Side by Side Diff: base/android/jni_generator/sample_for_tests.cc

Issue 115103002: Android: sync up latest JNI generator changes from downstream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Adds missing files Created 7 years 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 | Annotate | Revision Log
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 #include "base/android/jni_generator/sample_for_tests.h" 5 #include "base/android/jni_generator/sample_for_tests.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/android/scoped_java_ref.h" 9 #include "base/android/scoped_java_ref.h"
10 #include "jni/SampleForTests_jni.h" 10 #include "jni/SampleForTests_jni.h"
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 void CPPClass::IterateAndDoSomethingWithStructB(JNIEnv* env, jobject obj) { 44 void CPPClass::IterateAndDoSomethingWithStructB(JNIEnv* env, jobject obj) {
45 // Iterate over the elements and do something with them. 45 // Iterate over the elements and do something with them.
46 for (std::map<long, std::string>::const_iterator it = map_.begin(); 46 for (std::map<long, std::string>::const_iterator it = map_.begin();
47 it != map_.end(); ++it) { 47 it != map_.end(); ++it) {
48 long key = it->first; 48 long key = it->first;
49 std::string value = it->second; 49 std::string value = it->second;
50 } 50 }
51 map_.clear(); 51 map_.clear();
52 } 52 }
53 53
54 base::android::ScopedJavaLocalRef<jstring> CPPClass::ReturnAString(
55 JNIEnv* env, jobject obj) {
56 base::android::ScopedJavaLocalRef<jstring> ret = ConvertUTF8ToJavaString(
57 env, "test");
58 return ret;
59 }
60
54 // Static free functions declared and called directly from java. 61 // Static free functions declared and called directly from java.
55 static jint Init(JNIEnv* env, jobject obj, jstring param) { 62 static jint Init(JNIEnv* env, jobject obj, jstring param) {
56 return 0; 63 return 0;
57 } 64 }
58 65
59 static jdouble GetDoubleFunction(JNIEnv*, jobject) { 66 static jdouble GetDoubleFunction(JNIEnv*, jobject) {
60 return 0; 67 return 0;
61 } 68 }
62 69
63 static jfloat GetFloatFunction(JNIEnv*, jclass) { 70 static jfloat GetFloatFunction(JNIEnv*, jclass) {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 ScopedJavaLocalRef<jobject> struct_a = 104 ScopedJavaLocalRef<jobject> struct_a =
98 base::android::Java_InnerStructA_create( 105 base::android::Java_InnerStructA_create(
99 env, 0, 1, 106 env, 0, 1,
100 base::android::ConvertUTF8ToJavaString(env, "test").obj()); 107 base::android::ConvertUTF8ToJavaString(env, "test").obj());
101 base::android::Java_SampleForTests_addStructA( 108 base::android::Java_SampleForTests_addStructA(
102 env, my_java_object, struct_a.obj()); 109 env, my_java_object, struct_a.obj());
103 } 110 }
104 base::android::Java_SampleForTests_iterateAndDoSomething(env, my_java_object); 111 base::android::Java_SampleForTests_iterateAndDoSomething(env, my_java_object);
105 return 0; 112 return 0;
106 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698