Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: Source/bindings/scripts/unstable/v8_interface.py

Issue 110023002: IDL compiler: [InitializedByEventConstructor] attribute any (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebased Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 v8_types.add_includes_for_type(special_wrap_interface) 104 v8_types.add_includes_for_type(special_wrap_interface)
105 105
106 # Constructors 106 # Constructors
107 # [Constructor] 107 # [Constructor]
108 has_constructor = 'Constructor' in extended_attributes 108 has_constructor = 'Constructor' in extended_attributes
109 if has_constructor: 109 if has_constructor:
110 includes.add('bindings/v8/V8ObjectConstructor.h') 110 includes.add('bindings/v8/V8ObjectConstructor.h')
111 111
112 # [EventConstructor] 112 # [EventConstructor]
113 has_event_constructor = 'EventConstructor' in extended_attributes 113 has_event_constructor = 'EventConstructor' in extended_attributes
114 has_any_type_attributes = any(attribute
115 for attribute in interface.attributes
116 if attribute.idl_type == 'any')
114 if has_event_constructor: 117 if has_event_constructor:
115 includes.update(['bindings/v8/Dictionary.h', 118 includes.update(['bindings/v8/Dictionary.h',
116 'bindings/v8/V8ObjectConstructor.h']) 119 'bindings/v8/V8ObjectConstructor.h'])
120 if has_any_type_attributes:
121 includes.add('bindings/v8/SerializedScriptValue.h')
117 122
118 template_contents = { 123 template_contents = {
119 'conditional_string': conditional_string(interface), # [Conditional] 124 'conditional_string': conditional_string(interface), # [Conditional]
120 'constructor_arguments': ['exceptionState'] if is_constructor_raises_exc eption else [], # FIXME: arguments are a complex function in general 125 'constructor_arguments': ['exceptionState'] if is_constructor_raises_exc eption else [], # FIXME: arguments are a complex function in general
121 'cpp_class': cpp_name(interface), 126 'cpp_class': cpp_name(interface),
122 'generate_visit_dom_wrapper_function': generate_visit_dom_wrapper_functi on, 127 'generate_visit_dom_wrapper_function': generate_visit_dom_wrapper_functi on,
123 'has_constructor': has_constructor, 128 'has_constructor': has_constructor,
124 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction] 129 'has_custom_legacy_call_as_function': has_extended_attribute_value(inter face, 'Custom', 'LegacyCallAsFunction'), # [Custom=LegacyCallAsFunction]
125 'has_custom_to_v8': has_extended_attribute_value(interface, 'Custom', 'T oV8'), # [Custom=ToV8] 130 'has_custom_to_v8': has_extended_attribute_value(interface, 'Custom', 'T oV8'), # [Custom=ToV8]
126 'has_custom_wrap': has_extended_attribute_value(interface, 'Custom', 'Wr ap'), # [Custom=Wrap] 131 'has_custom_wrap': has_extended_attribute_value(interface, 'Custom', 'Wr ap'), # [Custom=Wrap]
127 'has_event_constructor': has_event_constructor, 132 'has_event_constructor': has_event_constructor,
133 'has_any_type_attributes': has_any_type_attributes,
128 'has_visit_dom_wrapper': ( 134 'has_visit_dom_wrapper': (
129 # [Custom=Wrap], [GenerateVisitDOMWrapper] 135 # [Custom=Wrap], [GenerateVisitDOMWrapper]
130 has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper') or 136 has_extended_attribute_value(interface, 'Custom', 'VisitDOMWrapper') or
131 'GenerateVisitDOMWrapper' in extended_attributes), 137 'GenerateVisitDOMWrapper' in extended_attributes),
132 'header_includes': header_includes, 138 'header_includes': header_includes,
133 'interface_name': interface.name, 139 'interface_name': interface.name,
134 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac tiveDOMObject] 140 'is_active_dom_object': 'ActiveDOMObject' in extended_attributes, # [Ac tiveDOMObject]
135 'is_check_security': is_check_security, 141 'is_check_security': is_check_security,
136 'is_constructor_raises_exception': is_constructor_raises_exception, 142 'is_constructor_raises_exception': is_constructor_raises_exception,
137 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, # [DependentLifetime] 143 'is_dependent_lifetime': 'DependentLifetime' in extended_attributes, # [DependentLifetime]
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 '%s->IsString()' % cpp_value, 305 '%s->IsString()' % cpp_value,
300 '%s->IsObject()' % cpp_value]) 306 '%s->IsObject()' % cpp_value])
301 if v8_types.array_or_sequence_type(idl_type): 307 if v8_types.array_or_sequence_type(idl_type):
302 return '%s->IsArray()' % cpp_value 308 return '%s->IsArray()' % cpp_value
303 if v8_types.is_wrapper_type(idl_type): 309 if v8_types.is_wrapper_type(idl_type):
304 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(), worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value) 310 type_check = 'V8{idl_type}::hasInstance({cpp_value}, info.GetIsolate(), worldType(info.GetIsolate()))'.format(idl_type=idl_type, cpp_value=cpp_value)
305 if argument['is_nullable']: 311 if argument['is_nullable']:
306 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check]) 312 type_check = ' || '.join(['%s->IsNull()' % cpp_value, type_check])
307 return type_check 313 return type_check
308 return None 314 return None
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698