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

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

Issue 1248043003: Initial patch for the web modules layered platform proposal. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 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
Index: Source/bindings/scripts/idl_compiler.py
diff --git a/Source/bindings/scripts/idl_compiler.py b/Source/bindings/scripts/idl_compiler.py
index 7734def8dbe3df7da02694259070a90b45dc4468..b32bf07d18eb04dbb6987ce13bdbb2cd29ed0b7c 100755
--- a/Source/bindings/scripts/idl_compiler.py
+++ b/Source/bindings/scripts/idl_compiler.py
@@ -39,6 +39,7 @@ import cPickle as pickle
import sys
from code_generator_v8 import CodeGeneratorDictionaryImpl, CodeGeneratorV8, CodeGeneratorUnionType
+from code_generator_web_modules import CodeGeneratorWebModules
from idl_reader import IdlReader
from utilities import create_component_info_provider, read_idl_files_list_from_file, write_file, idl_filename_to_component
@@ -52,6 +53,8 @@ def parse_options():
parser.add_option('--output-directory')
parser.add_option('--impl-output-directory')
parser.add_option('--info-dir')
+ parser.add_option('--web-modules',
+ action="store_true", default=False)
parser.add_option('--write-file-only-if-changed', type='int')
# FIXME: We should always explicitly specify --target-component and
# remove the default behavior.
@@ -134,6 +137,17 @@ class IdlCompilerV8(IdlCompiler):
self.compile_and_write(idl_filename)
+class IdlCompilerWebModules(IdlCompiler):
+ def __init__(self, *args, **kwargs):
+ IdlCompiler.__init__(self, *args, **kwargs)
+ self.code_generator = CodeGeneratorWebModules(self.info_provider,
+ self.cache_directory,
+ self.output_directory)
+
+ def compile_file(self, idl_filename):
+ self.compile_and_write(idl_filename)
+
+
class IdlCompilerDictionaryImpl(IdlCompiler):
def __init__(self, *args, **kwargs):
IdlCompiler.__init__(self, *args, **kwargs)
@@ -147,14 +161,23 @@ class IdlCompilerDictionaryImpl(IdlCompiler):
def generate_bindings(options, input_filename):
info_provider = create_component_info_provider(
options.info_dir, options.target_component)
- idl_compiler = IdlCompilerV8(
- options.output_directory,
- cache_directory=options.cache_directory,
- info_provider=info_provider,
- only_if_changed=options.write_file_only_if_changed,
- target_component=options.target_component)
- idl_compiler.compile_file(input_filename)
+ if options.web_modules:
+ web_modules_compiler = IdlCompilerWebModules(
+ os.path.join(options.output_directory, "webmodules"),
+ cache_directory=options.cache_directory,
+ info_provider=info_provider,
+ only_if_changed=options.write_file_only_if_changed,
+ target_component=options.target_component)
+ web_modules_compiler.compile_file(input_filename)
+ else:
+ idl_compiler = IdlCompilerV8(
+ os.path.join(options.output_directory, "v8"),
+ cache_directory=options.cache_directory,
+ info_provider=info_provider,
+ only_if_changed=options.write_file_only_if_changed,
+ target_component=options.target_component)
+ idl_compiler.compile_file(input_filename)
def generate_dictionary_impl(options, input_filename):
info_provider = create_component_info_provider(

Powered by Google App Engine
This is Rietveld 408576698