Chromium Code Reviews| 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 1946d48d39d4e0870a63471cc16a0bddf3c9c64d..2375fd404ea42e14108bf7ad8afd41c49d01265e 100755 |
| --- a/base/android/jni_generator/jni_generator.py |
| +++ b/base/android/jni_generator/jni_generator.py |
| @@ -153,7 +153,11 @@ def JavaDataTypeToCForCalledByNativeParam(java_type): |
| if java_type == 'int': |
| return 'JniIntWrapper' |
| else: |
| - return JavaDataTypeToC(java_type) |
| + c_type = JavaDataTypeToC(java_type) |
| + if re.match(RE_SCOPED_JNI_TYPES, c_type): |
| + return 'const base::android::JavaRefOrBare<' + c_type + '>&' |
| + else: |
| + return c_type |
| def JavaReturnValueToC(java_type): |
| @@ -1032,8 +1036,13 @@ ${RETURN} ${STUB_NAME}(JNIEnv* env, ${PARAMS_IN_STUB}) { |
| return template.substitute(values) |
| def GetArgument(self, param): |
| - return ('as_jint(' + param.name + ')' |
| - if param.datatype == 'int' else param.name) |
| + if param.datatype == 'int': |
| + return 'as_jint(' + param.name + ')' |
| + c_type = JavaDataTypeToC(java_type) |
|
rmcilroy
2016/08/08 13:08:29
is this line meant to be here? looks unused (and w
Torne
2016/08/08 13:34:24
No, that's a copypaste error I guess from the chun
|
| + elif re.match(RE_SCOPED_JNI_TYPES, JavaDataTypeToC(param.datatype)): |
| + return param.name + '.obj()' |
| + else: |
| + return param.name |
| def GetArgumentsInCall(self, params): |
| """Return a string of arguments to call from native into Java""" |
| @@ -1046,8 +1055,9 @@ ${RETURN} ${STUB_NAME}(JNIEnv* env, ${PARAMS_IN_STUB}) { |
| first_param_in_declaration = '' |
| first_param_in_call = ('%s_clazz(env)' % java_class) |
| else: |
| - first_param_in_declaration = ', jobject obj' |
| - first_param_in_call = 'obj' |
| + first_param_in_declaration = ( |
| + ', const base::android::JavaRefOrBare<jobject>& obj') |
| + first_param_in_call = 'obj.obj()' |
| params_in_declaration = self.GetCalledByNativeParamsInDeclaration( |
| called_by_native) |
| if params_in_declaration: |