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

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
« no previous file with comments | « lib/dom/scripts/dartdomgenerator.py ('k') | lib/dom/scripts/systemnative.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 """Returns the file emitter of the Frog implementation file.""" 1271 """Returns the file emitter of the Frog implementation file."""
1272 # TODO(jmesserly): is this the right path 1272 # TODO(jmesserly): is this the right path
1273 path = os.path.join(self._output_dir, 'html', 'frog', '%s.dart' % name) 1273 path = os.path.join(self._output_dir, 'html', 'frog', '%s.dart' % name)
1274 self._dart_frog_file_paths.append(path) 1274 self._dart_frog_file_paths.append(path)
1275 return self._emitters.FileEmitter(path) 1275 return self._emitters.FileEmitter(path)
1276 1276
1277 # ----------------------------------------------------------------------------- 1277 # -----------------------------------------------------------------------------
1278 1278
1279 class HtmlDartiumSystem(HtmlSystem): 1279 class HtmlDartiumSystem(HtmlSystem):
1280 1280
1281 def __init__(self, templates, database, emitters, auxiliary_dir, output_dir): 1281 def __init__(self, templates, database, emitters, auxiliary_dir,
1282 dom_implementation_classes, output_dir):
1282 """Prepared for generating wrapping implementation. 1283 """Prepared for generating wrapping implementation.
1283 1284
1284 - Creates emitter for Dart code. 1285 - Creates emitter for Dart code.
1285 """ 1286 """
1286 super(HtmlDartiumSystem, self).__init__( 1287 super(HtmlDartiumSystem, self).__init__(
1287 templates, database, emitters, output_dir) 1288 templates, database, emitters, output_dir)
1288 self._auxiliary_dir = auxiliary_dir 1289 self._auxiliary_dir = auxiliary_dir
1290 self._dom_implementation_classes = dom_implementation_classes
1289 self._shared = HtmlSystemShared(database) 1291 self._shared = HtmlSystemShared(database)
1290 self._dart_dartium_file_paths = [] 1292 self._dart_dartium_file_paths = []
1291 self._wrap_cases = [] 1293 self._wrap_cases = []
1292 1294
1293 def InterfaceGenerator(self, 1295 def InterfaceGenerator(self,
1294 interface, 1296 interface,
1295 common_prefix, 1297 common_prefix,
1296 super_interface_name, 1298 super_interface_name,
1297 source_filter): 1299 source_filter):
1298 """.""" 1300 """."""
(...skipping 19 matching lines...) Expand all
1318 1320
1319 def GenerateLibraries(self): 1321 def GenerateLibraries(self):
1320 # Library generated for implementation. 1322 # Library generated for implementation.
1321 auxiliary_dir = os.path.relpath(self._auxiliary_dir, self._output_dir) 1323 auxiliary_dir = os.path.relpath(self._auxiliary_dir, self._output_dir)
1322 1324
1323 self._GenerateLibFile( 1325 self._GenerateLibFile(
1324 'html_dartium.darttemplate', 1326 'html_dartium.darttemplate',
1325 os.path.join(self._output_dir, 'html_dartium.dart'), 1327 os.path.join(self._output_dir, 'html_dartium.dart'),
1326 (self._interface_system._dart_interface_file_paths + 1328 (self._interface_system._dart_interface_file_paths +
1327 self._interface_system._dart_callback_file_paths + 1329 self._interface_system._dart_callback_file_paths +
1328 self._dart_dartium_file_paths 1330 self._dart_dartium_file_paths +
1329 ), 1331 self._dom_implementation_classes),
1330 AUXILIARY_DIR=MassagePath(auxiliary_dir), 1332 AUXILIARY_DIR=MassagePath(auxiliary_dir),
1331 WRAPCASES='\n'.join(self._wrap_cases)) 1333 WRAPCASES='\n'.join(self._wrap_cases))
1332 1334
1333 def Finish(self): 1335 def Finish(self):
1334 pass 1336 pass
1335 1337
1336 # ------------------------------------------------------------------------------ 1338 # ------------------------------------------------------------------------------
1337 1339
1338 # TODO(jacobr): there is far too much duplicated code between these bindings 1340 # TODO(jacobr): there is far too much duplicated code between these bindings
1339 # and the Frog bindings. A larger scale refactoring needs to be performed to 1341 # 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
1460 template_file = 'factoryprovider_%s.darttemplate' % interface_name 1462 template_file = 'factoryprovider_%s.darttemplate' % interface_name
1461 template = self._system._templates.TryLoad(template_file) 1463 template = self._system._templates.TryLoad(template_file)
1462 if not template: 1464 if not template:
1463 template = self._system._templates.Load('factoryprovider.darttemplate') 1465 template = self._system._templates.Load('factoryprovider.darttemplate')
1464 1466
1465 factory_provider = '_' + interface_name + 'FactoryProvider' 1467 factory_provider = '_' + interface_name + 'FactoryProvider'
1466 emitter = self._system._ImplFileEmitter(factory_provider) 1468 emitter = self._system._ImplFileEmitter(factory_provider)
1467 emitter.Emit( 1469 emitter.Emit(
1468 template, 1470 template,
1469 FACTORYPROVIDER=factory_provider, 1471 FACTORYPROVIDER=factory_provider,
1470 CONSTRUCTOR=interface_name, 1472 INTERFACE=interface_name,
1473 DOM_INTERFACE=self._interface.javascript_binding_name,
1471 PARAMETERS=constructor_info.ParametersImplementationDeclaration(), 1474 PARAMETERS=constructor_info.ParametersImplementationDeclaration(),
1472 NAMED_CONSTRUCTOR=constructor_info.name or interface_name, 1475 NAMED_CONSTRUCTOR=constructor_info.name or interface_name,
1473 ARGUMENTS=self._UnwrappedParameters(constructor_info, 1476 ARGUMENTS=self._UnwrappedParameters(constructor_info,
1474 len(constructor_info.param_infos))) 1477 len(constructor_info.param_infos)))
1475 1478
1476 def _UnwrappedParameters(self, operation_info, length): 1479 def _UnwrappedParameters(self, operation_info, length):
1477 """Returns string for an argument list that unwraps first |length| 1480 """Returns string for an argument list that unwraps first |length|
1478 parameters.""" 1481 parameters."""
1479 def UnwrapParamInfo(param_info): 1482 def UnwrapParamInfo(param_info):
1480 # TODO(sra): Type dependent unwrapping. 1483 # TODO(sra): Type dependent unwrapping.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
1693 Collect(database.GetInterface(parent.type.id), 1696 Collect(database.GetInterface(parent.type.id),
1694 seen, collected) 1697 seen, collected)
1695 1698
1696 inheritance_closure = {} 1699 inheritance_closure = {}
1697 for interface in database.GetInterfaces(): 1700 for interface in database.GetInterfaces():
1698 seen = set() 1701 seen = set()
1699 collected = [] 1702 collected = []
1700 Collect(interface, seen, collected) 1703 Collect(interface, seen, collected)
1701 inheritance_closure[interface.id] = collected 1704 inheritance_closure[interface.id] = collected
1702 return inheritance_closure 1705 return inheritance_closure
OLDNEW
« no previous file with comments | « lib/dom/scripts/dartdomgenerator.py ('k') | lib/dom/scripts/systemnative.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698