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

Unified Diff: core/scripts/in_generator.py

Issue 15643014: Blink IDL roll. (Closed) Base URL: http://dart.googlecode.com/svn/third_party/WebCore/
Patch Set: Created 7 years, 6 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 | « core/plugins/PluginArray.idl ('k') | core/scripts/make_css_property_names.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/scripts/in_generator.py
===================================================================
--- core/scripts/in_generator.py (revision 23517)
+++ core/scripts/in_generator.py (working copy)
@@ -32,7 +32,6 @@
import optparse
from in_file import InFile
-import template_expander
class Writer(object):
@@ -47,27 +46,8 @@
in_files = [in_files]
self.in_file = InFile.load_from_files(in_files, self.defaults, self.valid_values, self.default_parameters)
self._enabled_conditions = enabled_conditions
+ self._outputs = {} # file_name -> generator
- # Subclasses should override.
- def generate_header(self):
- return ''
-
- # Subclasses should override.
- def generate_interfaces_header(self):
- return ''
-
- # Subclasses should override.
- def generate_headers_header(self):
- return ''
-
- # Subclasses should override.
- def generate_implementation(self):
- return ''
-
- # Subclasses should override.
- def generate_idl(self):
- return ''
-
def wrap_with_condition(self, string, condition):
if not condition:
return string
@@ -88,31 +68,15 @@
with open(file_path, "w") as file_to_write:
file_to_write.write(contents)
- def _write_file(self, output_dir, generator, file_name):
- contents = generator()
- if type(contents) is dict:
- contents = template_expander.apply_template(file_name + ".tmpl", contents)
- if not contents:
- return
+ def _write_file(self, output_dir, contents, file_name):
path = os.path.join(output_dir, file_name)
self._forcibly_create_text_file_at_path_with_contents(path, contents)
- def write_header(self, output_dir):
- self._write_file(output_dir, self.generate_header, self.class_name + '.h')
+ def write_files(self, output_dir):
+ for file_name, generator in self._outputs.items():
+ self._write_file(output_dir, generator(), file_name)
- def write_headers_header(self, output_dir):
- self._write_file(output_dir, self.generate_headers_header, self.class_name + 'Headers.h')
- def write_interfaces_header(self, output_dir):
- self._write_file(output_dir, self.generate_interfaces_header, self.class_name + 'Interfaces.h')
-
- def write_implmentation(self, output_dir):
- self._write_file(output_dir, self.generate_implementation, self.class_name + '.cpp')
-
- def write_idl(self, output_dir):
- self._write_file(output_dir, self.generate_idl, self.class_name + '.idl')
-
-
class Maker(object):
def __init__(self, writer_class):
self._writer_class = writer_class
@@ -152,8 +116,4 @@
enabled_conditions = self._enabled_conditions_from_defines(options.defines)
writer = self._writer_class(args, enabled_conditions)
- writer.write_header(options.output_dir)
- writer.write_headers_header(options.output_dir)
- writer.write_interfaces_header(options.output_dir)
- writer.write_implmentation(options.output_dir)
- writer.write_idl(options.output_dir)
+ writer.write_files(options.output_dir)
« no previous file with comments | « core/plugins/PluginArray.idl ('k') | core/scripts/make_css_property_names.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698