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

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: PReserve old entrypoint 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
« lib/html/scripts/databasebuilder.py ('K') | « lib/html/scripts/go.sh ('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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 def Generate(self): 100 def Generate(self):
101 self.StartInterface() 101 self.StartInterface()
102 self.AddMembers(self._interface) 102 self.AddMembers(self._interface)
103 self.AddSecondaryMembers(self._interface) 103 self.AddSecondaryMembers(self._interface)
104 self.FinishInterface() 104 self.FinishInterface()
105 105
106 def AddMembers(self, interface): 106 def AddMembers(self, interface):
107 for const in sorted(interface.constants, ConstantOutputOrder): 107 for const in sorted(interface.constants, ConstantOutputOrder):
108 self.AddConstant(const) 108 self.AddConstant(const)
109 109
110 for attr in interface.attributes: 110 for attr in sorted(interface.attributes, ConstantOutputOrder):
111 if attr.type.id != 'EventListener': 111 if attr.type.id != 'EventListener':
112 self.AddAttribute(attr) 112 self.AddAttribute(attr)
113 113
114 # The implementation should define an indexer if the interface directly 114 # The implementation should define an indexer if the interface directly
115 # extends List. 115 # extends List.
116 (element_type, requires_indexer) = ListImplementationInfo( 116 (element_type, requires_indexer) = ListImplementationInfo(
117 interface, self._database) 117 interface, self._database)
118 if element_type: 118 if element_type:
119 if requires_indexer: 119 if requires_indexer:
120 self.AddIndexer(element_type) 120 self.AddIndexer(element_type)
(...skipping 14 matching lines...) Expand all
135 135
136 def AddSecondaryMembers(self, interface): 136 def AddSecondaryMembers(self, interface):
137 # With multiple inheritance, attributes and operations of non-first 137 # With multiple inheritance, attributes and operations of non-first
138 # interfaces need to be added. Sometimes the attribute or operation is 138 # interfaces need to be added. Sometimes the attribute or operation is
139 # defined in the current interface as well as a parent. In that case we 139 # defined in the current interface as well as a parent. In that case we
140 # avoid making a duplicate definition and pray that the signatures match. 140 # avoid making a duplicate definition and pray that the signatures match.
141 secondary_parents = self._TransitiveSecondaryParents(interface) 141 secondary_parents = self._TransitiveSecondaryParents(interface)
142 for parent_interface in secondary_parents: 142 for parent_interface in secondary_parents:
143 if isinstance(parent_interface, str): # IsDartCollectionType(parent_inter face) 143 if isinstance(parent_interface, str): # IsDartCollectionType(parent_inter face)
144 continue 144 continue
145 for attr in parent_interface.attributes: 145 for attr in sorted(parent_interface.attributes, ConstantOutputOrder):
146 if not FindMatchingAttribute(interface, attr): 146 if not FindMatchingAttribute(interface, attr):
147 self.AddSecondaryAttribute(parent_interface, attr) 147 self.AddSecondaryAttribute(parent_interface, attr)
148 148
149 # Group overloaded operations by id 149 # Group overloaded operations by id
150 operationsById = {} 150 operationsById = {}
151 for operation in parent_interface.operations: 151 for operation in parent_interface.operations:
152 if operation.id not in operationsById: 152 if operation.id not in operationsById:
153 operationsById[operation.id] = [] 153 operationsById[operation.id] = []
154 operationsById[operation.id].append(operation) 154 operationsById[operation.id].append(operation)
155 155
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 self.database = database 217 self.database = database
218 self.emitters = emitters 218 self.emitters = emitters
219 self.type_registry = type_registry 219 self.type_registry = type_registry
220 self.renamer = renamer 220 self.renamer = renamer
221 self.output_dir = output_dir 221 self.output_dir = output_dir
222 self.auxiliary_dir = auxiliary_dir 222 self.auxiliary_dir = auxiliary_dir
223 223
224 224
225 def IsReadOnly(attribute): 225 def IsReadOnly(attribute):
226 return attribute.is_read_only or 'Replaceable' in attribute.ext_attrs 226 return attribute.is_read_only or 'Replaceable' in attribute.ext_attrs
OLDNEW
« lib/html/scripts/databasebuilder.py ('K') | « lib/html/scripts/go.sh ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698