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

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: One more fix 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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 def Generate(self): 65 def Generate(self):
66 self.StartInterface() 66 self.StartInterface()
67 self.AddMembers(self._interface) 67 self.AddMembers(self._interface)
68 self.AddSecondaryMembers(self._interface) 68 self.AddSecondaryMembers(self._interface)
69 self.FinishInterface() 69 self.FinishInterface()
70 70
71 def AddMembers(self, interface): 71 def AddMembers(self, interface):
72 for const in sorted(interface.constants, ConstantOutputOrder): 72 for const in sorted(interface.constants, ConstantOutputOrder):
73 self.AddConstant(const) 73 self.AddConstant(const)
74 74
75 for attr in interface.attributes: 75 for attr in sorted(interface.attributes, ConstantOutputOrder):
76 if attr.type.id != 'EventListener': 76 if attr.type.id != 'EventListener':
77 self.AddAttribute(attr) 77 self.AddAttribute(attr)
78 78
79 # The implementation should define an indexer if the interface directly 79 # The implementation should define an indexer if the interface directly
80 # extends List. 80 # extends List.
81 (element_type, requires_indexer) = ListImplementationInfo( 81 (element_type, requires_indexer) = ListImplementationInfo(
82 interface, self._database) 82 interface, self._database)
83 if element_type: 83 if element_type:
84 if requires_indexer: 84 if requires_indexer:
85 self.AddIndexer(element_type) 85 self.AddIndexer(element_type)
(...skipping 14 matching lines...) Expand all
100 100
101 def AddSecondaryMembers(self, interface): 101 def AddSecondaryMembers(self, interface):
102 # With multiple inheritance, attributes and operations of non-first 102 # With multiple inheritance, attributes and operations of non-first
103 # interfaces need to be added. Sometimes the attribute or operation is 103 # interfaces need to be added. Sometimes the attribute or operation is
104 # defined in the current interface as well as a parent. In that case we 104 # defined in the current interface as well as a parent. In that case we
105 # avoid making a duplicate definition and pray that the signatures match. 105 # avoid making a duplicate definition and pray that the signatures match.
106 secondary_parents = self._TransitiveSecondaryParents(interface) 106 secondary_parents = self._TransitiveSecondaryParents(interface)
107 for parent_interface in secondary_parents: 107 for parent_interface in secondary_parents:
108 if isinstance(parent_interface, str): # IsDartCollectionType(parent_inter face) 108 if isinstance(parent_interface, str): # IsDartCollectionType(parent_inter face)
109 continue 109 continue
110 for attr in parent_interface.attributes: 110 for attr in sorted(parent_interface.attributes, ConstantOutputOrder):
111 if not FindMatchingAttribute(interface, attr): 111 if not FindMatchingAttribute(interface, attr):
112 self.AddSecondaryAttribute(parent_interface, attr) 112 self.AddSecondaryAttribute(parent_interface, attr)
113 113
114 # Group overloaded operations by id 114 # Group overloaded operations by id
115 operationsById = {} 115 operationsById = {}
116 for operation in parent_interface.operations: 116 for operation in parent_interface.operations:
117 if operation.id not in operationsById: 117 if operation.id not in operationsById:
118 operationsById[operation.id] = [] 118 operationsById[operation.id] = []
119 operationsById[operation.id].append(operation) 119 operationsById[operation.id].append(operation)
120 120
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 class GeneratorOptions(object): 178 class GeneratorOptions(object):
179 def __init__(self, templates, database, type_registry, renamer): 179 def __init__(self, templates, database, type_registry, renamer):
180 self.templates = templates 180 self.templates = templates
181 self.database = database 181 self.database = database
182 self.type_registry = type_registry 182 self.type_registry = type_registry
183 self.renamer = renamer 183 self.renamer = renamer
184 184
185 185
186 def IsReadOnly(attribute): 186 def IsReadOnly(attribute):
187 return attribute.is_read_only or 'Replaceable' in attribute.ext_attrs 187 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