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

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

Issue 10987042: Speed up fremontcut/dartdomgenerator (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments 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
« no previous file with comments | « lib/html/scripts/idlnode.py ('k') | no next file » | 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 base functionality for systems to generate 6 """This module provides base functionality for systems to generate
7 Dart APIs from the IDL database.""" 7 Dart APIs from the IDL database."""
8 8
9 import os 9 import os
10 from generator import * 10 from generator import *
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 self.AddSecondaryMembers(self._interface) 71 self.AddSecondaryMembers(self._interface)
72 self.FinishInterface() 72 self.FinishInterface()
73 73
74 def GenerateCallback(self, info): 74 def GenerateCallback(self, info):
75 pass 75 pass
76 76
77 def AddMembers(self, interface): 77 def AddMembers(self, interface):
78 for const in sorted(interface.constants, ConstantOutputOrder): 78 for const in sorted(interface.constants, ConstantOutputOrder):
79 self.AddConstant(const) 79 self.AddConstant(const)
80 80
81 for attr in interface.attributes: 81 for attr in sorted(interface.attributes, ConstantOutputOrder):
82 if attr.type.id != 'EventListener': 82 if attr.type.id != 'EventListener':
83 self.AddAttribute(attr) 83 self.AddAttribute(attr)
84 84
85 # The implementation should define an indexer if the interface directly 85 # The implementation should define an indexer if the interface directly
86 # extends List. 86 # extends List.
87 (element_type, requires_indexer) = ListImplementationInfo( 87 (element_type, requires_indexer) = ListImplementationInfo(
88 interface, self._database) 88 interface, self._database)
89 if element_type: 89 if element_type:
90 if requires_indexer: 90 if requires_indexer:
91 self.AddIndexer(element_type) 91 self.AddIndexer(element_type)
(...skipping 14 matching lines...) Expand all
106 106
107 def AddSecondaryMembers(self, interface): 107 def AddSecondaryMembers(self, interface):
108 # With multiple inheritance, attributes and operations of non-first 108 # With multiple inheritance, attributes and operations of non-first
109 # interfaces need to be added. Sometimes the attribute or operation is 109 # interfaces need to be added. Sometimes the attribute or operation is
110 # defined in the current interface as well as a parent. In that case we 110 # defined in the current interface as well as a parent. In that case we
111 # avoid making a duplicate definition and pray that the signatures match. 111 # avoid making a duplicate definition and pray that the signatures match.
112 secondary_parents = self._TransitiveSecondaryParents(interface) 112 secondary_parents = self._TransitiveSecondaryParents(interface)
113 for parent_interface in secondary_parents: 113 for parent_interface in secondary_parents:
114 if isinstance(parent_interface, str): # IsDartCollectionType(parent_inter face) 114 if isinstance(parent_interface, str): # IsDartCollectionType(parent_inter face)
115 continue 115 continue
116 for attr in parent_interface.attributes: 116 for attr in sorted(parent_interface.attributes, ConstantOutputOrder):
117 if not FindMatchingAttribute(interface, attr): 117 if not FindMatchingAttribute(interface, attr):
118 self.AddSecondaryAttribute(parent_interface, attr) 118 self.AddSecondaryAttribute(parent_interface, attr)
119 119
120 # Group overloaded operations by id 120 # Group overloaded operations by id
121 operationsById = {} 121 operationsById = {}
122 for operation in parent_interface.operations: 122 for operation in parent_interface.operations:
123 if operation.id not in operationsById: 123 if operation.id not in operationsById:
124 operationsById[operation.id] = [] 124 operationsById[operation.id] = []
125 operationsById[operation.id].append(operation) 125 operationsById[operation.id].append(operation)
126 126
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 class GeneratorOptions(object): 187 class GeneratorOptions(object):
188 def __init__(self, templates, database, type_registry, renamer): 188 def __init__(self, templates, database, type_registry, renamer):
189 self.templates = templates 189 self.templates = templates
190 self.database = database 190 self.database = database
191 self.type_registry = type_registry 191 self.type_registry = type_registry
192 self.renamer = renamer 192 self.renamer = renamer
193 193
194 194
195 def IsReadOnly(attribute): 195 def IsReadOnly(attribute):
196 return attribute.is_read_only or 'Replaceable' in attribute.ext_attrs 196 return attribute.is_read_only or 'Replaceable' in attribute.ext_attrs
OLDNEW
« no previous file with comments | « lib/html/scripts/idlnode.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698