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

Side by Side Diff: lib/html/scripts/dartdomgenerator.py

Issue 11020008: Cleanup html events generation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 2 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
11 import logging.config 11 import logging.config
12 import multiemitter 12 import multiemitter
13 import optparse 13 import optparse
14 import os 14 import os
15 import shutil 15 import shutil
16 import subprocess 16 import subprocess
17 import sys 17 import sys
18 from generator import TypeRegistry 18 from generator import TypeRegistry
19 from htmleventgenerator import HtmlEventGenerator
19 from htmlrenamer import HtmlRenamer 20 from htmlrenamer import HtmlRenamer
20 from systembase import GeneratorOptions 21 from systembase import GeneratorOptions
21 from systemhtml import DartLibraryEmitter, Dart2JSBackend,\ 22 from systemhtml import DartLibraryEmitter, Dart2JSBackend,\
22 HtmlDartInterfaceGenerator, HtmlSystemShared 23 HtmlDartInterfaceGenerator
23 from systemnative import CPPLibraryEmitter, DartiumBackend 24 from systemnative import CPPLibraryEmitter, DartiumBackend
24 from templateloader import TemplateLoader 25 from templateloader import TemplateLoader
25 26
26 _logger = logging.getLogger('dartdomgenerator') 27 _logger = logging.getLogger('dartdomgenerator')
27 28
28 _webkit_renames = { 29 _webkit_renames = {
29 # W3C -> WebKit name conversion 30 # W3C -> WebKit name conversion
30 # TODO(vsm): Maybe Store these renames in the IDLs. 31 # TODO(vsm): Maybe Store these renames in the IDLs.
31 'ApplicationCache': 'DOMApplicationCache', 32 'ApplicationCache': 'DOMApplicationCache',
32 'BarProp': 'BarInfo', 33 'BarProp': 'BarInfo',
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 emitters = multiemitter.MultiEmitter() 76 emitters = multiemitter.MultiEmitter()
76 renamer = HtmlRenamer(webkit_database) 77 renamer = HtmlRenamer(webkit_database)
77 type_registry = TypeRegistry(webkit_database, renamer) 78 type_registry = TypeRegistry(webkit_database, renamer)
78 79
79 def RunGenerator(dart_library_template, dart_output_dir, dart_library_path, 80 def RunGenerator(dart_library_template, dart_output_dir, dart_library_path,
80 template_loader, backend_factory): 81 template_loader, backend_factory):
81 options = GeneratorOptions( 82 options = GeneratorOptions(
82 template_loader, webkit_database, type_registry, renamer) 83 template_loader, webkit_database, type_registry, renamer)
83 dart_library_emitter = DartLibraryEmitter( 84 dart_library_emitter = DartLibraryEmitter(
84 emitters, dart_library_template, dart_output_dir) 85 emitters, dart_library_template, dart_output_dir)
85 shared_system = HtmlSystemShared(webkit_database) 86 event_generator = HtmlEventGenerator(webkit_database, template_loader)
86 87
87 def generate_interface(interface): 88 def generate_interface(interface):
88 backend = backend_factory(interface) 89 backend = backend_factory(interface)
89 interface_generator = HtmlDartInterfaceGenerator( 90 interface_generator = HtmlDartInterfaceGenerator(
90 shared_system, options, dart_library_emitter, interface, backend) 91 options, dart_library_emitter, event_generator, interface, backend)
91 interface_generator.Generate() 92 interface_generator.Generate()
92 93
93 generator.Generate( 94 generator.Generate(
94 webkit_database, common_database, _webkit_renames, generate_interface) 95 webkit_database, common_database, _webkit_renames, generate_interface)
95 dart_library_emitter.EmitLibrary(dart_library_path, auxiliary_dir) 96 dart_library_emitter.EmitLibrary(dart_library_path, auxiliary_dir)
96 97
97 if dart2js_output_dir: 98 if dart2js_output_dir:
98 template_paths = ['html/dart2js', 'html/impl', 'html/interface', ''] 99 template_paths = ['html/dart2js', 'html/impl', 'html/interface', '']
99 template_loader = TemplateLoader(template_dir, 100 template_loader = TemplateLoader(template_dir,
100 template_paths, 101 template_paths,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 _logger.info('Copy html_dart2js to dart2js/') 193 _logger.info('Copy html_dart2js to dart2js/')
193 GenerateSingleFile(os.path.join(dart2js_output_dir, 'html_dart2js.dart'), 194 GenerateSingleFile(os.path.join(dart2js_output_dir, 'html_dart2js.dart'),
194 '../dart2js') 195 '../dart2js')
195 if 'htmldartium' in systems: 196 if 'htmldartium' in systems:
196 _logger.info('Copy html_dartium to dartium/') 197 _logger.info('Copy html_dartium to dartium/')
197 GenerateSingleFile(os.path.join(dartium_output_dir, 'html_dartium.dart'), 198 GenerateSingleFile(os.path.join(dartium_output_dir, 'html_dartium.dart'),
198 '../dartium') 199 '../dartium')
199 200
200 if __name__ == '__main__': 201 if __name__ == '__main__':
201 sys.exit(main()) 202 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | lib/html/scripts/htmleventgenerator.py » ('j') | lib/html/scripts/htmleventgenerator.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698