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