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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
77 idl_type.add_includes_for_type() | 77 idl_type.add_includes_for_type() |
78 this_cpp_value = cpp_value(interface, method, len(arguments)) | 78 this_cpp_value = cpp_value(interface, method, len(arguments)) |
79 | 79 |
80 def function_template(): | 80 def function_template(): |
81 if is_static: | 81 if is_static: |
82 return 'functionTemplate' | 82 return 'functionTemplate' |
83 if 'Unforgeable' in extended_attributes: | 83 if 'Unforgeable' in extended_attributes: |
84 return 'instanceTemplate' | 84 return 'instanceTemplate' |
85 return 'prototypeTemplate' | 85 return 'prototypeTemplate' |
86 | 86 |
87 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_ attributes | |
88 if is_implemented_in_private_script: | |
89 includes.add('bindings/v8/PrivateScriptRunner.h') | |
90 includes.add('core/frame/LocalFrame.h') | |
87 is_call_with_script_arguments = has_extended_attribute_value(method, 'CallWi th', 'ScriptArguments') | 91 is_call_with_script_arguments = has_extended_attribute_value(method, 'CallWi th', 'ScriptArguments') |
88 if is_call_with_script_arguments: | 92 if is_call_with_script_arguments: |
89 includes.update(['bindings/v8/ScriptCallStackFactory.h', | 93 includes.update(['bindings/v8/ScriptCallStackFactory.h', |
90 'core/inspector/ScriptArguments.h']) | 94 'core/inspector/ScriptArguments.h']) |
91 is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState') | 95 is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState') |
92 if is_call_with_script_state: | 96 if is_call_with_script_state: |
93 includes.add('bindings/v8/ScriptState.h') | 97 includes.add('bindings/v8/ScriptState.h') |
94 is_check_security_for_node = 'CheckSecurity' in extended_attributes | 98 is_check_security_for_node = 'CheckSecurity' in extended_attributes |
95 if is_check_security_for_node: | 99 if is_check_security_for_node: |
96 includes.add('bindings/v8/BindingSecurity.h') | 100 includes.add('bindings/v8/BindingSecurity.h') |
97 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute s | 101 is_custom_element_callbacks = 'CustomElementCallbacks' in extended_attribute s |
98 if is_custom_element_callbacks: | 102 if is_custom_element_callbacks: |
99 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') | 103 includes.add('core/dom/custom/CustomElementCallbackDispatcher.h') |
100 | 104 |
101 is_check_security_for_frame = ( | 105 is_check_security_for_frame = ( |
102 'CheckSecurity' in interface.extended_attributes and | 106 'CheckSecurity' in interface.extended_attributes and |
103 'DoNotCheckSecurity' not in extended_attributes) | 107 'DoNotCheckSecurity' not in extended_attributes) |
104 is_raises_exception = 'RaisesException' in extended_attributes | 108 is_raises_exception = 'RaisesException' in extended_attributes |
105 | 109 |
106 arguments_need_try_catch = any(argument_needs_try_catch(argument) | 110 arguments_need_try_catch = any(argument_needs_try_catch(argument) |
107 for argument in arguments) | 111 for argument in arguments) |
108 | 112 |
109 return { | 113 return { |
110 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging] | 114 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging] |
111 'arguments': [argument_context(interface, method, argument, index) | 115 'arguments': [argument_context(interface, method, argument, index) |
112 for index, argument in enumerate(arguments)], | 116 for index, argument in enumerate(arguments)], |
117 'argument_declarations_for_private_script': argument_declarations_for_pr ivate_script(interface, method), | |
Jens Widell
2014/06/30 18:32:37
Wrap this line?
haraken
2014/07/01 04:09:55
Done.
| |
113 'arguments_need_try_catch': arguments_need_try_catch, | 118 'arguments_need_try_catch': arguments_need_try_catch, |
114 'conditional_string': v8_utilities.conditional_string(method), | 119 'conditional_string': v8_utilities.conditional_string(method), |
115 'cpp_type': idl_type.cpp_type, | 120 'cpp_type': idl_type.cpp_type, |
116 'cpp_value': this_cpp_value, | 121 'cpp_value': this_cpp_value, |
117 'custom_registration_extended_attributes': | 122 'custom_registration_extended_attributes': |
118 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( | 123 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( |
119 extended_attributes.iterkeys()), | 124 extended_attributes.iterkeys()), |
120 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] | 125 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] |
121 'function_template': function_template(), | 126 'function_template': function_template(), |
122 'has_custom_registration': is_static or | 127 'has_custom_registration': is_static or |
123 v8_utilities.has_extended_attribute( | 128 v8_utilities.has_extended_attribute( |
124 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), | 129 method, CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES), |
125 'has_exception_state': | 130 'has_exception_state': |
126 is_raises_exception or | 131 is_raises_exception or |
127 is_check_security_for_frame or | 132 is_check_security_for_frame or |
128 interface.name == 'EventTarget' or # FIXME: merge with is_check_sec urity_for_frame http://crbug.com/383699 | 133 interface.name == 'EventTarget' or # FIXME: merge with is_check_sec urity_for_frame http://crbug.com/383699 |
129 any(argument for argument in arguments | 134 any(argument for argument in arguments |
130 if argument.idl_type.name == 'SerializedScriptValue' or | 135 if argument.idl_type.name == 'SerializedScriptValue' or |
131 argument.idl_type.may_raise_exception_on_conversion), | 136 argument.idl_type.may_raise_exception_on_conversion), |
132 'idl_type': idl_type.base_type, | 137 'idl_type': idl_type.base_type, |
133 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'), | 138 'is_call_with_execution_context': has_extended_attribute_value(method, ' CallWith', 'ExecutionContext'), |
134 'is_call_with_script_arguments': is_call_with_script_arguments, | 139 'is_call_with_script_arguments': is_call_with_script_arguments, |
135 'is_call_with_script_state': is_call_with_script_state, | 140 'is_call_with_script_state': is_call_with_script_state, |
136 'is_check_security_for_frame': is_check_security_for_frame, | 141 'is_check_security_for_frame': is_check_security_for_frame, |
137 'is_check_security_for_node': is_check_security_for_node, | 142 'is_check_security_for_node': is_check_security_for_node, |
138 'is_custom': 'Custom' in extended_attributes, | 143 'is_custom': 'Custom' in extended_attributes, |
139 'is_custom_element_callbacks': is_custom_element_callbacks, | 144 'is_custom_element_callbacks': is_custom_element_callbacks, |
140 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, | 145 'is_do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, |
141 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attribute s, | 146 'is_do_not_check_signature': 'DoNotCheckSignature' in extended_attribute s, |
147 'is_implemented_in_private_script': is_implemented_in_private_script, | |
142 'is_partial_interface_member': | 148 'is_partial_interface_member': |
143 'PartialInterfaceImplementedAs' in extended_attributes, | 149 'PartialInterfaceImplementedAs' in extended_attributes, |
144 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, | 150 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, |
145 'is_raises_exception': is_raises_exception, | 151 'is_raises_exception': is_raises_exception, |
146 'is_read_only': 'Unforgeable' in extended_attributes, | 152 'is_read_only': 'Unforgeable' in extended_attributes, |
147 'is_static': is_static, | 153 'is_static': is_static, |
148 'is_variadic': arguments and arguments[-1].is_variadic, | 154 'is_variadic': arguments and arguments[-1].is_variadic, |
149 'measure_as': v8_utilities.measure_as(method), # [MeasureAs] | 155 'measure_as': v8_utilities.measure_as(method), # [MeasureAs] |
150 'name': name, | 156 'name': name, |
151 'number_of_arguments': len(arguments), | 157 'number_of_arguments': len(arguments), |
152 'number_of_required_arguments': len([ | 158 'number_of_required_arguments': len([ |
153 argument for argument in arguments | 159 argument for argument in arguments |
154 if not (argument.is_optional or argument.is_variadic)]), | 160 if not (argument.is_optional or argument.is_variadic)]), |
155 'number_of_required_or_variadic_arguments': len([ | 161 'number_of_required_or_variadic_arguments': len([ |
156 argument for argument in arguments | 162 argument for argument in arguments |
157 if not argument.is_optional]), | 163 if not argument.is_optional]), |
158 'per_context_enabled_function': v8_utilities.per_context_enabled_functio n_name(method), # [PerContextEnabled] | 164 'per_context_enabled_function': v8_utilities.per_context_enabled_functio n_name(method), # [PerContextEnabled] |
159 'property_attributes': property_attributes(method), | 165 'property_attributes': property_attributes(method), |
166 'raw_cpp_type': idl_type.cpp_type_args(raw_type=True), | |
167 'returned_v8_value_to_local_cpp_value': v8_types.v8_value_to_cpp_value( | |
168 idl_type, extended_attributes, 'v8Value', 0, isolate='scriptState->i solate()'), | |
160 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m ethod), # [RuntimeEnabled] | 169 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m ethod), # [RuntimeEnabled] |
161 'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSig nature' in extended_attributes else 'defaultSignature', | 170 'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSig nature' in extended_attributes else 'defaultSignature', |
162 'union_arguments': idl_type.union_arguments, | 171 'union_arguments': idl_type.union_arguments, |
172 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value), | |
163 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True), | 173 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True), |
164 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value), | 174 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended _attributes else [''], # [PerWorldBindings], |
165 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended _attributes else [''], # [PerWorldBindings] | |
166 } | 175 } |
167 | 176 |
168 | 177 |
169 def argument_context(interface, method, argument, index): | 178 def argument_context(interface, method, argument, index): |
170 extended_attributes = argument.extended_attributes | 179 extended_attributes = argument.extended_attributes |
171 idl_type = argument.idl_type | 180 idl_type = argument.idl_type |
172 this_cpp_value = cpp_value(interface, method, index) | 181 this_cpp_value = cpp_value(interface, method, index) |
173 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type | 182 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type |
174 | 183 |
184 if ('ImplementedInPrivateScript' in extended_attributes and | |
185 not idl_type.is_wrapper_type and | |
186 not idl_type.is_basic_type): | |
187 raise Exception('Private scripts supports only primitive types and DOM w rappers.') | |
188 | |
175 return { | 189 return { |
176 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut es, | 190 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut es, |
177 raw_type=True, | 191 raw_type=True, |
178 used_as_variadic_argument=argument.is _variadic), | 192 used_as_variadic_argument=argument.is _variadic), |
179 'cpp_value': this_cpp_value, | 193 'cpp_value': this_cpp_value, |
194 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( | |
195 argument.name, isolate='scriptState->isolate()', | |
196 creation_context='scriptState->context()->Global()'), | |
180 # FIXME: check that the default value's type is compatible with the argu ment's | 197 # FIXME: check that the default value's type is compatible with the argu ment's |
181 'default_value': argument.default_cpp_value, | 198 'default_value': argument.default_cpp_value, |
182 'enum_validation_expression': idl_type.enum_validation_expression, | 199 'enum_validation_expression': idl_type.enum_validation_expression, |
200 'handle': '%sHandle' % argument.name, | |
183 # FIXME: remove once [Default] removed and just use argument.default_val ue | 201 # FIXME: remove once [Default] removed and just use argument.default_val ue |
184 'has_default': 'Default' in extended_attributes or argument.default_valu e, | 202 'has_default': 'Default' in extended_attributes or argument.default_valu e, |
185 'has_type_checking_interface': | 203 'has_type_checking_interface': |
186 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or | 204 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or |
187 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and | 205 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and |
188 idl_type.is_wrapper_type, | 206 idl_type.is_wrapper_type, |
189 'has_type_checking_unrestricted': | 207 'has_type_checking_unrestricted': |
190 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestrict ed') or | 208 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestrict ed') or |
191 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted' )) and | 209 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted' )) and |
192 idl_type.name in ('Float', 'Double'), | 210 idl_type.name in ('Float', 'Double'), |
193 # Dictionary is special-cased, but arrays and sequences shouldn't be | 211 # Dictionary is special-cased, but arrays and sequences shouldn't be |
194 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type, | 212 'idl_type': not idl_type.array_or_sequence_type and idl_type.base_type, |
195 'idl_type_object': idl_type, | 213 'idl_type_object': idl_type, |
196 'index': index, | 214 'index': index, |
197 'is_clamp': 'Clamp' in extended_attributes, | 215 'is_clamp': 'Clamp' in extended_attributes, |
198 'is_callback_interface': idl_type.is_callback_interface, | 216 'is_callback_interface': idl_type.is_callback_interface, |
199 'is_nullable': idl_type.is_nullable, | 217 'is_nullable': idl_type.is_nullable, |
200 'is_optional': argument.is_optional, | 218 'is_optional': argument.is_optional, |
201 'is_variadic_wrapper_type': is_variadic_wrapper_type, | 219 'is_variadic_wrapper_type': is_variadic_wrapper_type, |
202 'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc _type), | 220 'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc _type), |
203 'is_wrapper_type': idl_type.is_wrapper_type, | 221 'is_wrapper_type': idl_type.is_wrapper_type, |
204 'name': argument.name, | 222 'name': argument.name, |
223 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value), | |
205 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True), | 224 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True), |
206 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value), | |
207 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, ind ex), | 225 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, ind ex), |
208 } | 226 } |
209 | 227 |
210 | 228 |
229 def argument_declarations_for_private_script(interface, method): | |
230 argument_declarations = ['LocalFrame* frame'] | |
231 argument_declarations.extend(['%s* holderImpl' % interface.name]) | |
Jens Widell
2014/06/30 18:32:37
Could use append() instead of extend() here, to sa
haraken
2014/07/01 04:09:55
Done.
| |
232 argument_declarations.extend(['%s %s' % (argument.idl_type.cpp_type_args( | |
233 used_as_argument=True), argument.name) for argument in method.arguments] ) | |
234 if method.idl_type.name != 'void': | |
235 argument_declarations.append('%s* %s' % (method.idl_type.cpp_type, 'resu lt')) | |
236 return argument_declarations | |
237 | |
238 | |
211 ################################################################################ | 239 ################################################################################ |
212 # Value handling | 240 # Value handling |
213 ################################################################################ | 241 ################################################################################ |
214 | 242 |
215 def cpp_value(interface, method, number_of_arguments): | 243 def cpp_value(interface, method, number_of_arguments): |
216 def cpp_argument(argument): | 244 def cpp_argument(argument): |
217 idl_type = argument.idl_type | 245 idl_type = argument.idl_type |
218 if idl_type.name == 'EventListener': | 246 if idl_type.name == 'EventListener': |
219 if (interface.name == 'EventTarget' and | 247 if (interface.name == 'EventTarget' and |
220 method.name == 'removeEventListener'): | 248 method.name == 'removeEventListener'): |
221 # FIXME: remove this special case by moving get() into | 249 # FIXME: remove this special case by moving get() into |
222 # EventTarget::removeEventListener | 250 # EventTarget::removeEventListener |
223 return '%s.get()' % argument.name | 251 return '%s.get()' % argument.name |
224 return argument.name | 252 return argument.name |
225 if (idl_type.is_callback_interface or | 253 if (idl_type.is_callback_interface or |
226 idl_type.name in ['NodeFilter', 'NodeFilterOrNull', | 254 idl_type.name in ['NodeFilter', 'NodeFilterOrNull', |
227 'XPathNSResolver', 'XPathNSResolverOrNull']): | 255 'XPathNSResolver', 'XPathNSResolverOrNull']): |
228 # FIXME: remove this special case | 256 # FIXME: remove this special case |
229 return '%s.release()' % argument.name | 257 return '%s.release()' % argument.name |
230 return argument.name | 258 return argument.name |
231 | 259 |
232 # Truncate omitted optional arguments | 260 # Truncate omitted optional arguments |
233 arguments = method.arguments[:number_of_arguments] | 261 arguments = method.arguments[:number_of_arguments] |
234 cpp_arguments = [] | 262 cpp_arguments = [] |
263 if 'ImplementedInPrivateScript' in method.extended_attributes: | |
264 cpp_arguments.append('toFrameIfNotDetached(info.GetIsolate()->GetCurrent Context())') | |
265 cpp_arguments.append('impl') | |
266 | |
235 if method.is_constructor: | 267 if method.is_constructor: |
236 call_with_values = interface.extended_attributes.get('ConstructorCallWit h') | 268 call_with_values = interface.extended_attributes.get('ConstructorCallWit h') |
237 else: | 269 else: |
238 call_with_values = method.extended_attributes.get('CallWith') | 270 call_with_values = method.extended_attributes.get('CallWith') |
239 cpp_arguments.extend(v8_utilities.call_with_arguments(call_with_values)) | 271 cpp_arguments.extend(v8_utilities.call_with_arguments(call_with_values)) |
272 | |
240 # Members of IDL partial interface definitions are implemented in C++ as | 273 # Members of IDL partial interface definitions are implemented in C++ as |
241 # static member functions, which for instance members (non-static members) | 274 # static member functions, which for instance members (non-static members) |
242 # take *impl as their first argument | 275 # take *impl as their first argument |
243 if ('PartialInterfaceImplementedAs' in method.extended_attributes and | 276 if ('PartialInterfaceImplementedAs' in method.extended_attributes and |
244 not method.is_static): | 277 not method.is_static): |
245 cpp_arguments.append('*impl') | 278 cpp_arguments.append('*impl') |
246 cpp_arguments.extend(cpp_argument(argument) for argument in arguments) | 279 cpp_arguments.extend(cpp_argument(argument) for argument in arguments) |
280 | |
247 this_union_arguments = method.idl_type and method.idl_type.union_arguments | 281 this_union_arguments = method.idl_type and method.idl_type.union_arguments |
248 if this_union_arguments: | 282 if this_union_arguments: |
249 cpp_arguments.extend(this_union_arguments) | 283 cpp_arguments.extend(this_union_arguments) |
250 | 284 |
251 if ('RaisesException' in method.extended_attributes or | 285 if 'ImplementedInPrivateScript' in method.extended_attributes: |
286 if method.idl_type.name != 'void': | |
287 cpp_arguments.append('&result') | |
288 elif ('RaisesException' in method.extended_attributes or | |
252 (method.is_constructor and | 289 (method.is_constructor and |
253 has_extended_attribute_value(interface, 'RaisesException', 'Constructor '))): | 290 has_extended_attribute_value(interface, 'RaisesException', 'Constructor '))): |
254 cpp_arguments.append('exceptionState') | 291 cpp_arguments.append('exceptionState') |
255 | 292 |
256 if method.name == 'Constructor': | 293 if method.name == 'Constructor': |
257 base_name = 'create' | 294 base_name = 'create' |
258 elif method.name == 'NamedConstructor': | 295 elif method.name == 'NamedConstructor': |
259 base_name = 'createForJSConstructor' | 296 base_name = 'createForJSConstructor' |
297 elif 'ImplementedInPrivateScript' in method.extended_attributes: | |
298 base_name = '%sMethodImplementedInPrivateScript' % method.name | |
260 else: | 299 else: |
261 base_name = v8_utilities.cpp_name(method) | 300 base_name = v8_utilities.cpp_name(method) |
262 | 301 |
263 cpp_method_name = v8_utilities.scoped_name(interface, method, base_name) | 302 cpp_method_name = v8_utilities.scoped_name(interface, method, base_name) |
264 return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) | 303 return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) |
265 | 304 |
266 | 305 |
267 def v8_set_return_value(interface_name, method, cpp_value, for_main_world=False) : | 306 def v8_set_return_value(interface_name, method, cpp_value, for_main_world=False) : |
268 idl_type = method.idl_type | 307 idl_type = method.idl_type |
269 extended_attributes = method.extended_attributes | 308 extended_attributes = method.extended_attributes |
270 if not idl_type or idl_type.name == 'void': | 309 if not idl_type or idl_type.name == 'void': |
271 # Constructors and void methods don't have a return type | 310 # Constructors and void methods don't have a return type |
272 return None | 311 return None |
273 | 312 |
313 if ('ImplementedInPrivateScript' in extended_attributes and | |
314 not idl_type.is_wrapper_type and | |
315 not idl_type.is_basic_type): | |
316 raise Exception('Private scripts supports only primitive types and DOM w rappers.') | |
317 | |
274 release = False | 318 release = False |
275 # [CallWith=ScriptState], [RaisesException] | 319 # [CallWith=ScriptState], [RaisesException] |
276 if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or | 320 if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or |
321 'ImplementedInPrivateScript' in extended_attributes or | |
277 'RaisesException' in extended_attributes or | 322 'RaisesException' in extended_attributes or |
278 idl_type.is_union_type): | 323 idl_type.is_union_type): |
279 cpp_value = 'result' # use local variable for value | 324 cpp_value = 'result' # use local variable for value |
280 release = idl_type.release | 325 release = idl_type.release |
281 | 326 |
282 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else '' | 327 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else '' |
283 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w rappable=script_wrappable, release=release, for_main_world=for_main_world) | 328 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w rappable=script_wrappable, release=release, for_main_world=for_main_world) |
284 | 329 |
285 | 330 |
286 def v8_value_to_local_cpp_variadic_value(argument, index): | 331 def v8_value_to_local_cpp_variadic_value(argument, index): |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
331 | 376 |
332 | 377 |
333 def argument_default_cpp_value(argument): | 378 def argument_default_cpp_value(argument): |
334 if not argument.default_value: | 379 if not argument.default_value: |
335 return None | 380 return None |
336 return argument.idl_type.literal_cpp_value(argument.default_value) | 381 return argument.idl_type.literal_cpp_value(argument.default_value) |
337 | 382 |
338 IdlType.union_arguments = property(lambda self: None) | 383 IdlType.union_arguments = property(lambda self: None) |
339 IdlUnionType.union_arguments = property(union_arguments) | 384 IdlUnionType.union_arguments = property(union_arguments) |
340 IdlArgument.default_cpp_value = property(argument_default_cpp_value) | 385 IdlArgument.default_cpp_value = property(argument_default_cpp_value) |
OLD | NEW |