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

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

Issue 2146753002: Android: Remove unneeded RegisterNatives() calls (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
« no previous file with comments | « base/android/java_runtime.cc ('k') | base/android/jni_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 b0134d6ae12e241c4506b91dc6b82cb65f533ed3..059af767318ed4689e893ae10e02e714b67710c2 100755
--- a/base/android/jni_generator/jni_generator.py
+++ b/base/android/jni_generator/jni_generator.py
@@ -740,7 +740,6 @@ $CONSTANT_FIELDS
// Step 2: method stubs.
$METHOD_STUBS
-// Step 3: RegisterNatives.
$JNI_NATIVE_METHODS
$REGISTER_NATIVES
$CLOSE_NAMESPACE
@@ -829,6 +828,10 @@ ${KMETHODS}
def GetRegisterNativesString(self):
"""Returns the code for RegisterNatives."""
+ natives = self.GetRegisterNativesImplString()
+ if not natives:
+ return ''
+
template = Template("""\
${REGISTER_NATIVES_SIGNATURE} {
${EARLY_EXIT}
@@ -844,7 +847,6 @@ ${NATIVES}
if (base::android::IsManualJniRegistrationDisabled()) return true;
"""
- natives = self.GetRegisterNativesImplString()
values = {'REGISTER_NATIVES_SIGNATURE': signature,
'EARLY_EXIT': early_exit,
'CLASSES': self.GetFindClasses(),
@@ -1106,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/java_runtime.cc ('k') | base/android/jni_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698