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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 includes.clear() | 65 includes.clear() |
66 includes.update(INTERFACE_CPP_INCLUDES) | 66 includes.update(INTERFACE_CPP_INCLUDES) |
67 extended_attributes = interface.extended_attributes | 67 extended_attributes = interface.extended_attributes |
68 | 68 |
69 # [CheckSecurity] | 69 # [CheckSecurity] |
70 is_check_security = 'CheckSecurity' in extended_attributes | 70 is_check_security = 'CheckSecurity' in extended_attributes |
71 if is_check_security: | 71 if is_check_security: |
72 includes.update(['bindings/v8/BindingSecurity.h', | 72 includes.update(['bindings/v8/BindingSecurity.h', |
73 'bindings/v8/ExceptionState.h']) | 73 'bindings/v8/ExceptionState.h']) |
74 | 74 |
| 75 # [Constructor] |
| 76 has_constructor = 'Constructor' in extended_attributes |
| 77 if has_constructor: |
| 78 includes.add('bindings/v8/V8ObjectConstructor.h') |
| 79 |
75 # [GenerateVisitDOMWrapper] | 80 # [GenerateVisitDOMWrapper] |
76 generate_visit_dom_wrapper_function = extended_attributes.get('GenerateVisit
DOMWrapper') | 81 generate_visit_dom_wrapper_function = extended_attributes.get('GenerateVisit
DOMWrapper') |
77 if generate_visit_dom_wrapper_function: | 82 if generate_visit_dom_wrapper_function: |
78 includes.update(['bindings/v8/V8GCController.h', | 83 includes.update(['bindings/v8/V8GCController.h', |
79 'core/dom/Element.h']) | 84 'core/dom/Element.h']) |
80 | 85 |
81 # [SpecialWrapFor] | 86 # [SpecialWrapFor] |
82 if 'SpecialWrapFor' in extended_attributes: | 87 if 'SpecialWrapFor' in extended_attributes: |
83 special_wrap_for = extended_attributes['SpecialWrapFor'].split('|') | 88 special_wrap_for = extended_attributes['SpecialWrapFor'].split('|') |
84 else: | 89 else: |
85 special_wrap_for = [] | 90 special_wrap_for = [] |
86 for special_wrap_interface in special_wrap_for: | 91 for special_wrap_interface in special_wrap_for: |
87 v8_types.add_includes_for_type(special_wrap_interface) | 92 v8_types.add_includes_for_type(special_wrap_interface) |
88 | 93 |
89 template_contents = { | 94 template_contents = { |
90 'conditional_string': conditional_string(interface), # [Conditional] | 95 'conditional_string': conditional_string(interface), # [Conditional] |
91 'cpp_class': cpp_name(interface), | 96 'cpp_class': cpp_name(interface), |
92 'generate_visit_dom_wrapper_function': generate_visit_dom_wrapper_functi
on, | 97 'generate_visit_dom_wrapper_function': generate_visit_dom_wrapper_functi
on, |
| 98 'has_constructor': has_constructor, |
93 'has_custom_legacy_call': 'CustomLegacyCall' in extended_attributes, #
[CustomLegacyCall] | 99 'has_custom_legacy_call': 'CustomLegacyCall' in extended_attributes, #
[CustomLegacyCall] |
94 'has_custom_to_v8': 'CustomToV8' in extended_attributes, # [CustomToV8] | 100 'has_custom_to_v8': 'CustomToV8' in extended_attributes, # [CustomToV8] |
95 'has_custom_wrap': 'CustomWrap' in extended_attributes, # [CustomWrap] | 101 'has_custom_wrap': 'CustomWrap' in extended_attributes, # [CustomWrap] |
96 'has_visit_dom_wrapper': has_extended_attribute(interface, | 102 'has_visit_dom_wrapper': has_extended_attribute(interface, |
97 ['CustomVisitDOMWrapper', 'GenerateVisitDOMWrapper']), | 103 ['CustomVisitDOMWrapper', 'GenerateVisitDOMWrapper']), |
98 'header_includes': INTERFACE_H_INCLUDES, | 104 'header_includes': INTERFACE_H_INCLUDES, |
99 'interface_name': interface.name, | 105 'interface_name': interface.name, |
100 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac
tiveDOMObject] | 106 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac
tiveDOMObject] |
101 'is_check_security': is_check_security, | 107 'is_check_security': is_check_security, |
102 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, #
[DependentLifetime] | 108 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, #
[DependentLifetime] |
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 '%s->IsString()' % cpp_value, | 267 '%s->IsString()' % cpp_value, |
262 '%s->IsObject()' % cpp_value]) | 268 '%s->IsObject()' % cpp_value]) |
263 if v8_types.array_or_sequence_type(idl_type): | 269 if v8_types.array_or_sequence_type(idl_type): |
264 return '%s->IsArray()' % cpp_value | 270 return '%s->IsArray()' % cpp_value |
265 if v8_types.is_wrapper_type(idl_type): | 271 if v8_types.is_wrapper_type(idl_type): |
266 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(),
worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value) | 272 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(),
worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value) |
267 if argument['is_nullable']: | 273 if argument['is_nullable']: |
268 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) | 274 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) |
269 return type_check | 275 return type_check |
270 return None | 276 return None |
OLD | NEW |