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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 def attribute_context(interface, attribute): | 44 def attribute_context(interface, attribute): |
45 idl_type = attribute.idl_type | 45 idl_type = attribute.idl_type |
46 base_idl_type = idl_type.base_type | 46 base_idl_type = idl_type.base_type |
47 extended_attributes = attribute.extended_attributes | 47 extended_attributes = attribute.extended_attributes |
48 | 48 |
49 idl_type.add_includes_for_type() | 49 idl_type.add_includes_for_type() |
50 | 50 |
51 # [CheckSecurity] | 51 # [CheckSecurity] |
52 is_check_security_for_node = 'CheckSecurity' in extended_attributes | 52 is_check_security_for_node = 'CheckSecurity' in extended_attributes |
53 if is_check_security_for_node: | 53 if is_check_security_for_node: |
54 includes.add('bindings/v8/BindingSecurity.h') | 54 includes.add('bindings/core/v8/BindingSecurity.h') |
55 # [Custom] | 55 # [Custom] |
56 has_custom_getter = ('Custom' in extended_attributes and | 56 has_custom_getter = ('Custom' in extended_attributes and |
57 extended_attributes['Custom'] in [None, 'Getter']) | 57 extended_attributes['Custom'] in [None, 'Getter']) |
58 has_custom_setter = (not attribute.is_read_only and | 58 has_custom_setter = (not attribute.is_read_only and |
59 'Custom' in extended_attributes and | 59 'Custom' in extended_attributes and |
60 extended_attributes['Custom'] in [None, 'Setter']) | 60 extended_attributes['Custom'] in [None, 'Setter']) |
61 # [CustomElementCallbacks], [Reflect] | 61 # [CustomElementCallbacks], [Reflect] |
62 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute
s | 62 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute
s |
63 is_reflect = 'Reflect' in extended_attributes | 63 is_reflect = 'Reflect' in extended_attributes |
64 if is_custom_element_callbacks or is_reflect: | 64 if is_custom_element_callbacks or is_reflect: |
65 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') | 65 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') |
66 # [PerWorldBindings] | 66 # [PerWorldBindings] |
67 if 'PerWorldBindings' in extended_attributes: | 67 if 'PerWorldBindings' in extended_attributes: |
68 assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes,
'[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface
.name, attribute.name) | 68 assert idl_type.is_wrapper_type or 'LogActivity' in extended_attributes,
'[PerWorldBindings] should only be used with wrapper types: %s.%s' % (interface
.name, attribute.name) |
69 # [TypeChecking] | 69 # [TypeChecking] |
70 has_type_checking_unrestricted = ( | 70 has_type_checking_unrestricted = ( |
71 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted')
or | 71 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted')
or |
72 has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted')
) and | 72 has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted')
) and |
73 idl_type.name in ('Float', 'Double')) | 73 idl_type.name in ('Float', 'Double')) |
74 | 74 |
75 if (base_idl_type == 'EventHandler' and | 75 if (base_idl_type == 'EventHandler' and |
76 interface.name in ['Window', 'WorkerGlobalScope'] and | 76 interface.name in ['Window', 'WorkerGlobalScope'] and |
77 attribute.name == 'onerror'): | 77 attribute.name == 'onerror'): |
78 includes.add('bindings/v8/V8ErrorHandler.h') | 78 includes.add('bindings/core/v8/V8ErrorHandler.h') |
79 | 79 |
80 # Nullable type where the corresponding C++ type supports a null value. | 80 # Nullable type where the corresponding C++ type supports a null value. |
81 is_nullable_simple = idl_type.is_nullable and ( | 81 is_nullable_simple = idl_type.is_nullable and ( |
82 (idl_type.is_string_type or idl_type.is_wrapper_type) and | 82 (idl_type.is_string_type or idl_type.is_wrapper_type) and |
83 not idl_type.array_or_sequence_type) | 83 not idl_type.array_or_sequence_type) |
84 | 84 |
85 context = { | 85 context = { |
86 'access_control_list': access_control_list(attribute), | 86 'access_control_list': access_control_list(attribute), |
87 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_
world_list(attribute, 'Getter'), # [ActivityLogging] | 87 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_
world_list(attribute, 'Getter'), # [ActivityLogging] |
88 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_
world_list(attribute, 'Setter'), # [ActivityLogging] | 88 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_
world_list(attribute, 'Setter'), # [ActivityLogging] |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 if ('PartialInterfaceImplementedAs' in extended_attributes and | 329 if ('PartialInterfaceImplementedAs' in extended_attributes and |
330 not attribute.is_static): | 330 not attribute.is_static): |
331 arguments.append('*impl') | 331 arguments.append('*impl') |
332 idl_type = attribute.idl_type | 332 idl_type = attribute.idl_type |
333 if idl_type.base_type == 'EventHandler': | 333 if idl_type.base_type == 'EventHandler': |
334 getter_name = scoped_name(interface, attribute, cpp_name(attribute)) | 334 getter_name = scoped_name(interface, attribute, cpp_name(attribute)) |
335 context['event_handler_getter_expression'] = '%s(%s)' % ( | 335 context['event_handler_getter_expression'] = '%s(%s)' % ( |
336 getter_name, ', '.join(arguments)) | 336 getter_name, ', '.join(arguments)) |
337 if (interface.name in ['Window', 'WorkerGlobalScope'] and | 337 if (interface.name in ['Window', 'WorkerGlobalScope'] and |
338 attribute.name == 'onerror'): | 338 attribute.name == 'onerror'): |
339 includes.add('bindings/v8/V8ErrorHandler.h') | 339 includes.add('bindings/core/v8/V8ErrorHandler.h') |
340 arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHa
ndler>(v8Value, true, ScriptState::current(info.GetIsolate()))') | 340 arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHa
ndler>(v8Value, true, ScriptState::current(info.GetIsolate()))') |
341 else: | 341 else: |
342 arguments.append('V8EventListenerList::getEventListener(ScriptState:
:current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)') | 342 arguments.append('V8EventListenerList::getEventListener(ScriptState:
:current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)') |
343 elif idl_type.is_interface_type and not idl_type.array_type: | 343 elif idl_type.is_interface_type and not idl_type.array_type: |
344 # FIXME: should be able to eliminate WTF::getPtr in most or all cases | 344 # FIXME: should be able to eliminate WTF::getPtr in most or all cases |
345 arguments.append('WTF::getPtr(cppValue)') | 345 arguments.append('WTF::getPtr(cppValue)') |
346 else: | 346 else: |
347 arguments.append('cppValue') | 347 arguments.append('cppValue') |
348 if context['is_setter_raises_exception']: | 348 if context['is_setter_raises_exception']: |
349 arguments.append('exceptionState') | 349 arguments.append('exceptionState') |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
432 lambda self: strip_suffix(self.base_type, 'Constructor')) | 432 lambda self: strip_suffix(self.base_type, 'Constructor')) |
433 | 433 |
434 | 434 |
435 def is_constructor_attribute(attribute): | 435 def is_constructor_attribute(attribute): |
436 # FIXME: replace this with [ConstructorAttribute] extended attribute | 436 # FIXME: replace this with [ConstructorAttribute] extended attribute |
437 return attribute.idl_type.base_type.endswith('Constructor') | 437 return attribute.idl_type.base_type.endswith('Constructor') |
438 | 438 |
439 | 439 |
440 def constructor_getter_context(interface, attribute, context): | 440 def constructor_getter_context(interface, attribute, context): |
441 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 441 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
OLD | NEW |