summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorTorne (Richard Coles) <torne@chromium.org>2015-08-14 13:41:14 +0100
committerTorne (Richard Coles) <torne@chromium.org>2015-08-14 12:42:22 +0000
commitb37ad14e10041f15a4467022d5169be4dac73ceb (patch)
tree30a15f5612c3d85cb33af25d61b113505825c374 /base
parent109d90ca91cf28023f47478c6685a4f9c31b789e (diff)
downloadchromium_src-b37ad14e10041f15a4467022d5169be4dac73ceb.zip
chromium_src-b37ad14e10041f15a4467022d5169be4dac73ceb.tar.gz
chromium_src-b37ad14e10041f15a4467022d5169be4dac73ceb.tar.bz2
jni_generator: Wrap all native methods in stubs.
Instead of only wrapping native methods which call C++ methods, wrap them all. This doesn't require any changes to the implementations, but makes the handling of the two kinds of method more consistent in preparation for introducing return type/parameter wrapping in future changes. This also changes the way that some of the stub code is generated to make it less different depending whether native exports are in use, and moves "extern "C"" declarations to be on only the specifically exported symbols instead of applying to all forward declarations. BUG=519562 R=rmcilroy@chromium.org Review URL: https://codereview.chromium.org/1279163006 . Cr-Commit-Position: refs/heads/master@{#343370}
Diffstat (limited to 'base')
-rw-r--r--base/android/jni_generator/golden_sample_for_tests_jni.h117
-rwxr-xr-xbase/android/jni_generator/jni_generator.py136
-rw-r--r--base/android/jni_generator/testEagerCalledByNativesOption.golden8
-rw-r--r--base/android/jni_generator/testInnerClassNatives.golden11
-rw-r--r--base/android/jni_generator/testInnerClassNativesBothInnerAndOuter.golden17
-rw-r--r--base/android/jni_generator/testInnerClassNativesMultiple.golden20
-rw-r--r--base/android/jni_generator/testJNIInitNativeNameOption.golden8
-rw-r--r--base/android/jni_generator/testJarJarRemapping.golden37
-rw-r--r--base/android/jni_generator/testMultipleJNIAdditionalImport.golden11
-rw-r--r--base/android/jni_generator/testNativeExportsOption.golden47
-rw-r--r--base/android/jni_generator/testNativeExportsOptionalOption.golden47
-rw-r--r--base/android/jni_generator/testNatives.golden143
-rw-r--r--base/android/jni_generator/testNativesLong.golden5
-rw-r--r--base/android/jni_generator/testPureNativeMethodsOption.golden8
-rw-r--r--base/android/jni_generator/testSingleJNIAdditionalImport.golden10
15 files changed, 402 insertions, 223 deletions
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 ba7494e..e146aca 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) {
diff --git a/base/android/jni_generator/jni_generator.py b/base/android/jni_generator/jni_generator.py
index 74d0117..f7c1393 100755
--- a/base/android/jni_generator/jni_generator.py
+++ b/base/android/jni_generator/jni_generator.py
@@ -764,7 +764,6 @@ $METHOD_ID_DEFINITIONS
} // namespace
$OPEN_NAMESPACE
-$FORWARD_DECLARATIONS
$CONSTANT_FIELDS
@@ -783,7 +782,6 @@ $JNI_REGISTER_NATIVES
'FULLY_QUALIFIED_CLASS': self.fully_qualified_class,
'CLASS_PATH_DEFINITIONS': self.GetClassPathDefinitionsString(),
'METHOD_ID_DEFINITIONS': self.GetMethodIDDefinitionsString(),
- 'FORWARD_DECLARATIONS': self.GetForwardDeclarationsString(),
'CONSTANT_FIELDS': self.GetConstantFieldsString(),
'METHOD_STUBS': self.GetMethodStubsString(),
'OPEN_NAMESPACE': self.GetOpenNamespaceString(),
@@ -816,15 +814,6 @@ jmethodID g_${JAVA_CLASS}_${METHOD_ID_VAR_NAME} = NULL;""")
ret += [template.substitute(values)]
return '\n'.join(ret)
- def GetForwardDeclarationsString(self):
- ret = []
- for native in self.natives:
- if native.type != 'method':
- ret += [self.GetForwardDeclaration(native)]
- if self.options.native_exports and ret:
- return '\nextern "C" {\n' + "\n".join(ret) + '\n}; // extern "C"'
- return '\n'.join(ret)
-
def GetConstantFieldsString(self):
if not self.constant_fields:
return ''
@@ -838,15 +827,11 @@ jmethodID g_${JAVA_CLASS}_${METHOD_ID_VAR_NAME} = NULL;""")
"""Returns the code corresponding to method stubs."""
ret = []
for native in self.natives:
- if native.type == 'method':
- ret += [self.GetNativeMethodStubString(native)]
+ ret += [self.GetNativeStub(native)]
if self.options.eager_called_by_natives:
ret += self.GetEagerCalledByNativeMethodStubs()
else:
ret += self.GetLazyCalledByNativeMethodStubs()
-
- if self.options.native_exports and ret:
- return '\nextern "C" {\n' + "\n".join(ret) + '\n}; // extern "C"'
return '\n'.join(ret)
def GetLazyCalledByNativeMethodStubs(self):
@@ -1053,90 +1038,75 @@ Java_${FULLY_QUALIFIED_CLASS}_${INIT_NATIVE_NAME}(JNIEnv* env, jclass clazz) {
native: the native dictionary describing the method.
Returns:
- A string with the stub function name. For native exports mode this is the
- Java_* symbol name required by the JVM; otherwise it is just the name of
- the native method itself.
+ A string with the stub function name (used by the JVM).
"""
- if self.options.native_exports:
- template = Template("Java_${JAVA_NAME}_native${NAME}")
+ template = Template("Java_${JAVA_NAME}_native${NAME}")
- java_name = JniParams.RemapClassName(self.fully_qualified_class)
- java_name = java_name.replace('_', '_1').replace('/', '_')
- if native.java_class_name:
- java_name += '_00024' + native.java_class_name
+ java_name = JniParams.RemapClassName(self.fully_qualified_class)
+ java_name = java_name.replace('_', '_1').replace('/', '_')
+ if native.java_class_name:
+ java_name += '_00024' + native.java_class_name
- values = {'NAME': native.name,
- 'JAVA_NAME': java_name}
- return template.substitute(values)
- else:
- return native.name
+ values = {'NAME': native.name,
+ 'JAVA_NAME': java_name}
+ return template.substitute(values)
- def GetForwardDeclaration(self, native):
- template_str = """
-static ${RETURN} ${NAME}(JNIEnv* env, ${PARAMS});
-"""
- if self.options.native_exports:
- template_str += """
-__attribute__((visibility("default")))
-${RETURN} ${STUB_NAME}(JNIEnv* env, ${PARAMS}) {
- return ${NAME}(${PARAMS_IN_CALL});
-}
-"""
- template = Template(template_str)
+ def GetNativeStub(self, native):
+ is_method = native.type == 'method'
+
+ if is_method:
+ params = native.params[1:]
+ else:
+ params = native.params
params_in_call = []
if not self.options.pure_native_methods:
params_in_call = ['env', 'jcaller']
- params_in_call = ', '.join(params_in_call + [p.name for p in native.params])
+ params_in_call = ', '.join(params_in_call + [p.name for p in params])
- values = {'RETURN': JavaDataTypeToC(native.return_type),
- 'NAME': native.name,
- 'PARAMS': self.GetParamsInDeclaration(native),
- 'PARAMS_IN_CALL': params_in_call,
- 'STUB_NAME': self.GetStubName(native)}
- return template.substitute(values)
-
- def GetNativeMethodStubString(self, native):
- """Returns stubs for native methods."""
if self.options.native_exports:
- template_str = """\
-__attribute__((visibility("default")))
-${RETURN} ${STUB_NAME}(JNIEnv* env,
- ${PARAMS_IN_DECLARATION}) {"""
+ stub_visibility = 'extern "C" __attribute__((visibility("default")))\n'
else:
- template_str = """\
-static ${RETURN} ${STUB_NAME}(JNIEnv* env, ${PARAMS_IN_DECLARATION}) {"""
- template_str += """
- ${P0_TYPE}* native = reinterpret_cast<${P0_TYPE}*>(${PARAM0_NAME});
- CHECK_NATIVE_PTR(env, jcaller, native, "${NAME}"${OPTIONAL_ERROR_RETURN});
- return native->${NAME}(${PARAMS_IN_CALL})${POST_CALL};
-}
-"""
-
- template = Template(template_str)
- params = []
- if not self.options.pure_native_methods:
- params = ['env', 'jcaller']
- params_in_call = ', '.join(params + [p.name for p in native.params[1:]])
-
+ stub_visibility = 'static '
return_type = JavaDataTypeToC(native.return_type)
- optional_error_return = JavaReturnValueToC(native.return_type)
- if optional_error_return:
- optional_error_return = ', ' + optional_error_return
- post_call = ''
- if re.match(RE_SCOPED_JNI_RETURN_TYPES, return_type):
- post_call = '.Release()'
-
values = {
'RETURN': return_type,
- 'OPTIONAL_ERROR_RETURN': optional_error_return,
'NAME': native.name,
- 'PARAMS_IN_DECLARATION': self.GetParamsInDeclaration(native),
- 'PARAM0_NAME': native.params[0].name,
- 'P0_TYPE': native.p0_type,
+ 'PARAMS': self.GetParamsInDeclaration(native),
'PARAMS_IN_CALL': params_in_call,
- 'POST_CALL': post_call,
'STUB_NAME': self.GetStubName(native),
+ 'STUB_VISIBILITY': stub_visibility,
}
+
+ if is_method:
+ optional_error_return = JavaReturnValueToC(native.return_type)
+ if optional_error_return:
+ optional_error_return = ', ' + optional_error_return
+ post_call = ''
+ if re.match(RE_SCOPED_JNI_RETURN_TYPES, return_type):
+ post_call = '.Release()'
+ values.update({
+ 'OPTIONAL_ERROR_RETURN': optional_error_return,
+ 'PARAM0_NAME': native.params[0].name,
+ 'P0_TYPE': native.p0_type,
+ 'POST_CALL': post_call,
+ })
+ template = Template("""\
+${STUB_VISIBILITY}${RETURN} ${STUB_NAME}(JNIEnv* env,
+ ${PARAMS}) {
+ ${P0_TYPE}* native = reinterpret_cast<${P0_TYPE}*>(${PARAM0_NAME});
+ CHECK_NATIVE_PTR(env, jcaller, native, "${NAME}"${OPTIONAL_ERROR_RETURN});
+ return native->${NAME}(${PARAMS_IN_CALL})${POST_CALL};
+}
+""")
+ else:
+ template = Template("""
+static ${RETURN} ${NAME}(JNIEnv* env, ${PARAMS});
+
+${STUB_VISIBILITY}${RETURN} ${STUB_NAME}(JNIEnv* env, ${PARAMS}) {
+ return ${NAME}(${PARAMS_IN_CALL});
+}
+""")
+
return template.substitute(values)
def GetArgument(self, param):
diff --git a/base/android/jni_generator/testEagerCalledByNativesOption.golden b/base/android/jni_generator/testEagerCalledByNativesOption.golden
index 19108bf..52ff798 100644
--- a/base/android/jni_generator/testEagerCalledByNativesOption.golden
+++ b/base/android/jni_generator/testEagerCalledByNativesOption.golden
@@ -29,7 +29,9 @@ jmethodID g_Test_testStaticMethodWithNoParam = NULL;
} // namespace
// Step 2: method stubs.
-static jint Method(JNIEnv* env, jobject jcaller,
+static jint Java_org_chromium_example_jni_1generator_Test_nativeMethod(JNIEnv*
+ env,
+ jobject jcaller,
jlong nativeTest,
jint arg1) {
Test* native = reinterpret_cast<Test*>(nativeTest);
@@ -75,7 +77,9 @@ static const JNINativeMethod kMethodsTest[] = {
"J"
"I"
")"
-"I", reinterpret_cast<void*>(Method) },
+"I",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_Test_nativeMethod)
+ },
};
static bool RegisterNativesImpl(JNIEnv* env, jclass clazz) {
diff --git a/base/android/jni_generator/testInnerClassNatives.golden b/base/android/jni_generator/testInnerClassNatives.golden
index 5a525ef..d6676c4 100644
--- a/base/android/jni_generator/testInnerClassNatives.golden
+++ b/base/android/jni_generator/testInnerClassNatives.golden
@@ -26,9 +26,14 @@ jclass g_TestJni_clazz = NULL;
} // namespace
+// Step 2: method stubs.
+
static jint Init(JNIEnv* env, jobject jcaller);
-// Step 2: method stubs.
+static jint Java_org_chromium_TestJni_00024MyInnerClass_nativeInit(JNIEnv* env,
+ jobject jcaller) {
+ return Init(env, jcaller);
+}
// Step 3: RegisterNatives.
@@ -36,7 +41,9 @@ static const JNINativeMethod kMethodsMyInnerClass[] = {
{ "nativeInit",
"("
")"
-"I", reinterpret_cast<void*>(Init) },
+"I",
+ reinterpret_cast<void*>(Java_org_chromium_TestJni_00024MyInnerClass_nativeInit)
+ },
};
static bool RegisterNativesImpl(JNIEnv* env) {
diff --git a/base/android/jni_generator/testInnerClassNativesBothInnerAndOuter.golden b/base/android/jni_generator/testInnerClassNativesBothInnerAndOuter.golden
index c8d4b3c..a9e645c 100644
--- a/base/android/jni_generator/testInnerClassNativesBothInnerAndOuter.golden
+++ b/base/android/jni_generator/testInnerClassNativesBothInnerAndOuter.golden
@@ -27,11 +27,20 @@ jclass g_TestJni_clazz = NULL;
} // namespace
+// Step 2: method stubs.
+
static jint Init(JNIEnv* env, jobject jcaller);
+static jint Java_org_chromium_TestJni_nativeInit(JNIEnv* env, jobject jcaller) {
+ return Init(env, jcaller);
+}
+
static jint Init(JNIEnv* env, jobject jcaller);
-// Step 2: method stubs.
+static jint Java_org_chromium_TestJni_00024MyOtherInnerClass_nativeInit(JNIEnv*
+ env, jobject jcaller) {
+ return Init(env, jcaller);
+}
// Step 3: RegisterNatives.
@@ -39,14 +48,16 @@ static const JNINativeMethod kMethodsMyOtherInnerClass[] = {
{ "nativeInit",
"("
")"
-"I", reinterpret_cast<void*>(Init) },
+"I",
+ reinterpret_cast<void*>(Java_org_chromium_TestJni_00024MyOtherInnerClass_nativeInit)
+ },
};
static const JNINativeMethod kMethodsTestJni[] = {
{ "nativeInit",
"("
")"
-"I", reinterpret_cast<void*>(Init) },
+"I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeInit) },
};
static bool RegisterNativesImpl(JNIEnv* env) {
diff --git a/base/android/jni_generator/testInnerClassNativesMultiple.golden b/base/android/jni_generator/testInnerClassNativesMultiple.golden
index 42643ae..5f54364 100644
--- a/base/android/jni_generator/testInnerClassNativesMultiple.golden
+++ b/base/android/jni_generator/testInnerClassNativesMultiple.golden
@@ -28,11 +28,21 @@ jclass g_TestJni_clazz = NULL;
} // namespace
+// Step 2: method stubs.
+
static jint Init(JNIEnv* env, jobject jcaller);
+static jint Java_org_chromium_TestJni_00024MyInnerClass_nativeInit(JNIEnv* env,
+ jobject jcaller) {
+ return Init(env, jcaller);
+}
+
static jint Init(JNIEnv* env, jobject jcaller);
-// Step 2: method stubs.
+static jint Java_org_chromium_TestJni_00024MyOtherInnerClass_nativeInit(JNIEnv*
+ env, jobject jcaller) {
+ return Init(env, jcaller);
+}
// Step 3: RegisterNatives.
@@ -40,14 +50,18 @@ static const JNINativeMethod kMethodsMyOtherInnerClass[] = {
{ "nativeInit",
"("
")"
-"I", reinterpret_cast<void*>(Init) },
+"I",
+ reinterpret_cast<void*>(Java_org_chromium_TestJni_00024MyOtherInnerClass_nativeInit)
+ },
};
static const JNINativeMethod kMethodsMyInnerClass[] = {
{ "nativeInit",
"("
")"
-"I", reinterpret_cast<void*>(Init) },
+"I",
+ reinterpret_cast<void*>(Java_org_chromium_TestJni_00024MyInnerClass_nativeInit)
+ },
};
static bool RegisterNativesImpl(JNIEnv* env) {
diff --git a/base/android/jni_generator/testJNIInitNativeNameOption.golden b/base/android/jni_generator/testJNIInitNativeNameOption.golden
index a0998da..084f08d 100644
--- a/base/android/jni_generator/testJNIInitNativeNameOption.golden
+++ b/base/android/jni_generator/testJNIInitNativeNameOption.golden
@@ -26,7 +26,9 @@ jclass g_Test_clazz = NULL;
} // namespace
// Step 2: method stubs.
-static jint Method(JNIEnv* env, jobject jcaller,
+static jint Java_org_chromium_example_jni_1generator_Test_nativeMethod(JNIEnv*
+ env,
+ jobject jcaller,
jlong nativeTest,
jint arg1) {
Test* native = reinterpret_cast<Test*>(nativeTest);
@@ -42,7 +44,9 @@ static const JNINativeMethod kMethodsTest[] = {
"J"
"I"
")"
-"I", reinterpret_cast<void*>(Method) },
+"I",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_Test_nativeMethod)
+ },
};
static bool RegisterNativesImpl(JNIEnv* env, jclass clazz) {
diff --git a/base/android/jni_generator/testJarJarRemapping.golden b/base/android/jni_generator/testJarJarRemapping.golden
index 2f85122..b626a8a 100644
--- a/base/android/jni_generator/testJarJarRemapping.golden
+++ b/base/android/jni_generator/testJarJarRemapping.golden
@@ -25,19 +25,43 @@ jclass g_Example_clazz = NULL;
} // namespace
+// Step 2: method stubs.
+
static void Test(JNIEnv* env, jclass jcaller,
jobject t);
+static void Java_com_test_jni_1generator_Example_nativeTest(JNIEnv* env, jclass
+ jcaller,
+ jobject t) {
+ return Test(env, jcaller, t);
+}
+
static void Test2(JNIEnv* env, jclass jcaller,
jobject t);
+static void Java_com_test_jni_1generator_Example_nativeTest2(JNIEnv* env, jclass
+ jcaller,
+ jobject t) {
+ return Test2(env, jcaller, t);
+}
+
static void Test3(JNIEnv* env, jclass jcaller,
jobject t);
+static void Java_com_test_jni_1generator_Example_nativeTest3(JNIEnv* env, jclass
+ jcaller,
+ jobject t) {
+ return Test3(env, jcaller, t);
+}
+
static void Test4(JNIEnv* env, jclass jcaller,
jobject t);
-// Step 2: method stubs.
+static void Java_com_test_jni_1generator_Example_nativeTest4(JNIEnv* env, jclass
+ jcaller,
+ jobject t) {
+ return Test4(env, jcaller, t);
+}
// Step 3: RegisterNatives.
@@ -46,22 +70,25 @@ static const JNINativeMethod kMethodsExample[] = {
"("
"Lorg/test2/Test;"
")"
-"V", reinterpret_cast<void*>(Test) },
+"V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest) },
{ "nativeTest2",
"("
"Lorg/chromium/example3/PrefixFoo;"
")"
-"V", reinterpret_cast<void*>(Test2) },
+"V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest2)
+ },
{ "nativeTest3",
"("
"Lorg/test3/Test;"
")"
-"V", reinterpret_cast<void*>(Test3) },
+"V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest3)
+ },
{ "nativeTest4",
"("
"Lorg/test3/TestBar$Inner;"
")"
-"V", reinterpret_cast<void*>(Test4) },
+"V", reinterpret_cast<void*>(Java_com_test_jni_1generator_Example_nativeTest4)
+ },
};
static bool RegisterNativesImpl(JNIEnv* env) {
diff --git a/base/android/jni_generator/testMultipleJNIAdditionalImport.golden b/base/android/jni_generator/testMultipleJNIAdditionalImport.golden
index b0db9dd..eb15190 100644
--- a/base/android/jni_generator/testMultipleJNIAdditionalImport.golden
+++ b/base/android/jni_generator/testMultipleJNIAdditionalImport.golden
@@ -25,11 +25,18 @@ jclass g_Foo_clazz = NULL;
} // namespace
+// Step 2: method stubs.
+
static void DoSomething(JNIEnv* env, jclass jcaller,
jobject callback1,
jobject callback2);
-// Step 2: method stubs.
+static void Java_org_chromium_foo_Foo_nativeDoSomething(JNIEnv* env, jclass
+ jcaller,
+ jobject callback1,
+ jobject callback2) {
+ return DoSomething(env, jcaller, callback1, callback2);
+}
static base::subtle::AtomicWord g_Foo_calledByNative = 0;
static void Java_Foo_calledByNative(JNIEnv* env, jobject callback1,
@@ -64,7 +71,7 @@ static const JNINativeMethod kMethodsFoo[] = {
"Lorg/chromium/foo/Bar1$Callback;"
"Lorg/chromium/foo/Bar2$Callback;"
")"
-"V", reinterpret_cast<void*>(DoSomething) },
+"V", reinterpret_cast<void*>(Java_org_chromium_foo_Foo_nativeDoSomething) },
};
static bool RegisterNativesImpl(JNIEnv* env) {
diff --git a/base/android/jni_generator/testNativeExportsOption.golden b/base/android/jni_generator/testNativeExportsOption.golden
index 395fc39..d9b8d6a 100644
--- a/base/android/jni_generator/testNativeExportsOption.golden
+++ b/base/android/jni_generator/testNativeExportsOption.golden
@@ -26,32 +26,8 @@ base::subtle::AtomicWord g_SampleForTests_clazz __attribute__((unused)) = 0;
} // namespace
-extern "C" {
-
-static jint Init(JNIEnv* env, jobject jcaller);
-
-__attribute__((visibility("default")))
-jint
- Java_org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass_nativeInit(JNIEnv*
- env, jobject jcaller) {
- return Init(env, jcaller);
-}
-
-static jint Init(JNIEnv* env, jobject jcaller);
-
-__attribute__((visibility("default")))
-jint
- Java_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass_nativeInit(JNIEnv*
- env, jobject jcaller) {
- return Init(env, jcaller);
-}
-
-}; // extern "C"
-
// Step 2: method stubs.
-
-extern "C" {
-__attribute__((visibility("default")))
+extern "C" __attribute__((visibility("default")))
jint
Java_org_chromium_example_jni_1generator_SampleForTests_nativeStaticMethod(JNIEnv*
env,
@@ -63,7 +39,7 @@ jint
return native->StaticMethod(env, jcaller, arg1);
}
-__attribute__((visibility("default")))
+extern "C" __attribute__((visibility("default")))
jint
Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv*
env,
@@ -75,6 +51,24 @@ jint
return native->Method(env, jcaller, arg1);
}
+static jint Init(JNIEnv* env, jobject jcaller);
+
+extern "C" __attribute__((visibility("default")))
+jint
+ Java_org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass_nativeInit(JNIEnv*
+ env, jobject jcaller) {
+ return Init(env, jcaller);
+}
+
+static jint Init(JNIEnv* env, jobject jcaller);
+
+extern "C" __attribute__((visibility("default")))
+jint
+ Java_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass_nativeInit(JNIEnv*
+ env, jobject jcaller) {
+ return Init(env, jcaller);
+}
+
static base::subtle::AtomicWord g_SampleForTests_testMethodWithParam = 0;
static void Java_SampleForTests_testMethodWithParam(JNIEnv* env, jobject obj,
JniIntWrapper iParam) {
@@ -198,7 +192,6 @@ static_cast<jstring>(env->CallStaticObjectMethod(SampleForTests_clazz(env),
jni_generator::CheckException(env);
return base::android::ScopedJavaLocalRef<jstring>(env, ret);
}
-}; // extern "C"
// Step 3: RegisterNatives.
diff --git a/base/android/jni_generator/testNativeExportsOptionalOption.golden b/base/android/jni_generator/testNativeExportsOptionalOption.golden
index f47cb98..2bb7721 100644
--- a/base/android/jni_generator/testNativeExportsOptionalOption.golden
+++ b/base/android/jni_generator/testNativeExportsOptionalOption.golden
@@ -26,32 +26,8 @@ base::subtle::AtomicWord g_SampleForTests_clazz __attribute__((unused)) = 0;
} // namespace
-extern "C" {
-
-static jint Init(JNIEnv* env, jobject jcaller);
-
-__attribute__((visibility("default")))
-jint
- Java_org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass_nativeInit(JNIEnv*
- env, jobject jcaller) {
- return Init(env, jcaller);
-}
-
-static jint Init(JNIEnv* env, jobject jcaller);
-
-__attribute__((visibility("default")))
-jint
- Java_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass_nativeInit(JNIEnv*
- env, jobject jcaller) {
- return Init(env, jcaller);
-}
-
-}; // extern "C"
-
// Step 2: method stubs.
-
-extern "C" {
-__attribute__((visibility("default")))
+extern "C" __attribute__((visibility("default")))
jint
Java_org_chromium_example_jni_1generator_SampleForTests_nativeStaticMethod(JNIEnv*
env,
@@ -63,7 +39,7 @@ jint
return native->StaticMethod(env, jcaller, arg1);
}
-__attribute__((visibility("default")))
+extern "C" __attribute__((visibility("default")))
jint
Java_org_chromium_example_jni_1generator_SampleForTests_nativeMethod(JNIEnv*
env,
@@ -75,6 +51,24 @@ jint
return native->Method(env, jcaller, arg1);
}
+static jint Init(JNIEnv* env, jobject jcaller);
+
+extern "C" __attribute__((visibility("default")))
+jint
+ Java_org_chromium_example_jni_1generator_SampleForTests_00024MyInnerClass_nativeInit(JNIEnv*
+ env, jobject jcaller) {
+ return Init(env, jcaller);
+}
+
+static jint Init(JNIEnv* env, jobject jcaller);
+
+extern "C" __attribute__((visibility("default")))
+jint
+ Java_org_chromium_example_jni_1generator_SampleForTests_00024MyOtherInnerClass_nativeInit(JNIEnv*
+ env, jobject jcaller) {
+ return Init(env, jcaller);
+}
+
static base::subtle::AtomicWord g_SampleForTests_testMethodWithParam = 0;
static void Java_SampleForTests_testMethodWithParam(JNIEnv* env, jobject obj,
JniIntWrapper iParam) {
@@ -198,7 +192,6 @@ static_cast<jstring>(env->CallStaticObjectMethod(SampleForTests_clazz(env),
jni_generator::CheckException(env);
return base::android::ScopedJavaLocalRef<jstring>(env, ret);
}
-}; // extern "C"
// Step 3: RegisterNatives.
diff --git a/base/android/jni_generator/testNatives.golden b/base/android/jni_generator/testNatives.golden
index e5a4fab..64f76c1 100644
--- a/base/android/jni_generator/testNatives.golden
+++ b/base/android/jni_generator/testNatives.golden
@@ -25,31 +25,16 @@ jclass g_TestJni_clazz = NULL;
} // namespace
-static jint Init(JNIEnv* env, jobject jcaller);
-
-static jstring GetDomainAndRegistry(JNIEnv* env, jclass jcaller,
- jstring url);
-
-static void CreateHistoricalTabFromState(JNIEnv* env, jclass jcaller,
- jbyteArray state,
- jint tab_index);
-
-static jbyteArray GetStateAsByteArray(JNIEnv* env, jobject jcaller,
- jobject view);
-
-static jobjectArray GetAutofillProfileGUIDs(JNIEnv* env, jclass jcaller);
-
-static void SetRecognitionResults(JNIEnv* env, jobject jcaller,
- jint sessionId,
- jobjectArray results);
+// Step 2: method stubs.
-static jint FindAll(JNIEnv* env, jobject jcaller,
- jstring find);
+static jint Init(JNIEnv* env, jobject jcaller);
-static jobject GetInnerClass(JNIEnv* env, jclass jcaller);
+static jint Java_org_chromium_TestJni_nativeInit(JNIEnv* env, jobject jcaller) {
+ return Init(env, jcaller);
+}
-// Step 2: method stubs.
-static void Destroy(JNIEnv* env, jobject jcaller,
+static void Java_org_chromium_TestJni_nativeDestroy(JNIEnv* env,
+ jobject jcaller,
jint nativeChromeBrowserProvider) {
ChromeBrowserProvider* native =
reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
@@ -57,7 +42,8 @@ static void Destroy(JNIEnv* env, jobject jcaller,
return native->Destroy(env, jcaller);
}
-static jlong AddBookmark(JNIEnv* env, jobject jcaller,
+static jlong Java_org_chromium_TestJni_nativeAddBookmark(JNIEnv* env,
+ jobject jcaller,
jint nativeChromeBrowserProvider,
jstring url,
jstring title,
@@ -69,7 +55,56 @@ static jlong AddBookmark(JNIEnv* env, jobject jcaller,
return native->AddBookmark(env, jcaller, url, title, isFolder, parentId);
}
-static jlong AddBookmarkFromAPI(JNIEnv* env, jobject jcaller,
+static jstring GetDomainAndRegistry(JNIEnv* env, jclass jcaller,
+ jstring url);
+
+static jstring Java_org_chromium_TestJni_nativeGetDomainAndRegistry(JNIEnv* env,
+ jclass jcaller,
+ jstring url) {
+ return GetDomainAndRegistry(env, jcaller, url);
+}
+
+static void CreateHistoricalTabFromState(JNIEnv* env, jclass jcaller,
+ jbyteArray state,
+ jint tab_index);
+
+static void Java_org_chromium_TestJni_nativeCreateHistoricalTabFromState(JNIEnv*
+ env, jclass jcaller,
+ jbyteArray state,
+ jint tab_index) {
+ return CreateHistoricalTabFromState(env, jcaller, state, tab_index);
+}
+
+static jbyteArray GetStateAsByteArray(JNIEnv* env, jobject jcaller,
+ jobject view);
+
+static jbyteArray Java_org_chromium_TestJni_nativeGetStateAsByteArray(JNIEnv*
+ env, jobject jcaller,
+ jobject view) {
+ return GetStateAsByteArray(env, jcaller, view);
+}
+
+static jobjectArray GetAutofillProfileGUIDs(JNIEnv* env, jclass jcaller);
+
+static jobjectArray
+ Java_org_chromium_TestJni_nativeGetAutofillProfileGUIDs(JNIEnv* env, jclass
+ jcaller) {
+ return GetAutofillProfileGUIDs(env, jcaller);
+}
+
+static void SetRecognitionResults(JNIEnv* env, jobject jcaller,
+ jint sessionId,
+ jobjectArray results);
+
+static void Java_org_chromium_TestJni_nativeSetRecognitionResults(JNIEnv* env,
+ jobject jcaller,
+ jint sessionId,
+ jobjectArray results) {
+ return SetRecognitionResults(env, jcaller, sessionId, results);
+}
+
+static jlong Java_org_chromium_TestJni_nativeAddBookmarkFromAPI(JNIEnv* env,
+ jobject jcaller,
jint nativeChromeBrowserProvider,
jstring url,
jobject created,
@@ -85,7 +120,24 @@ static jlong AddBookmarkFromAPI(JNIEnv* env, jobject jcaller,
date, favicon, title, visits);
}
-static jobject QueryBitmap(JNIEnv* env, jobject jcaller,
+static jint FindAll(JNIEnv* env, jobject jcaller,
+ jstring find);
+
+static jint Java_org_chromium_TestJni_nativeFindAll(JNIEnv* env, jobject
+ jcaller,
+ jstring find) {
+ return FindAll(env, jcaller, find);
+}
+
+static jobject GetInnerClass(JNIEnv* env, jclass jcaller);
+
+static jobject Java_org_chromium_TestJni_nativeGetInnerClass(JNIEnv* env, jclass
+ jcaller) {
+ return GetInnerClass(env, jcaller);
+}
+
+static jobject Java_org_chromium_TestJni_nativeQueryBitmap(JNIEnv* env,
+ jobject jcaller,
jint nativeChromeBrowserProvider,
jobjectArray projection,
jstring selection,
@@ -98,7 +150,8 @@ static jobject QueryBitmap(JNIEnv* env, jobject jcaller,
sortOrder).Release();
}
-static void GotOrientation(JNIEnv* env, jobject jcaller,
+static void Java_org_chromium_TestJni_nativeGotOrientation(JNIEnv* env,
+ jobject jcaller,
jint nativeDataFetcherImplAndroid,
jdouble alpha,
jdouble beta,
@@ -115,12 +168,12 @@ static const JNINativeMethod kMethodsTestJni[] = {
{ "nativeInit",
"("
")"
-"I", reinterpret_cast<void*>(Init) },
+"I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeInit) },
{ "nativeDestroy",
"("
"I"
")"
-"V", reinterpret_cast<void*>(Destroy) },
+"V", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeDestroy) },
{ "nativeAddBookmark",
"("
"I"
@@ -129,33 +182,43 @@ static const JNINativeMethod kMethodsTestJni[] = {
"Z"
"J"
")"
-"J", reinterpret_cast<void*>(AddBookmark) },
+"J", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeAddBookmark) },
{ "nativeGetDomainAndRegistry",
"("
"Ljava/lang/String;"
")"
-"Ljava/lang/String;", reinterpret_cast<void*>(GetDomainAndRegistry) },
+"Ljava/lang/String;",
+ reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetDomainAndRegistry)
+ },
{ "nativeCreateHistoricalTabFromState",
"("
"[B"
"I"
")"
-"V", reinterpret_cast<void*>(CreateHistoricalTabFromState) },
+"V",
+ reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeCreateHistoricalTabFromState)
+ },
{ "nativeGetStateAsByteArray",
"("
"Landroid/view/View;"
")"
-"[B", reinterpret_cast<void*>(GetStateAsByteArray) },
+"[B",
+ reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetStateAsByteArray)
+ },
{ "nativeGetAutofillProfileGUIDs",
"("
")"
-"[Ljava/lang/String;", reinterpret_cast<void*>(GetAutofillProfileGUIDs) },
+"[Ljava/lang/String;",
+ reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetAutofillProfileGUIDs)
+ },
{ "nativeSetRecognitionResults",
"("
"I"
"[Ljava/lang/String;"
")"
-"V", reinterpret_cast<void*>(SetRecognitionResults) },
+"V",
+ reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeSetRecognitionResults)
+ },
{ "nativeAddBookmarkFromAPI",
"("
"I"
@@ -167,17 +230,18 @@ static const JNINativeMethod kMethodsTestJni[] = {
"Ljava/lang/String;"
"Ljava/lang/Integer;"
")"
-"J", reinterpret_cast<void*>(AddBookmarkFromAPI) },
+"J", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeAddBookmarkFromAPI)
+ },
{ "nativeFindAll",
"("
"Ljava/lang/String;"
")"
-"I", reinterpret_cast<void*>(FindAll) },
+"I", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeFindAll) },
{ "nativeGetInnerClass",
"("
")"
"Lorg/chromium/example/jni_generator/SampleForTests$OnFrameAvailableListener;",
- reinterpret_cast<void*>(GetInnerClass) },
+ reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGetInnerClass) },
{ "nativeQueryBitmap",
"("
"I"
@@ -186,7 +250,8 @@ static const JNINativeMethod kMethodsTestJni[] = {
"[Ljava/lang/String;"
"Ljava/lang/String;"
")"
-"Landroid/graphics/Bitmap;", reinterpret_cast<void*>(QueryBitmap) },
+"Landroid/graphics/Bitmap;",
+ reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeQueryBitmap) },
{ "nativeGotOrientation",
"("
"I"
@@ -194,7 +259,7 @@ static const JNINativeMethod kMethodsTestJni[] = {
"D"
"D"
")"
-"V", reinterpret_cast<void*>(GotOrientation) },
+"V", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeGotOrientation) },
};
static bool RegisterNativesImpl(JNIEnv* env) {
diff --git a/base/android/jni_generator/testNativesLong.golden b/base/android/jni_generator/testNativesLong.golden
index 5fa901c..1235616 100644
--- a/base/android/jni_generator/testNativesLong.golden
+++ b/base/android/jni_generator/testNativesLong.golden
@@ -26,7 +26,8 @@ jclass g_TestJni_clazz = NULL;
} // namespace
// Step 2: method stubs.
-static void Destroy(JNIEnv* env, jobject jcaller,
+static void Java_org_chromium_TestJni_nativeDestroy(JNIEnv* env,
+ jobject jcaller,
jlong nativeChromeBrowserProvider) {
ChromeBrowserProvider* native =
reinterpret_cast<ChromeBrowserProvider*>(nativeChromeBrowserProvider);
@@ -41,7 +42,7 @@ static const JNINativeMethod kMethodsTestJni[] = {
"("
"J"
")"
-"V", reinterpret_cast<void*>(Destroy) },
+"V", reinterpret_cast<void*>(Java_org_chromium_TestJni_nativeDestroy) },
};
static bool RegisterNativesImpl(JNIEnv* env) {
diff --git a/base/android/jni_generator/testPureNativeMethodsOption.golden b/base/android/jni_generator/testPureNativeMethodsOption.golden
index ad63cca..52e03cc 100644
--- a/base/android/jni_generator/testPureNativeMethodsOption.golden
+++ b/base/android/jni_generator/testPureNativeMethodsOption.golden
@@ -26,7 +26,9 @@ jclass g_Test_clazz = NULL;
} // namespace
// Step 2: method stubs.
-static jlong Method(JNIEnv* env, jobject jcaller,
+static jlong Java_org_chromium_example_jni_1generator_Test_nativeMethod(JNIEnv*
+ env,
+ jobject jcaller,
jlong nativeTest,
jint arg1) {
Test* native = reinterpret_cast<Test*>(nativeTest);
@@ -42,7 +44,9 @@ static const JNINativeMethod kMethodsTest[] = {
"J"
"I"
")"
-"J", reinterpret_cast<void*>(Method) },
+"J",
+ reinterpret_cast<void*>(Java_org_chromium_example_jni_1generator_Test_nativeMethod)
+ },
};
static bool RegisterNativesImpl(JNIEnv* env) {
diff --git a/base/android/jni_generator/testSingleJNIAdditionalImport.golden b/base/android/jni_generator/testSingleJNIAdditionalImport.golden
index 1cf6554..3536139 100644
--- a/base/android/jni_generator/testSingleJNIAdditionalImport.golden
+++ b/base/android/jni_generator/testSingleJNIAdditionalImport.golden
@@ -25,10 +25,16 @@ jclass g_Foo_clazz = NULL;
} // namespace
+// Step 2: method stubs.
+
static void DoSomething(JNIEnv* env, jclass jcaller,
jobject callback);
-// Step 2: method stubs.
+static void Java_org_chromium_foo_Foo_nativeDoSomething(JNIEnv* env, jclass
+ jcaller,
+ jobject callback) {
+ return DoSomething(env, jcaller, callback);
+}
static base::subtle::AtomicWord g_Foo_calledByNative = 0;
static void Java_Foo_calledByNative(JNIEnv* env, jobject callback) {
@@ -60,7 +66,7 @@ static const JNINativeMethod kMethodsFoo[] = {
"("
"Lorg/chromium/foo/Bar$Callback;"
")"
-"V", reinterpret_cast<void*>(DoSomething) },
+"V", reinterpret_cast<void*>(Java_org_chromium_foo_Foo_nativeDoSomething) },
};
static bool RegisterNativesImpl(JNIEnv* env) {