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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 348 |
349 | 349 |
350 ################################################################################ | 350 ################################################################################ |
351 # Attribute configuration | 351 # Attribute configuration |
352 ################################################################################ | 352 ################################################################################ |
353 | 353 |
354 # [Replaceable] | 354 # [Replaceable] |
355 def setter_callback_name(interface, attribute): | 355 def setter_callback_name(interface, attribute): |
356 cpp_class_name = cpp_name(interface) | 356 cpp_class_name = cpp_name(interface) |
357 extended_attributes = attribute.extended_attributes | 357 extended_attributes = attribute.extended_attributes |
358 if ('Replaceable' in extended_attributes or | 358 if (('Replaceable' in extended_attributes and |
| 359 'PutForwards' not in extended_attributes) or |
359 is_constructor_attribute(attribute)): | 360 is_constructor_attribute(attribute)): |
360 # FIXME: rename to ForceSetAttributeOnThisCallback, since also used for
Constructors | 361 # FIXME: rename to ForceSetAttributeOnThisCallback, since also used for
Constructors |
361 return '{0}V8Internal::{0}ReplaceableAttributeSetterCallback'.format(cpp
_class_name) | 362 return '{0}V8Internal::{0}ReplaceableAttributeSetterCallback'.format(cpp
_class_name) |
362 if attribute.is_read_only and 'PutForwards' not in extended_attributes: | 363 if attribute.is_read_only and 'PutForwards' not in extended_attributes: |
363 return '0' | 364 return '0' |
364 return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name, attribut
e.name) | 365 return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name, attribut
e.name) |
365 | 366 |
366 | 367 |
367 # [DoNotCheckSecurity], [Unforgeable] | 368 # [DoNotCheckSecurity], [Unforgeable] |
368 def access_control_list(attribute): | 369 def access_control_list(attribute): |
369 extended_attributes = attribute.extended_attributes | 370 extended_attributes = attribute.extended_attributes |
370 access_control = [] | 371 access_control = [] |
371 if 'DoNotCheckSecurity' in extended_attributes: | 372 if 'DoNotCheckSecurity' in extended_attributes: |
372 do_not_check_security = extended_attributes['DoNotCheckSecurity'] | 373 do_not_check_security = extended_attributes['DoNotCheckSecurity'] |
373 if do_not_check_security == 'Setter': | 374 if do_not_check_security == 'Setter': |
374 access_control.append('v8::ALL_CAN_WRITE') | 375 access_control.append('v8::ALL_CAN_WRITE') |
375 else: | 376 else: |
376 access_control.append('v8::ALL_CAN_READ') | 377 access_control.append('v8::ALL_CAN_READ') |
377 if not attribute.is_read_only: | 378 if (not attribute.is_read_only or |
| 379 'Replaceable' in extended_attributes): |
378 access_control.append('v8::ALL_CAN_WRITE') | 380 access_control.append('v8::ALL_CAN_WRITE') |
379 if 'Unforgeable' in extended_attributes: | 381 if 'Unforgeable' in extended_attributes: |
380 access_control.append('v8::PROHIBITS_OVERWRITING') | 382 access_control.append('v8::PROHIBITS_OVERWRITING') |
381 return access_control or ['v8::DEFAULT'] | 383 return access_control or ['v8::DEFAULT'] |
382 | 384 |
383 | 385 |
384 # [NotEnumerable], [Unforgeable] | 386 # [NotEnumerable], [Unforgeable] |
385 def property_attributes(attribute): | 387 def property_attributes(attribute): |
386 extended_attributes = attribute.extended_attributes | 388 extended_attributes = attribute.extended_attributes |
387 property_attributes_list = [] | 389 property_attributes_list = [] |
388 if ('NotEnumerable' in extended_attributes or | 390 if ('NotEnumerable' in extended_attributes or |
389 is_constructor_attribute(attribute)): | 391 is_constructor_attribute(attribute)): |
390 property_attributes_list.append('v8::DontEnum') | 392 property_attributes_list.append('v8::DontEnum') |
391 if 'Unforgeable' in extended_attributes: | 393 if 'Unforgeable' in extended_attributes: |
392 property_attributes_list.append('v8::DontDelete') | 394 property_attributes_list.append('v8::DontDelete') |
393 return property_attributes_list or ['v8::None'] | 395 return property_attributes_list or ['v8::None'] |
394 | 396 |
395 | 397 |
396 ################################################################################ | 398 ################################################################################ |
397 # Constructors | 399 # Constructors |
398 ################################################################################ | 400 ################################################################################ |
399 | 401 |
400 def is_constructor_attribute(attribute): | 402 def is_constructor_attribute(attribute): |
401 return attribute.idl_type.endswith('Constructor') | 403 return attribute.idl_type.endswith('Constructor') |
OLD | NEW |