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

Unified Diff: Source/bindings/scripts/idl_compiler.py

Issue 386963003: [WIP][NotForLand] IDL dictionary support (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: sequence and array support Created 6 years, 5 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 | « Source/bindings/scripts/generate_global_constructors.py ('k') | Source/bindings/scripts/idl_definitions.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/scripts/idl_compiler.py
diff --git a/Source/bindings/scripts/idl_compiler.py b/Source/bindings/scripts/idl_compiler.py
index 6728aff45c10cadb38a7d536c0c5c8e7dd531e08..c28e735e23e2cda4ba8552008a3aa26022ac6d40 100755
--- a/Source/bindings/scripts/idl_compiler.py
+++ b/Source/bindings/scripts/idl_compiler.py
@@ -48,6 +48,7 @@ def parse_options():
parser.add_option('--cache-directory',
help='cache directory, defaults to output directory')
parser.add_option('--output-directory')
+ parser.add_option('--impl-output-directory')
parser.add_option('--interfaces-info-file')
parser.add_option('--write-file-only-if-changed', type='int')
# ensure output comes last, so command line easy to parse via regexes
@@ -79,7 +80,8 @@ class IdlCompiler(object):
"""
__metaclass__ = abc.ABCMeta
- def __init__(self, output_directory, cache_directory='',
+ def __init__(self, output_directory, impl_output_directory='',
+ cache_directory='',
code_generator=None, interfaces_info=None,
interfaces_info_filename='', only_if_changed=False):
"""
@@ -95,19 +97,19 @@ class IdlCompiler(object):
if interfaces_info_filename:
with open(interfaces_info_filename) as interfaces_info_file:
interfaces_info = pickle.load(interfaces_info_file)
+ self.impl_output_directory = impl_output_directory
self.interfaces_info = interfaces_info
self.only_if_changed = only_if_changed
self.output_directory = output_directory
self.reader = IdlReader(interfaces_info, cache_directory)
- def compile_and_write(self, idl_filename, output_filenames):
+ def compile_and_write(self, idl_filename):
interface_name = idl_filename_to_interface_name(idl_filename)
definitions = self.reader.read_idl_definitions(idl_filename)
- output_code_list = self.code_generator.generate_code(
+ generation_results = self.code_generator.generate_code(
definitions, interface_name)
- for output_code, output_filename in zip(output_code_list,
- output_filenames):
- write_file(output_code, output_filename, self.only_if_changed)
+ for output_path, output_code in generation_results:
+ write_file(output_code, output_path, self.only_if_changed)
@abc.abstractmethod
def compile_file(self, idl_filename):
@@ -118,21 +120,19 @@ class IdlCompilerV8(IdlCompiler):
def __init__(self, *args, **kwargs):
IdlCompiler.__init__(self, *args, **kwargs)
self.code_generator = CodeGeneratorV8(self.interfaces_info,
- self.cache_directory)
+ self.cache_directory,
+ self.output_directory,
+ self.impl_output_directory)
def compile_file(self, idl_filename):
- interface_name = idl_filename_to_interface_name(idl_filename)
- header_filename = os.path.join(self.output_directory,
- 'V8%s.h' % interface_name)
- cpp_filename = os.path.join(self.output_directory,
- 'V8%s.cpp' % interface_name)
- self.compile_and_write(idl_filename, (header_filename, cpp_filename))
+ self.compile_and_write(idl_filename)
def main():
options, idl_filename = parse_options()
idl_compiler = IdlCompilerV8(
options.output_directory,
+ options.impl_output_directory,
cache_directory=options.cache_directory,
interfaces_info_filename=options.interfaces_info_file,
only_if_changed=options.write_file_only_if_changed)
« no previous file with comments | « Source/bindings/scripts/generate_global_constructors.py ('k') | Source/bindings/scripts/idl_definitions.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698