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

Side by Side Diff: base/android/jni_generator/jni_generator.py

Issue 133943002: Gamepad API support for chrome on android (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 6 years, 6 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Extracts native methods from a Java file and generates the JNI bindings. 6 """Extracts native methods from a Java file and generates the JNI bindings.
7 If you change this, please run and update the tests.""" 7 If you change this, please run and update the tests."""
8 8
9 import collections 9 import collections
10 import errno 10 import errno
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 401
402 def GetStaticCastForReturnType(return_type): 402 def GetStaticCastForReturnType(return_type):
403 type_map = { 'String' : 'jstring', 403 type_map = { 'String' : 'jstring',
404 'java/lang/String' : 'jstring', 404 'java/lang/String' : 'jstring',
405 'boolean[]': 'jbooleanArray', 405 'boolean[]': 'jbooleanArray',
406 'byte[]': 'jbyteArray', 406 'byte[]': 'jbyteArray',
407 'char[]': 'jcharArray', 407 'char[]': 'jcharArray',
408 'short[]': 'jshortArray', 408 'short[]': 'jshortArray',
409 'int[]': 'jintArray', 409 'int[]': 'jintArray',
410 'long[]': 'jlongArray', 410 'long[]': 'jlongArray',
411 'float[]': 'jfloatArray',
411 'double[]': 'jdoubleArray' } 412 'double[]': 'jdoubleArray' }
412 ret = type_map.get(return_type, None) 413 ret = type_map.get(return_type, None)
413 if ret: 414 if ret:
414 return ret 415 return ret
415 if return_type.endswith('[]'): 416 if return_type.endswith('[]'):
416 return 'jobjectArray' 417 return 'jobjectArray'
417 return None 418 return None
418 419
419 420
420 def GetEnvCall(is_constructor, is_static, return_type): 421 def GetEnvCall(is_constructor, is_static, return_type):
(...skipping 987 matching lines...) Expand 10 before | Expand all | Expand 10 after
1408 root_name = os.path.splitext(os.path.basename(input_file))[0] 1409 root_name = os.path.splitext(os.path.basename(input_file))[0]
1409 output_file = os.path.join(options.output_dir, root_name) + '_jni.h' 1410 output_file = os.path.join(options.output_dir, root_name) + '_jni.h'
1410 if options.jarjar: 1411 if options.jarjar:
1411 with open(options.jarjar) as f: 1412 with open(options.jarjar) as f:
1412 JniParams.SetJarJarMappings(f.read()) 1413 JniParams.SetJarJarMappings(f.read())
1413 GenerateJNIHeader(input_file, output_file, options) 1414 GenerateJNIHeader(input_file, output_file, options)
1414 1415
1415 1416
1416 if __name__ == '__main__': 1417 if __name__ == '__main__':
1417 sys.exit(main(sys.argv)) 1418 sys.exit(main(sys.argv))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698