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

Unified Diff: base/android/jni_generator/jni_generator.py

Issue 2204623002: Android: Don't require RegisterNatives if there are none (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
Index: base/android/jni_generator/jni_generator.py
diff --git a/base/android/jni_generator/jni_generator.py b/base/android/jni_generator/jni_generator.py
index 4c58be2a94e8c51e77fa0d95fd68b4958fd028fe..0cb70bc836b379f4bf333c4219e78ef0a858f95f 100755
--- a/base/android/jni_generator/jni_generator.py
+++ b/base/android/jni_generator/jni_generator.py
@@ -848,7 +848,14 @@ ${NATIVES}
'EARLY_EXIT': early_exit,
'NATIVES': natives,
}
- return template.substitute(values)
+
+ func_declaration = ''
+ if not natives:
+ func_declaration = Template("""\
+${REGISTER_NATIVES_SIGNATURE} __attribute__((unused));
no sievers 2016/08/01 21:42:41 This can only be used on the declaration, not the
Torne 2016/08/02 12:23:13 Yeah attributes are annoying :)
+""").substitute(values)
+
+ return func_declaration + template.substitute(values)
def GetRegisterNativesImplString(self):
"""Returns the shared implementation for RegisterNatives."""
@@ -1101,7 +1108,6 @@ ${FUNCTION_SIGNATURE} {""")
template = Template("""
static base::subtle::AtomicWord g_${JAVA_CLASS}_${METHOD_ID_VAR_NAME} = 0;
${FUNCTION_HEADER}
- /* Must call RegisterNativesImpl() */
CHECK_CLAZZ(env, ${FIRST_PARAM_IN_CALL},
${JAVA_CLASS}_clazz(env)${OPTIONAL_ERROR_RETURN});
jmethodID method_id =
« no previous file with comments | « base/android/jni_generator/golden_sample_for_tests_jni.h ('k') | base/android/jni_generator/testCalledByNatives.golden » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698