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.update(INTERFACE_CPP_INCLUDES) | 65 includes.update(INTERFACE_CPP_INCLUDES) |
66 extended_attributes = interface.extended_attributes | 66 extended_attributes = interface.extended_attributes |
67 | 67 |
68 # [CheckSecurity] | 68 # [CheckSecurity] |
69 is_check_security = 'CheckSecurity' in extended_attributes | 69 is_check_security = 'CheckSecurity' in extended_attributes |
70 if is_check_security: | 70 if is_check_security: |
71 includes.update(['bindings/v8/BindingSecurity.h', | 71 includes.update(['bindings/v8/BindingSecurity.h', |
72 'bindings/v8/ExceptionMessages.h', | 72 'bindings/v8/ExceptionMessages.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.update(['bindings/v8/ExceptionMessages.h', | |
haraken
2013/12/05 05:54:16
How about including ExceptionMessages.h always? It
Nils Barth (inactive)
2013/12/05 06:09:20
We include it about 45% of the time (~300/680),
so
| |
79 'bindings/v8/V8ObjectConstructor.h']) | |
80 | |
75 # [GenerateVisitDOMWrapper] | 81 # [GenerateVisitDOMWrapper] |
76 generate_visit_dom_wrapper_function = extended_attributes.get('GenerateVisit DOMWrapper') | 82 generate_visit_dom_wrapper_function = extended_attributes.get('GenerateVisit DOMWrapper') |
77 if generate_visit_dom_wrapper_function: | 83 if generate_visit_dom_wrapper_function: |
78 includes.update(['bindings/v8/V8GCController.h', | 84 includes.update(['bindings/v8/V8GCController.h', |
79 'core/dom/Element.h']) | 85 'core/dom/Element.h']) |
80 | 86 |
81 # [SpecialWrapFor] | 87 # [SpecialWrapFor] |
82 if 'SpecialWrapFor' in extended_attributes: | 88 if 'SpecialWrapFor' in extended_attributes: |
83 special_wrap_for = extended_attributes['SpecialWrapFor'].split('|') | 89 special_wrap_for = extended_attributes['SpecialWrapFor'].split('|') |
84 else: | 90 else: |
85 special_wrap_for = [] | 91 special_wrap_for = [] |
86 for special_wrap_interface in special_wrap_for: | 92 for special_wrap_interface in special_wrap_for: |
87 v8_types.add_includes_for_type(special_wrap_interface) | 93 v8_types.add_includes_for_type(special_wrap_interface) |
88 | 94 |
89 template_contents = { | 95 template_contents = { |
90 'conditional_string': conditional_string(interface), # [Conditional] | 96 'conditional_string': conditional_string(interface), # [Conditional] |
91 'cpp_class': cpp_name(interface), | 97 'cpp_class': cpp_name(interface), |
92 'generate_visit_dom_wrapper_function': generate_visit_dom_wrapper_functi on, | 98 'generate_visit_dom_wrapper_function': generate_visit_dom_wrapper_functi on, |
99 'has_constructor': has_constructor, | |
93 'has_custom_legacy_call': 'CustomLegacyCall' in extended_attributes, # [CustomLegacyCall] | 100 'has_custom_legacy_call': 'CustomLegacyCall' in extended_attributes, # [CustomLegacyCall] |
94 'has_custom_to_v8': 'CustomToV8' in extended_attributes, # [CustomToV8] | 101 'has_custom_to_v8': 'CustomToV8' in extended_attributes, # [CustomToV8] |
95 'has_custom_wrap': 'CustomWrap' in extended_attributes, # [CustomWrap] | 102 'has_custom_wrap': 'CustomWrap' in extended_attributes, # [CustomWrap] |
96 'has_visit_dom_wrapper': has_extended_attribute(interface, | 103 'has_visit_dom_wrapper': has_extended_attribute(interface, |
97 ['CustomVisitDOMWrapper', 'GenerateVisitDOMWrapper']), | 104 ['CustomVisitDOMWrapper', 'GenerateVisitDOMWrapper']), |
98 'header_includes': INTERFACE_H_INCLUDES, | 105 'header_includes': INTERFACE_H_INCLUDES, |
99 'interface_name': interface.name, | 106 'interface_name': interface.name, |
100 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac tiveDOMObject] | 107 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac tiveDOMObject] |
101 'is_check_security': is_check_security, | 108 'is_check_security': is_check_security, |
102 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, # [DependentLifetime] | 109 '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, | 268 '%s->IsString()' % cpp_value, |
262 '%s->IsObject()' % cpp_value]) | 269 '%s->IsObject()' % cpp_value]) |
263 if v8_types.array_or_sequence_type(idl_type): | 270 if v8_types.array_or_sequence_type(idl_type): |
264 return '%s->IsArray()' % cpp_value | 271 return '%s->IsArray()' % cpp_value |
265 if v8_types.is_wrapper_type(idl_type): | 272 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) | 273 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']: | 274 if argument['is_nullable']: |
268 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) | 275 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) |
269 return type_check | 276 return type_check |
270 return None | 277 return None |
OLD | NEW |