OLD | NEW |
1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
2 # | 2 # |
3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
5 # met: | 5 # met: |
6 # | 6 # |
7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
178 # - A partial interface defined in core cannot update | 178 # - A partial interface defined in core cannot update |
179 # the original interface defined in modules. | 179 # the original interface defined in modules. |
180 if not is_valid_component_dependency(dependency_component, component
): | 180 if not is_valid_component_dependency(dependency_component, component
): |
181 raise Exception('The partial interface:%s in %s cannot update ' | 181 raise Exception('The partial interface:%s in %s cannot update ' |
182 'the original interface:%s in %s' % (dependency_
interface.name, | 182 'the original interface:%s in %s' % (dependency_
interface.name, |
183 dependency_
component, | 183 dependency_
component, |
184 target_inte
rface.name, | 184 target_inte
rface.name, |
185 component)) | 185 component)) |
186 | 186 |
187 if dependency_component in resolved_definitions: | 187 if dependency_component in resolved_definitions: |
| 188 # When merging a new partial interfaces, should not overwrite |
| 189 # ImpelemntedAs extended attributes in merged partial |
| 190 # interface. |
| 191 # See also the below "if 'ImplementedAs' not in ... " line's |
| 192 # comment. |
| 193 dependency_interface.extended_attributes.pop('ImplementedAs', No
ne) |
188 resolved_definitions[dependency_component].update(dependency_def
initions) | 194 resolved_definitions[dependency_component].update(dependency_def
initions) |
189 continue | 195 continue |
190 | 196 |
191 dependency_interface.extended_attributes.update(target_interface.ext
ended_attributes) | 197 dependency_interface.extended_attributes.update(target_interface.ext
ended_attributes) |
192 assert target_interface == definitions.interfaces[dependency_interfa
ce.name] | 198 assert target_interface == definitions.interfaces[dependency_interfa
ce.name] |
| 199 # A partial interface should use its original interface's |
| 200 # ImplementedAs. If the original interface doesn't have, |
| 201 # remove ImplementedAs defined in the partial interface. |
| 202 # Because partial interface needs the original interface's |
| 203 # cpp class to obtain partial interface's cpp class. |
| 204 # e.g.. V8WindowPartial.cpp: |
| 205 # DOMWindow* impl = V8Window::toImpl(holder); |
| 206 # RawPtr<...> cppValue(DOMWindowQuota::webkitStorageInfo(impl)); |
| 207 # TODO(tasak): remove ImplementedAs extended attributes |
| 208 # from all partial interfaces. Instead, rename all cpp/header |
| 209 # files correctly. ImplementedAs should not be allowed in |
| 210 # partial interfaces. |
| 211 if 'ImplementedAs' not in target_interface.extended_attributes: |
| 212 dependency_interface.extended_attributes.pop('ImplementedAs', No
ne) |
193 dependency_interface.original_interface = target_interface | 213 dependency_interface.original_interface = target_interface |
194 target_interface.partial_interfaces.append(dependency_interface) | 214 target_interface.partial_interfaces.append(dependency_interface) |
195 resolved_definitions[dependency_component] = dependency_definitions | 215 resolved_definitions[dependency_component] = dependency_definitions |
196 else: | 216 else: |
197 # Case: target_interface implements dependency_interface. | 217 # Case: target_interface implements dependency_interface. |
198 # So, | 218 # So, |
199 # - An interface defined in modules can implement some interface | 219 # - An interface defined in modules can implement some interface |
200 # defined in core. | 220 # defined in core. |
201 # In this case, we need "NoInterfaceObject" extended attribute. | 221 # In this case, we need "NoInterfaceObject" extended attribute. |
202 # However, | 222 # However, |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 for key, value in extras.items(): | 299 for key, value in extras.items(): |
280 if key not in attributes: | 300 if key not in attributes: |
281 attributes[key] = value | 301 attributes[key] = value |
282 | 302 |
283 for attribute in dependency_interface.attributes: | 303 for attribute in dependency_interface.attributes: |
284 update_attributes(attribute.extended_attributes, merged_extended_attribu
tes) | 304 update_attributes(attribute.extended_attributes, merged_extended_attribu
tes) |
285 for constant in dependency_interface.constants: | 305 for constant in dependency_interface.constants: |
286 update_attributes(constant.extended_attributes, merged_extended_attribut
es) | 306 update_attributes(constant.extended_attributes, merged_extended_attribut
es) |
287 for operation in dependency_interface.operations: | 307 for operation in dependency_interface.operations: |
288 update_attributes(operation.extended_attributes, merged_extended_attribu
tes) | 308 update_attributes(operation.extended_attributes, merged_extended_attribu
tes) |
OLD | NEW |