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

Side by Side Diff: tools/dom/scripts/dartdomgenerator.py

Issue 23819035: Give generatored bindings classes a field remembering an index into a cache of handles on the corre… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: run go.sh Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
3 # for details. All rights reserved. Use of this source code is governed by a 3 # for details. All rights reserved. Use of this source code is governed by a
4 # BSD-style license that can be found in the LICENSE file. 4 # BSD-style license that can be found in the LICENSE file.
5 5
6 """This is the entry point to create Dart APIs from the IDL database.""" 6 """This is the entry point to create Dart APIs from the IDL database."""
7 7
8 import dartgenerator 8 import dartgenerator
9 import database 9 import database
10 import fremontcutbuilder 10 import fremontcutbuilder
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 def RunGenerator(dart_libraries, dart_output_dir, 78 def RunGenerator(dart_libraries, dart_output_dir,
79 template_loader, backend_factory): 79 template_loader, backend_factory):
80 options = GeneratorOptions( 80 options = GeneratorOptions(
81 template_loader, webkit_database, type_registry, renamer, 81 template_loader, webkit_database, type_registry, renamer,
82 metadata) 82 metadata)
83 dart_library_emitter = DartLibraryEmitter( 83 dart_library_emitter = DartLibraryEmitter(
84 emitters, dart_output_dir, dart_libraries) 84 emitters, dart_output_dir, dart_libraries)
85 event_generator = HtmlEventGenerator(webkit_database, renamer, metadata, 85 event_generator = HtmlEventGenerator(webkit_database, renamer, metadata,
86 template_loader) 86 template_loader)
87 87
88 def generate_interface(interface): 88 def generate_interface(interface, cid):
89 backend = backend_factory(interface) 89 backend = backend_factory(interface, cid)
90 interface_generator = HtmlDartInterfaceGenerator( 90 interface_generator = HtmlDartInterfaceGenerator(
91 options, dart_library_emitter, event_generator, interface, backend) 91 options, dart_library_emitter, event_generator, interface, backend)
92 interface_generator.Generate() 92 interface_generator.Generate()
93 93
94 generator.Generate(webkit_database, common_database, generate_interface) 94 generator.Generate(webkit_database, common_database, generate_interface)
95 95
96 dart_library_emitter.EmitLibraries(auxiliary_dir) 96 dart_library_emitter.EmitLibraries(auxiliary_dir)
97 97
98 if dart2js_output_dir: 98 if dart2js_output_dir:
99 template_paths = ['html/dart2js', 'html/impl', 'html/interface', ''] 99 template_paths = ['html/dart2js', 'html/impl', 'html/interface', '']
100 template_loader = TemplateLoader(template_dir, 100 template_loader = TemplateLoader(template_dir,
101 template_paths, 101 template_paths,
102 {'DARTIUM': False, 'DART2JS': True}) 102 {'DARTIUM': False, 'DART2JS': True})
103 backend_options = GeneratorOptions( 103 backend_options = GeneratorOptions(
104 template_loader, webkit_database, type_registry, renamer, 104 template_loader, webkit_database, type_registry, renamer,
105 metadata) 105 metadata)
106 backend_factory = lambda interface:\ 106 backend_factory = lambda interface, cid:\
107 Dart2JSBackend(interface, backend_options) 107 Dart2JSBackend(interface, backend_options)
108 108
109 dart_output_dir = os.path.join(dart2js_output_dir, 'dart') 109 dart_output_dir = os.path.join(dart2js_output_dir, 'dart')
110 dart_libraries = DartLibraries( 110 dart_libraries = DartLibraries(
111 HTML_LIBRARY_NAMES, template_loader, 'dart2js', dart2js_output_dir) 111 HTML_LIBRARY_NAMES, template_loader, 'dart2js', dart2js_output_dir)
112 112
113 RunGenerator(dart_libraries, dart_output_dir, 113 RunGenerator(dart_libraries, dart_output_dir,
114 template_loader, backend_factory) 114 template_loader, backend_factory)
115 115
116 if dartium_output_dir: 116 if dartium_output_dir:
117 template_paths = ['html/dartium', 'html/impl', 'html/interface', ''] 117 template_paths = ['html/dartium', 'html/impl', 'html/interface', '']
118 template_loader = TemplateLoader(template_dir, 118 template_loader = TemplateLoader(template_dir,
119 template_paths, 119 template_paths,
120 {'DARTIUM': True, 'DART2JS': False}) 120 {'DARTIUM': True, 'DART2JS': False})
121 backend_options = GeneratorOptions( 121 backend_options = GeneratorOptions(
122 template_loader, webkit_database, type_registry, renamer, 122 template_loader, webkit_database, type_registry, renamer,
123 metadata) 123 metadata)
124 cpp_output_dir = os.path.join(dartium_output_dir, 'cpp') 124 cpp_output_dir = os.path.join(dartium_output_dir, 'cpp')
125 cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir) 125 cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir)
126 backend_factory = lambda interface:\ 126 backend_factory = lambda interface, cid:\
127 DartiumBackend(interface, cpp_library_emitter, backend_options) 127 DartiumBackend(interface, cid, cpp_library_emitter, backend_options)
128 128
129 dart_output_dir = os.path.join(dartium_output_dir, 'dart') 129 dart_output_dir = os.path.join(dartium_output_dir, 'dart')
130 dart_libraries = DartLibraries( 130 dart_libraries = DartLibraries(
131 HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir) 131 HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir)
132 132
133 RunGenerator(dart_libraries, dart_output_dir, 133 RunGenerator(dart_libraries, dart_output_dir,
134 template_loader, backend_factory) 134 template_loader, backend_factory)
135 cpp_library_emitter.EmitDerivedSources( 135 cpp_library_emitter.EmitDerivedSources(
136 template_loader.Load('cpp_derived_sources.template'), 136 template_loader.Load('cpp_derived_sources.template'),
137 dartium_output_dir) 137 dartium_output_dir)
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js')) 216 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dart2js'))
217 if 'htmldartium' in systems: 217 if 'htmldartium' in systems:
218 _logger.info('Generating dartium single files.') 218 _logger.info('Generating dartium single files.')
219 for library_name in HTML_LIBRARY_NAMES: 219 for library_name in HTML_LIBRARY_NAMES:
220 GenerateSingleFile( 220 GenerateSingleFile(
221 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name), 221 os.path.join(dartium_output_dir, '%s_dartium.dart' % library_name),
222 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium')) 222 os.path.join('..', '..', '..', 'sdk', 'lib', library_name, 'dartium'))
223 223
224 if __name__ == '__main__': 224 if __name__ == '__main__':
225 sys.exit(main()) 225 sys.exit(main())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698