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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
279 context['cpp_value_original'] = cpp_value | 279 context['cpp_value_original'] = cpp_value |
280 cpp_value = 'cppValue' | 280 cpp_value = 'cppValue' |
281 | 281 |
282 def v8_set_return_value_statement(for_main_world=False): | 282 def v8_set_return_value_statement(for_main_world=False): |
283 if context['is_keep_alive_for_gc'] or 'CachedAttribute' in extended_attr
ibutes: | 283 if context['is_keep_alive_for_gc'] or 'CachedAttribute' in extended_attr
ibutes: |
284 return 'V8SetReturnValue(info, v8Value)' | 284 return 'V8SetReturnValue(info, v8Value)' |
285 return idl_type.v8_set_return_value( | 285 return idl_type.v8_set_return_value( |
286 cpp_value, extended_attributes=extended_attributes, script_wrappable
='impl', | 286 cpp_value, extended_attributes=extended_attributes, script_wrappable
='impl', |
287 for_main_world=for_main_world, is_static=attribute.is_static) | 287 for_main_world=for_main_world, is_static=attribute.is_static) |
288 | 288 |
289 cpp_value_to_script_wrappable = cpp_value | |
290 if idl_type.is_array_buffer_view_or_typed_array: | |
291 cpp_value_to_script_wrappable += '.View()' | |
292 | |
293 context.update({ | 289 context.update({ |
294 'cpp_value': cpp_value, | 290 'cpp_value': cpp_value, |
295 'cpp_value_to_script_wrappable': cpp_value_to_script_wrappable, | |
296 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( | 291 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( |
297 cpp_value=cpp_value, creation_context='holder', | 292 cpp_value=cpp_value, creation_context='holder', |
298 extended_attributes=extended_attributes), | 293 extended_attributes=extended_attributes), |
299 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_
main_world=True), | 294 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_
main_world=True), |
300 'v8_set_return_value': v8_set_return_value_statement(), | 295 'v8_set_return_value': v8_set_return_value_statement(), |
301 }) | 296 }) |
302 | 297 |
303 def getter_expression(interface, attribute, context): | 298 def getter_expression(interface, attribute, context): |
304 arguments = [] | 299 arguments = [] |
305 this_getter_base_name = getter_base_name(interface, attribute, arguments) | 300 this_getter_base_name = getter_base_name(interface, attribute, arguments) |
(...skipping 10 matching lines...) Expand all Loading... |
316 if attribute.idl_type.is_explicit_nullable: | 311 if attribute.idl_type.is_explicit_nullable: |
317 arguments.append('isNull') | 312 arguments.append('isNull') |
318 if context['is_getter_raises_exception']: | 313 if context['is_getter_raises_exception']: |
319 arguments.append('exceptionState') | 314 arguments.append('exceptionState') |
320 if attribute.idl_type.use_output_parameter_for_result: | 315 if attribute.idl_type.use_output_parameter_for_result: |
321 arguments.append('result') | 316 arguments.append('result') |
322 | 317 |
323 expression = '%s(%s)' % (getter_name, ', '.join(arguments)) | 318 expression = '%s(%s)' % (getter_name, ', '.join(arguments)) |
324 # Needed to handle getter expressions returning Type& as the | 319 # Needed to handle getter expressions returning Type& as the |
325 # use site for |expression| expects Type*. | 320 # use site for |expression| expects Type*. |
326 if (attribute.idl_type.is_interface_type and len(arguments) == 0 and | 321 if attribute.idl_type.is_interface_type and len(arguments) == 0: |
327 not attribute.idl_type.is_array_buffer_view_or_typed_array): | |
328 return 'WTF::GetPtr(%s)' % expression | 322 return 'WTF::GetPtr(%s)' % expression |
329 return expression | 323 return expression |
330 | 324 |
331 | 325 |
332 CONTENT_ATTRIBUTE_GETTER_NAMES = { | 326 CONTENT_ATTRIBUTE_GETTER_NAMES = { |
333 'boolean': 'FastHasAttribute', | 327 'boolean': 'FastHasAttribute', |
334 'long': 'GetIntegralAttribute', | 328 'long': 'GetIntegralAttribute', |
335 'unsigned long': 'GetUnsignedIntegralAttribute', | 329 'unsigned long': 'GetUnsignedIntegralAttribute', |
336 } | 330 } |
337 | 331 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 def is_constructor_attribute(attribute): | 564 def is_constructor_attribute(attribute): |
571 return attribute.idl_type.name.endswith('Constructor') | 565 return attribute.idl_type.name.endswith('Constructor') |
572 | 566 |
573 | 567 |
574 def is_named_constructor_attribute(attribute): | 568 def is_named_constructor_attribute(attribute): |
575 return attribute.idl_type.name.endswith('ConstructorConstructor') | 569 return attribute.idl_type.name.endswith('ConstructorConstructor') |
576 | 570 |
577 | 571 |
578 def update_constructor_attribute_context(interface, attribute, context): | 572 def update_constructor_attribute_context(interface, attribute, context): |
579 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 573 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
OLD | NEW |