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

Unified Diff: base/android/jni_generator/golden_sample_for_tests_jni.h

Issue 1279163006: jni_generator: Wrap all native methods in stubs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove separate forward declaration section entirely Created 5 years, 4 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 | « no previous file | base/android/jni_generator/jni_generator.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/android/jni_generator/golden_sample_for_tests_jni.h
diff --git a/base/android/jni_generator/golden_sample_for_tests_jni.h b/base/android/jni_generator/golden_sample_for_tests_jni.h
index ba7494e9b816e9ce51ff1dbbfea74c314d34d443..e146acada34001dbb25a27b2e23988f1fbbd8040 100644
--- a/base/android/jni_generator/golden_sample_for_tests_jni.h
+++ b/base/android/jni_generator/golden_sample_for_tests_jni.h
@@ -39,34 +39,76 @@ jclass g_InnerStructB_clazz = NULL;
namespace base {
namespace android {
+// Step 2: method stubs.
+
static jlong Init(JNIEnv* env, jobject jcaller,
jstring param);
+static jlong
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeInit(JNIEnv*
+ env, jobject jcaller,
+ jstring param) {
+ return Init(env, jcaller, param);
+}
+
+static void
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeDestroy(JNIEnv*
+ env,
+ jobject jcaller,
+ jlong nativeCPPClass) {
+ CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass);
+ CHECK_NATIVE_PTR(env, jcaller, native, "Destroy");
+ return native->Destroy(env, jcaller);
+}
+
static jdouble GetDoubleFunction(JNIEnv* env, jobject jcaller);
+static jdouble
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetDoubleFunction(JNIEnv*
+ env, jobject jcaller) {
+ return GetDoubleFunction(env, jcaller);
+}
+
static jfloat GetFloatFunction(JNIEnv* env, jclass jcaller);
+static jfloat
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetFloatFunction(JNIEnv*
+ env, jclass jcaller) {
+ return GetFloatFunction(env, jcaller);
+}
+
static void SetNonPODDatatype(JNIEnv* env, jobject jcaller,
jobject rect);
+static void
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeSetNonPODDatatype(JNIEnv*
+ env, jobject jcaller,
+ jobject rect) {
+ return SetNonPODDatatype(env, jcaller, rect);
+}
+
static jobject GetNonPODDatatype(JNIEnv* env, jobject jcaller);
-// Step 2: method stubs.
-static void Destroy(JNIEnv* env, jobject jcaller,
- jlong nativeCPPClass) {
- CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass);
- CHECK_NATIVE_PTR(env, jcaller, native, "Destroy");
- return native->Destroy(env, jcaller);
+static jobject
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetNonPODDatatype(JNIEnv*
+ env, jobject jcaller) {
+ return GetNonPODDatatype(env, jcaller);
}
-static jint Method(JNIEnv* env, jobject jcaller,
+static jint
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv*
+ env,
+ jobject jcaller,
jlong nativeCPPClass) {
CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass);
CHECK_NATIVE_PTR(env, jcaller, native, "Method", 0);
return native->Method(env, jcaller);
}
-static jdouble MethodOtherP0(JNIEnv* env, jobject jcaller,
+static jdouble
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethodOtherP0(JNIEnv*
+ env,
+ jobject jcaller,
jlong nativePtr) {
CPPClass::InnerClass* native =
reinterpret_cast<CPPClass::InnerClass*>(nativePtr);
@@ -74,7 +116,10 @@ static jdouble MethodOtherP0(JNIEnv* env, jobject jcaller,
return native->MethodOtherP0(env, jcaller);
}
-static void AddStructB(JNIEnv* env, jobject jcaller,
+static void
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeAddStructB(JNIEnv*
+ env,
+ jobject jcaller,
jlong nativeCPPClass,
jobject b) {
CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass);
@@ -82,14 +127,20 @@ static void AddStructB(JNIEnv* env, jobject jcaller,
return native->AddStructB(env, jcaller, b);
}
-static void IterateAndDoSomethingWithStructB(JNIEnv* env, jobject jcaller,
+static void
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeIterateAndDoSomethingWithStructB(JNIEnv*
+ env,
+ jobject jcaller,
jlong nativeCPPClass) {
CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass);
CHECK_NATIVE_PTR(env, jcaller, native, "IterateAndDoSomethingWithStructB");
return native->IterateAndDoSomethingWithStructB(env, jcaller);
}
-static jstring ReturnAString(JNIEnv* env, jobject jcaller,
+static jstring
+ Java_org_chromium_example_jni_1generator_SampleForTests_nativeReturnAString(JNIEnv*
+ env,
+ jobject jcaller,
jlong nativeCPPClass) {
CPPClass* native = reinterpret_cast<CPPClass*>(nativeCPPClass);
CHECK_NATIVE_PTR(env, jcaller, native, "ReturnAString", NULL);
@@ -321,55 +372,77 @@ static const JNINativeMethod kMethodsSampleForTests[] = {
"("
"Ljava/lang/String;"
")"
-"J", reinterpret_cast<void*>(Init) },
+"J",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTests_nativeInit)
+ },
{ "nativeDestroy",
"("
"J"
")"
-"V", reinterpret_cast<void*>(Destroy) },
+"V",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTests_nativeDestroy)
+ },
{ "nativeGetDoubleFunction",
"("
")"
-"D", reinterpret_cast<void*>(GetDoubleFunction) },
+"D",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetDoubleFunction)
+ },
{ "nativeGetFloatFunction",
"("
")"
-"F", reinterpret_cast<void*>(GetFloatFunction) },
+"F",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetFloatFunction)
+ },
{ "nativeSetNonPODDatatype",
"("
"Landroid/graphics/Rect;"
")"
-"V", reinterpret_cast<void*>(SetNonPODDatatype) },
+"V",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTests_nativeSetNonPODDatatype)
+ },
{ "nativeGetNonPODDatatype",
"("
")"
-"Ljava/lang/Object;", reinterpret_cast<void*>(GetNonPODDatatype) },
+"Ljava/lang/Object;",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTests_nativeGetNonPODDatatype)
+ },
{ "nativeMethod",
"("
"J"
")"
-"I", reinterpret_cast<void*>(Method) },
+"I",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod)
+ },
{ "nativeMethodOtherP0",
"("
"J"
")"
-"D", reinterpret_cast<void*>(MethodOtherP0) },
+"D",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethodOtherP0)
+ },
{ "nativeAddStructB",
"("
"J"
"Lorg/chromium/example/jni_generator/SampleForTests$InnerStructB;"
")"
-"V", reinterpret_cast<void*>(AddStructB) },
+"V",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTests_nativeAddStructB)
+ },
{ "nativeIterateAndDoSomethingWithStructB",
"("
"J"
")"
-"V", reinterpret_cast<void*>(IterateAndDoSomethingWithStructB) },
+"V",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTests_nativeIterateAndDoSomethingWithStructB)
+ },
{ "nativeReturnAString",
"("
"J"
")"
-"Ljava/lang/String;", reinterpret_cast<void*>(ReturnAString) },
+"Ljava/lang/String;",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_SampleForTests_nativeReturnAString)
+ },
};
static bool RegisterNativesImpl(JNIEnv* env) {
« no previous file with comments | « no previous file | base/android/jni_generator/jni_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698