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

Side by Side Diff: lib/dom/scripts/systemhtml.py

Issue 10383302: Move dart:dom implementation classes to dart:html library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 2 # Copyright (c) 2012, 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 module provides shared functionality for the system to generate 6 """This module provides shared functionality for the system to generate
7 Dart:html APIs from the IDL database.""" 7 Dart:html APIs from the IDL database."""
8 8
9 from systemfrog import * 9 from systemfrog import *
10 from systeminterface import * 10 from systeminterface import *
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 """Returns the file emitter of the Frog implementation file.""" 1145 """Returns the file emitter of the Frog implementation file."""
1146 # TODO(jmesserly): is this the right path 1146 # TODO(jmesserly): is this the right path
1147 path = os.path.join(self._output_dir, 'html', 'frog', '%s.dart' % name) 1147 path = os.path.join(self._output_dir, 'html', 'frog', '%s.dart' % name)
1148 self._dart_frog_file_paths.append(path) 1148 self._dart_frog_file_paths.append(path)
1149 return self._emitters.FileEmitter(path) 1149 return self._emitters.FileEmitter(path)
1150 1150
1151 # ----------------------------------------------------------------------------- 1151 # -----------------------------------------------------------------------------
1152 1152
1153 class HtmlDartiumSystem(HtmlSystem): 1153 class HtmlDartiumSystem(HtmlSystem):
1154 1154
1155 def __init__(self, templates, database, emitters, auxiliary_dir, output_dir): 1155 def __init__(self, templates, database, emitters, auxiliary_dir,
1156 dom_implementation_classes, output_dir):
1156 """Prepared for generating wrapping implementation. 1157 """Prepared for generating wrapping implementation.
1157 1158
1158 - Creates emitter for Dart code. 1159 - Creates emitter for Dart code.
1159 """ 1160 """
1160 super(HtmlDartiumSystem, self).__init__( 1161 super(HtmlDartiumSystem, self).__init__(
1161 templates, database, emitters, output_dir) 1162 templates, database, emitters, output_dir)
1162 self._auxiliary_dir = auxiliary_dir 1163 self._auxiliary_dir = auxiliary_dir
1164 self._dom_implementation_classes = dom_implementation_classes
1163 self._shared = HtmlSystemShared(database) 1165 self._shared = HtmlSystemShared(database)
1164 self._dart_dartium_file_paths = [] 1166 self._dart_dartium_file_paths = []
1165 self._wrap_cases = [] 1167 self._wrap_cases = []
1166 1168
1167 def InterfaceGenerator(self, 1169 def InterfaceGenerator(self,
1168 interface, 1170 interface,
1169 common_prefix, 1171 common_prefix,
1170 super_interface_name, 1172 super_interface_name,
1171 source_filter): 1173 source_filter):
1172 """.""" 1174 """."""
(...skipping 19 matching lines...) Expand all
1192 1194
1193 def GenerateLibraries(self): 1195 def GenerateLibraries(self):
1194 # Library generated for implementation. 1196 # Library generated for implementation.
1195 auxiliary_dir = os.path.relpath(self._auxiliary_dir, self._output_dir) 1197 auxiliary_dir = os.path.relpath(self._auxiliary_dir, self._output_dir)
1196 1198
1197 self._GenerateLibFile( 1199 self._GenerateLibFile(
1198 'html_dartium.darttemplate', 1200 'html_dartium.darttemplate',
1199 os.path.join(self._output_dir, 'html_dartium.dart'), 1201 os.path.join(self._output_dir, 'html_dartium.dart'),
1200 (self._interface_system._dart_interface_file_paths + 1202 (self._interface_system._dart_interface_file_paths +
1201 self._interface_system._dart_callback_file_paths + 1203 self._interface_system._dart_callback_file_paths +
1202 self._dart_dartium_file_paths 1204 self._dart_dartium_file_paths +
1203 ), 1205 self._dom_implementation_classes),
1204 AUXILIARY_DIR=MassagePath(auxiliary_dir), 1206 AUXILIARY_DIR=MassagePath(auxiliary_dir),
1205 WRAPCASES='\n'.join(self._wrap_cases)) 1207 WRAPCASES='\n'.join(self._wrap_cases))
1206 1208
1207 def Finish(self): 1209 def Finish(self):
1208 pass 1210 pass
1209 1211
1210 # ------------------------------------------------------------------------------ 1212 # ------------------------------------------------------------------------------
1211 1213
1212 # TODO(jacobr): there is far too much duplicated code between these bindings 1214 # TODO(jacobr): there is far too much duplicated code between these bindings
1213 # and the Frog bindings. A larger scale refactoring needs to be performed to 1215 # and the Frog bindings. A larger scale refactoring needs to be performed to
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
1334 template_file = 'factoryprovider_%s.darttemplate' % interface_name 1336 template_file = 'factoryprovider_%s.darttemplate' % interface_name
1335 template = self._system._templates.TryLoad(template_file) 1337 template = self._system._templates.TryLoad(template_file)
1336 if not template: 1338 if not template:
1337 template = self._system._templates.Load('factoryprovider.darttemplate') 1339 template = self._system._templates.Load('factoryprovider.darttemplate')
1338 1340
1339 factory_provider = '_' + interface_name + 'FactoryProvider' 1341 factory_provider = '_' + interface_name + 'FactoryProvider'
1340 emitter = self._system._ImplFileEmitter(factory_provider) 1342 emitter = self._system._ImplFileEmitter(factory_provider)
1341 emitter.Emit( 1343 emitter.Emit(
1342 template, 1344 template,
1343 FACTORYPROVIDER=factory_provider, 1345 FACTORYPROVIDER=factory_provider,
1344 CONSTRUCTOR=interface_name, 1346 INTERFACE=interface_name,
1347 DOM_INTERFACE=self._interface.javascript_binding_name,
1345 PARAMETERS=constructor_info.ParametersImplementationDeclaration(), 1348 PARAMETERS=constructor_info.ParametersImplementationDeclaration(),
1346 NAMED_CONSTRUCTOR=constructor_info.name or interface_name, 1349 NAMED_CONSTRUCTOR=constructor_info.name or interface_name,
1347 ARGUMENTS=self._UnwrappedParameters(constructor_info, 1350 ARGUMENTS=self._UnwrappedParameters(constructor_info,
1348 len(constructor_info.param_infos))) 1351 len(constructor_info.param_infos)))
1349 1352
1350 def _UnwrappedParameters(self, operation_info, length): 1353 def _UnwrappedParameters(self, operation_info, length):
1351 """Returns string for an argument list that unwraps first |length| 1354 """Returns string for an argument list that unwraps first |length|
1352 parameters.""" 1355 parameters."""
1353 def UnwrapParamInfo(param_info): 1356 def UnwrapParamInfo(param_info):
1354 # TODO(sra): Type dependent unwrapping. 1357 # TODO(sra): Type dependent unwrapping.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 Collect(database.GetInterface(parent.type.id), 1570 Collect(database.GetInterface(parent.type.id),
1568 seen, collected) 1571 seen, collected)
1569 1572
1570 inheritance_closure = {} 1573 inheritance_closure = {}
1571 for interface in database.GetInterfaces(): 1574 for interface in database.GetInterfaces():
1572 seen = set() 1575 seen = set()
1573 collected = [] 1576 collected = []
1574 Collect(interface, seen, collected) 1577 Collect(interface, seen, collected)
1575 inheritance_closure[interface.id] = collected 1578 inheritance_closure[interface.id] = collected
1576 return inheritance_closure 1579 return inheritance_closure
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698