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

Unified Diff: core/scripts/in_generator.py

Issue 15685002: IDL roll. (Closed) Base URL: http://dart.googlecode.com/svn/third_party/WebCore/
Patch Set: Created 7 years, 7 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/DOMPluginArray.idl ('k') | core/scripts/make_event_factory.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 22811)
+++ core/scripts/in_generator.py (working copy)
@@ -49,6 +49,11 @@
def generate_implementation(self):
raise NotImplementedError
+ def wrap_with_condition(self, string, condition):
+ if not condition:
+ return string
+ return "#if ENABLE(%(condition)s)\n%(string)s\n#endif" % { 'condition' : condition, 'string' : string }
+
def _forcibly_create_text_file_at_path_with_contents(self, file_path, contents):
# FIXME: This method can be made less force-full anytime after 6/1/2013.
# A gyp error was briefly checked into the tree, causing
@@ -65,12 +70,18 @@
file_to_write.write(contents)
def write_header(self, output_dir):
- header_path = os.path.join(output_dir, self.class_name + ".h")
- self._forcibly_create_text_file_at_path_with_contents(header_path, self.generate_header())
+ contents = self.generate_header()
+ if not contents:
+ return
+ path = os.path.join(output_dir, self.class_name + ".h")
+ self._forcibly_create_text_file_at_path_with_contents(path, contents)
def write_implmentation(self, output_dir):
- implmentation_path = os.path.join(output_dir, self.class_name + ".cpp")
- self._forcibly_create_text_file_at_path_with_contents(implmentation_path, self.generate_implementation())
+ contents = self.generate_implementation()
+ if not contents:
+ return
+ path = os.path.join(output_dir, self.class_name + ".cpp")
+ self._forcibly_create_text_file_at_path_with_contents(path, contents)
class Maker(object):
« no previous file with comments | « core/plugins/DOMPluginArray.idl ('k') | core/scripts/make_event_factory.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698