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

Unified Diff: bindings/scripts/idl_compiler.py

Issue 959933002: Move IDLs to 39 roll (Closed) Base URL: https://dart.googlecode.com/svn/third_party/WebCore
Patch Set: Created 5 years, 10 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 | « bindings/scripts/compute_interfaces_info_overall.py ('k') | bindings/scripts/idl_definitions.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bindings/scripts/idl_compiler.py
diff --git a/bindings/scripts/idl_compiler.py b/bindings/scripts/idl_compiler.py
index c74aae7a002777349c65c6c18c68f1ae8c266ba8..3721e12129c7f232c30e03e2bfb0102eb21a95ac 100755
--- a/bindings/scripts/idl_compiler.py
+++ b/bindings/scripts/idl_compiler.py
@@ -38,15 +38,17 @@ import os
import cPickle as pickle
import sys
-from code_generator_v8 import CodeGeneratorV8
+from code_generator_v8 import CodeGeneratorDictionaryImpl, CodeGeneratorV8
from idl_reader import IdlReader
-from utilities import write_file
+from utilities import read_idl_files_list_from_file, write_file, idl_filename_to_component
def parse_options():
parser = OptionParser()
parser.add_option('--cache-directory',
help='cache directory, defaults to output directory')
+ parser.add_option('--generate-dictionary-impl',
+ action="store_true", default=False)
parser.add_option('--output-directory')
parser.add_option('--interfaces-info-file')
parser.add_option('--write-file-only-if-changed', type='int')
@@ -102,9 +104,10 @@ class IdlCompiler(object):
def compile_and_write(self, idl_filename):
interface_name = idl_filename_to_interface_name(idl_filename)
+ component = idl_filename_to_component(idl_filename)
definitions = self.reader.read_idl_definitions(idl_filename)
output_code_list = self.code_generator.generate_code(
- definitions, interface_name)
+ definitions[component], interface_name)
for output_path, output_code in output_code_list:
write_file(output_code, output_path, self.only_if_changed)
@@ -124,14 +127,46 @@ class IdlCompilerV8(IdlCompiler):
self.compile_and_write(idl_filename)
-def main():
- options, idl_filename = parse_options()
+class IdlCompilerDictionaryImpl(IdlCompiler):
+ def __init__(self, *args, **kwargs):
+ IdlCompiler.__init__(self, *args, **kwargs)
+ self.code_generator = CodeGeneratorDictionaryImpl(
+ self.interfaces_info, self.cache_directory, self.output_directory)
+
+ def compile_file(self, idl_filename):
+ self.compile_and_write(idl_filename)
+
+
+def generate_bindings(options, input_filename):
idl_compiler = IdlCompilerV8(
options.output_directory,
cache_directory=options.cache_directory,
interfaces_info_filename=options.interfaces_info_file,
only_if_changed=options.write_file_only_if_changed)
- idl_compiler.compile_file(idl_filename)
+ idl_compiler.compile_file(input_filename)
+
+
+def generate_dictionary_impl(options, input_filename):
+ idl_compiler = IdlCompilerDictionaryImpl(
+ options.output_directory,
+ cache_directory=options.cache_directory,
+ interfaces_info_filename=options.interfaces_info_file,
+ only_if_changed=options.write_file_only_if_changed)
+
+ idl_filenames = read_idl_files_list_from_file(input_filename)
+ for idl_filename in idl_filenames:
+ idl_compiler.compile_file(idl_filename)
+
+
+def main():
+ options, input_filename = parse_options()
+ if options.generate_dictionary_impl:
+ # |input_filename| should be a file which contains a list of IDL
+ # dictionary paths.
+ generate_dictionary_impl(options, input_filename)
+ else:
+ # |input_filename| should be a path of an IDL file.
+ generate_bindings(options, input_filename)
if __name__ == '__main__':
« no previous file with comments | « bindings/scripts/compute_interfaces_info_overall.py ('k') | bindings/scripts/idl_definitions.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698