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..1c23154d9213784ec19f02acd85731b98ad44d5d 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: ' |
- |
+EXTERNAL_PARAM_LIST = [] |
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 + EXTERNAL_PARAM_LIST: |
Nico
2012/10/30 19:47:36
CAPS_NAMES are usually constants, which this isn't
bulach
2012/10/31 10:17:02
good points, thanks nico!
I refactored this a bit
|
if (qualified_name.endswith('/' + param) or |
qualified_name.endswith('$' + param.replace('.', '$')) or |
qualified_name == 'L' + param): |
@@ -1011,6 +953,17 @@ def GenerateJNIHeader(input_file, output_file, namespace): |
print output |
+def ReadExtraAppParamList(external_param_files): |
+ if not external_param_files: |
+ return |
+ for external_param_file in set(external_param_files): |
+ with file(external_param_file, 'r') as f: |
+ contents = f.read() |
+ global EXTERNAL_PARAM_LIST |
+ EXTERNAL_PARAM_LIST += [x.strip() for x in contents.splitlines() |
+ if x and not x.startswith('#')] |
+ |
+ |
def main(argv): |
usage = """usage: %prog [OPTIONS] |
This script will parse the given java source code extracting the native |
@@ -1034,7 +987,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('--external_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.external_param_list) |
if options.jar_file: |
input_file = ExtractJarInputFile(options.jar_file, options.input_file, |
options.output_dir) |