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 85d8ce8077e2404148b8e1aa9579346f5fd42df6..56aa6a518cb732c55f0a62e15e6c0da29824dbe0 100755 |
--- a/base/android/jni_generator/jni_generator.py |
+++ b/base/android/jni_generator/jni_generator.py |
@@ -22,7 +22,7 @@ import textwrap |
import zipfile |
UNKNOWN_JAVA_TYPE_PREFIX = 'UNKNOWN_JAVA_TYPE: ' |
- |
+APP_PARAM_LIST = [] |
Yaron
2012/10/29 17:49:18
Nit: don't shorten. Call it APPLICATION_PARAM_LIST
bulach
2012/10/29 18:57:06
Done.
|
class ParseError(Exception): |
"""Exception thrown when we can't parse the input file.""" |
@@ -140,6 +140,7 @@ def JavaParamToJni(param): |
'Landroid/graphics/RectF', |
'Landroid/graphics/Matrix', |
'Landroid/graphics/Point', |
+ 'Landroid/graphics/SurfaceTexture', |
'Landroid/graphics/SurfaceTexture$OnFrameAvailableListener', |
'Landroid/media/MediaPlayer', |
'Landroid/os/Message', |
@@ -151,65 +152,6 @@ def JavaParamToJni(param): |
'Ljava/nio/ByteBuffer', |
'Ljava/util/Vector', |
] |
- app_param_list = [ |
- 'Landroid/graphics/SurfaceTexture', |
- 'Lcom/google/android/apps/chrome/ChromeContextMenuInfo', |
- 'Lcom/google/android/apps/chrome/ChromeWindow', |
- 'Lcom/google/android/apps/chrome/GoogleLocationSettingsHelperImpl', |
- 'Lcom/google/android/apps/chrome/OmniboxSuggestion', |
- 'Lcom/google/android/apps/chrome/PageInfoViewer', |
- 'Lcom/google/android/apps/chrome/Tab', |
- 'Lcom/google/android/apps/chrome/infobar/AutoLogin', |
- 'Lcom/google/android/apps/chrome/infobar/InfoBarContainer', |
- 'Lcom/google/android/apps/chrome/infobar/InfoBarContainer$NativeInfoBar', |
- ('Lcom/google/android/apps/chrome/preferences/ChromeNativePreferences$' |
- 'PasswordListObserver'), |
- 'Lorg/chromium/android_webview/AwContents', |
- 'Lorg/chromium/android_webview/AwContentsClient', |
- 'Lorg/chromium/android_webview/AwHttpAuthHandler', |
- 'Lorg/chromium/android_webview/AwContentsIoThreadClient', |
- 'Lorg/chromium/android_webview/AwWebContentsDelegate', |
- 'Lorg/chromium/android_webview/InterceptedRequestData', |
- 'Lorg/chromium/android_webview/JsPromptResultReceiver', |
- 'Lorg/chromium/android_webview/JsResultHandler', |
- 'Lorg/chromium/android_webview/JsResultReceiver', |
- 'Lorg/chromium/base/SystemMessageHandler', |
- 'Lorg/chromium/chrome/browser/autofill/AutofillExternalDelegate', |
- 'Lorg/chromium/chrome/browser/autofill/AutofillSuggestion', |
- 'Lorg/chromium/chrome/browser/ChromeBrowserProvider$BookmarkNode', |
- 'Lorg/chromium/chrome/browser/ChromeHttpAuthHandler', |
- 'Lorg/chromium/chrome/browser/ChromeWebContentsDelegateAndroid', |
- 'Lorg/chromium/chrome/browser/FindMatchRectsDetails', |
- 'Lorg/chromium/chrome/browser/FindNotificationDetails', |
- 'Lorg/chromium/chrome/browser/GoogleLocationSettingsHelper', |
- 'Lorg/chromium/chrome/browser/GoogleLocationSettingsHelperStub', |
- 'Lorg/chromium/chrome/browser/JavascriptAppModalDialog', |
- 'Lorg/chromium/chrome/browser/ProcessUtils', |
- ('Lorg/chromium/chrome/browser/component/navigation_interception/' |
- 'InterceptNavigationDelegate'), |
- ('Lorg/chromium/chrome/browser/component/web_contents_delegate_android/' |
- 'WebContentsDelegateAndroid'), |
- 'Lorg/chromium/chrome/browser/database/SQLiteCursor', |
- 'Lorg/chromium/content/app/SandboxedProcessService', |
- 'Lorg/chromium/content/browser/ContainerViewDelegate', |
- 'Lorg/chromium/content/browser/ContentVideoView', |
- 'Lorg/chromium/content/browser/ContentViewCore', |
- 'Lorg/chromium/content/browser/DeviceOrientation', |
- 'Lorg/chromium/content/browser/JavaInputStream', |
- 'Lorg/chromium/content/browser/LocationProvider', |
- 'Lorg/chromium/content/browser/SandboxedProcessArgs', |
- 'Lorg/chromium/content/browser/SandboxedProcessConnection', |
- 'Lorg/chromium/content/browser/TouchPoint', |
- 'Lorg/chromium/content/browser/WaitableNativeEvent', |
- 'Lorg/chromium/content/browser/WebContentsObserverAndroid', |
- 'Lorg/chromium/content/common/DeviceInfo', |
- 'Lorg/chromium/content/common/SurfaceTextureListener', |
- 'Lorg/chromium/media/MediaPlayerListener', |
- 'Lorg/chromium/net/NetworkChangeNotifier', |
- 'Lorg/chromium/net/ProxyChangeListener', |
- 'Lorg/chromium/ui/gfx/NativeWindow', |
- 'Lorg/chromium/ui/SelectFileDialog', |
- ] |
if param == 'byte[][]': |
return '[[B' |
prefix = '' |
@@ -225,7 +167,7 @@ def JavaParamToJni(param): |
if '/' in param: |
# Coming from javap, use the fully qualified param directly. |
return 'L' + param + ';' |
- for qualified_name in object_param_list + app_param_list: |
+ for qualified_name in object_param_list + APP_PARAM_LIST: |
if (qualified_name.endswith('/' + param) or |
qualified_name.endswith('$' + param.replace('.', '$')) or |
qualified_name == 'L' + param): |
@@ -1011,6 +953,19 @@ def GenerateJNIHeader(input_file, output_file, namespace): |
print output |
+def ReadExtraAppParamList(extra_app_param_files): |
+ if not extra_app_param_files: |
+ return |
+ for extra_app_param_file in set(extra_app_param_files): |
+ with file(extra_app_param_file, 'r') as f: |
+ contents = f.read() |
+ global APP_PARAM_LIST |
+ tmp_globals = {'APP_PARAM_LIST': APP_PARAM_LIST} |
+ tmp_locals = {} |
+ exec(contents) in tmp_globals, tmp_locals |
Yaron
2012/10/29 17:49:18
I'm not really keen on exec'ing external files. Ca
bulach
2012/10/29 18:57:06
sounds reasonable, stripping out comments is not t
|
+ APP_PARAM_LIST = tmp_locals['APP_PARAM_LIST'] |
+ |
+ |
def main(argv): |
usage = """usage: %prog [OPTIONS] |
This script will parse the given java source code extracting the native |
@@ -1034,7 +989,13 @@ See SampleForTests.java for more details. |
option_parser.add_option('--output_dir', |
help='The output directory. Must be used with ' |
'--input') |
+ option_parser.add_option('--app_param_list', |
+ help='A file name containing a list with extra ' |
+ 'fully-qualified param names. Can be used multiple ' |
+ 'times.', |
+ action='append') |
options, args = option_parser.parse_args(argv) |
+ ReadExtraAppParamList(options.app_param_list) |
if options.jar_file: |
input_file = ExtractJarInputFile(options.jar_file, options.input_file, |
options.output_dir) |