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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/v8_attributes.py

Issue 2707243006: [SharedArrayBuffer] Prevent SharedArrayBuffer being used in Web APIs (Closed)
Patch Set: update comment, add TODO Created 3 years, 8 months 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
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 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
289 context.update({ 293 context.update({
290 'cpp_value': cpp_value, 294 'cpp_value': cpp_value,
295 'cpp_value_to_script_wrappable': cpp_value_to_script_wrappable,
291 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( 296 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(
292 cpp_value=cpp_value, creation_context='holder', 297 cpp_value=cpp_value, creation_context='holder',
293 extended_attributes=extended_attributes), 298 extended_attributes=extended_attributes),
294 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_ main_world=True), 299 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_ main_world=True),
295 'v8_set_return_value': v8_set_return_value_statement(), 300 'v8_set_return_value': v8_set_return_value_statement(),
296 }) 301 })
297 302
298 def getter_expression(interface, attribute, context): 303 def getter_expression(interface, attribute, context):
299 arguments = [] 304 arguments = []
300 this_getter_base_name = getter_base_name(interface, attribute, arguments) 305 this_getter_base_name = getter_base_name(interface, attribute, arguments)
(...skipping 10 matching lines...) Expand all
311 if attribute.idl_type.is_explicit_nullable: 316 if attribute.idl_type.is_explicit_nullable:
312 arguments.append('isNull') 317 arguments.append('isNull')
313 if context['is_getter_raises_exception']: 318 if context['is_getter_raises_exception']:
314 arguments.append('exceptionState') 319 arguments.append('exceptionState')
315 if attribute.idl_type.use_output_parameter_for_result: 320 if attribute.idl_type.use_output_parameter_for_result:
316 arguments.append('result') 321 arguments.append('result')
317 322
318 expression = '%s(%s)' % (getter_name, ', '.join(arguments)) 323 expression = '%s(%s)' % (getter_name, ', '.join(arguments))
319 # Needed to handle getter expressions returning Type& as the 324 # Needed to handle getter expressions returning Type& as the
320 # use site for |expression| expects Type*. 325 # use site for |expression| expects Type*.
321 if attribute.idl_type.is_interface_type and len(arguments) == 0: 326 if (attribute.idl_type.is_interface_type and len(arguments) == 0 and
327 not attribute.idl_type.is_array_buffer_view_or_typed_array):
322 return 'WTF::GetPtr(%s)' % expression 328 return 'WTF::GetPtr(%s)' % expression
323 return expression 329 return expression
324 330
325 331
326 CONTENT_ATTRIBUTE_GETTER_NAMES = { 332 CONTENT_ATTRIBUTE_GETTER_NAMES = {
327 'boolean': 'FastHasAttribute', 333 'boolean': 'FastHasAttribute',
328 'long': 'GetIntegralAttribute', 334 'long': 'GetIntegralAttribute',
329 'unsigned long': 'GetUnsignedIntegralAttribute', 335 'unsigned long': 'GetUnsignedIntegralAttribute',
330 } 336 }
331 337
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 def is_constructor_attribute(attribute): 570 def is_constructor_attribute(attribute):
565 return attribute.idl_type.name.endswith('Constructor') 571 return attribute.idl_type.name.endswith('Constructor')
566 572
567 573
568 def is_named_constructor_attribute(attribute): 574 def is_named_constructor_attribute(attribute):
569 return attribute.idl_type.name.endswith('ConstructorConstructor') 575 return attribute.idl_type.name.endswith('ConstructorConstructor')
570 576
571 577
572 def update_constructor_attribute_context(interface, attribute, context): 578 def update_constructor_attribute_context(interface, attribute, context):
573 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 579 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8Binding.h ('k') | third_party/WebKit/Source/bindings/scripts/v8_dictionary.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698