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 if ('PerWorldBindings' not in extended_attributes and | 178 if ('PerWorldBindings' not in extended_attributes and |
179 'LogAllWorlds' not in extended_attributes): | 179 'LogAllWorlds' not in extended_attributes): |
180 return True | 180 return True |
181 return False | 181 return False |
182 | 182 |
183 | 183 |
184 # [CallWith] | 184 # [CallWith] |
185 CALL_WITH_ARGUMENTS = { | 185 CALL_WITH_ARGUMENTS = { |
186 'ScriptState': 'scriptState', | 186 'ScriptState': 'scriptState', |
187 'ExecutionContext': 'executionContext', | 187 'ExecutionContext': 'executionContext', |
188 'ScriptArguments': 'scriptArguments.release()', | 188 'ScriptArguments': 'scriptArguments', |
189 'CurrentWindow': 'currentDOMWindow(info.GetIsolate())', | 189 'CurrentWindow': 'currentDOMWindow(info.GetIsolate())', |
190 'EnteredWindow': 'enteredDOMWindow(info.GetIsolate())', | 190 'EnteredWindow': 'enteredDOMWindow(info.GetIsolate())', |
191 'Document': 'document', | 191 'Document': 'document', |
192 'ThisValue': 'ScriptValue(scriptState, info.This())', | 192 'ThisValue': 'ScriptValue(scriptState, info.This())', |
193 } | 193 } |
194 # List because key order matters, as we want arguments in deterministic order | 194 # List because key order matters, as we want arguments in deterministic order |
195 CALL_WITH_VALUES = [ | 195 CALL_WITH_VALUES = [ |
196 'ScriptState', | 196 'ScriptState', |
197 'ExecutionContext', | 197 'ExecutionContext', |
198 'ScriptArguments', | 198 'ScriptArguments', |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 if e.exposed not in EXPOSED_EXECUTION_CONTEXT_METHOD: | 317 if e.exposed not in EXPOSED_EXECUTION_CONTEXT_METHOD: |
318 raise ValueError('Invalid execution context: %s' % e.exposed) | 318 raise ValueError('Invalid execution context: %s' % e.exposed) |
319 | 319 |
320 # Methods must not be exposed to a broader scope than their interface. | 320 # Methods must not be exposed to a broader scope than their interface. |
321 if not exposure_set.issubset(interface_exposure_set): | 321 if not exposure_set.issubset(interface_exposure_set): |
322 raise ValueError('Interface members\' exposure sets must be a subset of
the interface\'s.') | 322 raise ValueError('Interface members\' exposure sets must be a subset of
the interface\'s.') |
323 | 323 |
324 return exposure_set.code() | 324 return exposure_set.code() |
325 | 325 |
326 | 326 |
327 # [GarbageCollected] | |
328 def gc_type(definition): | |
329 extended_attributes = definition.extended_attributes | |
330 if 'GarbageCollected' in extended_attributes: | |
331 return 'GarbageCollectedObject' | |
332 return 'RefCountedObject' | |
333 | |
334 | |
335 # [ImplementedAs] | 327 # [ImplementedAs] |
336 def cpp_name(definition_or_member): | 328 def cpp_name(definition_or_member): |
337 extended_attributes = definition_or_member.extended_attributes | 329 extended_attributes = definition_or_member.extended_attributes |
338 if 'ImplementedAs' not in extended_attributes: | 330 if 'ImplementedAs' not in extended_attributes: |
339 return definition_or_member.name | 331 return definition_or_member.name |
340 return extended_attributes['ImplementedAs'] | 332 return extended_attributes['ImplementedAs'] |
341 | 333 |
342 | 334 |
343 def cpp_name_from_interfaces_info(name, interfaces_info): | 335 def cpp_name_from_interfaces_info(name, interfaces_info): |
344 return interfaces_info.get(name, {}).get('implemented_as') or name | 336 return interfaces_info.get(name, {}).get('implemented_as') or name |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
609 except StopIteration: | 601 except StopIteration: |
610 return None | 602 return None |
611 | 603 |
612 | 604 |
613 IdlInterface.indexed_property_getter = property(indexed_property_getter) | 605 IdlInterface.indexed_property_getter = property(indexed_property_getter) |
614 IdlInterface.indexed_property_setter = property(indexed_property_setter) | 606 IdlInterface.indexed_property_setter = property(indexed_property_setter) |
615 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) | 607 IdlInterface.indexed_property_deleter = property(indexed_property_deleter) |
616 IdlInterface.named_property_getter = property(named_property_getter) | 608 IdlInterface.named_property_getter = property(named_property_getter) |
617 IdlInterface.named_property_setter = property(named_property_setter) | 609 IdlInterface.named_property_setter = property(named_property_setter) |
618 IdlInterface.named_property_deleter = property(named_property_deleter) | 610 IdlInterface.named_property_deleter = property(named_property_deleter) |
OLD | NEW |