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

Unified Diff: sky/engine/bindings/scripts/code_generator_dart.py

Issue 1135283005: Sky: Add a CustomDart attribute to the IDL compiler, and use that with Canvas (Closed) Base URL: git@github.com:/domokit/mojo.git@master
Patch Set: . Created 5 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 | « sky/engine/bindings/IDLExtendedAttributes.txt ('k') | sky/engine/bindings/scripts/dart_compiler.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/engine/bindings/scripts/code_generator_dart.py
diff --git a/sky/engine/bindings/scripts/code_generator_dart.py b/sky/engine/bindings/scripts/code_generator_dart.py
index a0a9dc39d1431d0186ad05849ef5e85fe163b66b..fd7da98e73a4fdba10b72389fb88d3057521f194 100644
--- a/sky/engine/bindings/scripts/code_generator_dart.py
+++ b/sky/engine/bindings/scripts/code_generator_dart.py
@@ -106,8 +106,8 @@ class CodeGeneratorDart(object):
(interface_name, interface_info['component_dir'])
for interface_name, interface_info in interfaces_info.iteritems()))
- def generate_code(self, definitions, interface_name, idl_pickle_filename,
- only_if_changed):
+ def generate_code(self, definitions, interface_name,
+ idl_filename, idl_pickle_filename, only_if_changed):
"""Returns .h/.cpp/.dart code as (header_text, cpp_text, dart_text)."""
try:
interface = definitions.interfaces[interface_name]
@@ -149,6 +149,15 @@ class CodeGeneratorDart(object):
template_contents['cpp_includes'] = sorted(includes)
+ # If CustomDart is set, read the custom dart file and add it to our
+ # template parameters.
+ if 'CustomDart' in interface.extended_attributes:
+ dart_filename = os.path.join(os.path.dirname(idl_filename),
+ interface.name + ".dart")
+ with open(dart_filename) as dart_file:
+ custom_dartcode = dart_file.read()
+ template_contents['custom_dartcode'] = custom_dartcode
+
idl_world = {'interface': None, 'callback': None}
# Load the pickle file for this IDL.
@@ -178,6 +187,7 @@ class CodeGeneratorDart(object):
header_text = header_template.render(template_contents)
cpp_text = cpp_template.render(template_contents)
dart_text = dart_template.render(template_contents)
+
return header_text, cpp_text, dart_text
def load_global_pickles(self, global_entries):
« no previous file with comments | « sky/engine/bindings/IDLExtendedAttributes.txt ('k') | sky/engine/bindings/scripts/dart_compiler.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698