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

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

Issue 618373003: [bindings] partial interfaces should not violate componentization (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed patch conflict Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/scripts/utilities.py ('k') | Source/bindings/scripts/v8_interface.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 20 matching lines...) Expand all
31 Extends IdlType with property |constructor_type_name|. 31 Extends IdlType with property |constructor_type_name|.
32 32
33 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler 33 Design doc: http://www.chromium.org/developers/design-documents/idl-compiler
34 """ 34 """
35 35
36 import idl_types 36 import idl_types
37 from idl_types import inherits_interface 37 from idl_types import inherits_interface
38 from v8_globals import includes, interfaces 38 from v8_globals import includes, interfaces
39 import v8_types 39 import v8_types
40 import v8_utilities 40 import v8_utilities
41 from v8_utilities import (capitalize, cpp_name, has_extended_attribute, 41 from v8_utilities import (cpp_name_or_partial, capitalize, cpp_name, has_extende d_attribute,
42 has_extended_attribute_value, scoped_name, strip_suffi x, 42 has_extended_attribute_value, scoped_name, strip_suffi x,
43 uncapitalize, extended_attribute_value_as_list) 43 uncapitalize, extended_attribute_value_as_list)
44 44
45 45
46 def attribute_context(interface, attribute): 46 def attribute_context(interface, attribute):
47 idl_type = attribute.idl_type 47 idl_type = attribute.idl_type
48 base_idl_type = idl_type.base_type 48 base_idl_type = idl_type.base_type
49 extended_attributes = attribute.extended_attributes 49 extended_attributes = attribute.extended_attributes
50 50
51 idl_type.add_includes_for_type() 51 idl_type.add_includes_for_type()
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 return '%s::%sAttr' % (namespace, content_attribute_name) 427 return '%s::%sAttr' % (namespace, content_attribute_name)
428 428
429 429
430 ################################################################################ 430 ################################################################################
431 # Attribute configuration 431 # Attribute configuration
432 ################################################################################ 432 ################################################################################
433 433
434 # [Replaceable] 434 # [Replaceable]
435 def setter_callback_name(interface, attribute): 435 def setter_callback_name(interface, attribute):
436 cpp_class_name = cpp_name(interface) 436 cpp_class_name = cpp_name(interface)
437 cpp_class_name_or_partial = cpp_name_or_partial(interface)
438
437 extended_attributes = attribute.extended_attributes 439 extended_attributes = attribute.extended_attributes
438 if (('Replaceable' in extended_attributes and 440 if (('Replaceable' in extended_attributes and
439 'PutForwards' not in extended_attributes) or 441 'PutForwards' not in extended_attributes) or
440 is_constructor_attribute(attribute)): 442 is_constructor_attribute(attribute)):
441 return '{0}V8Internal::{0}ForceSetAttributeOnThisCallback'.format(cpp_cl ass_name) 443 return '%sV8Internal::%sForceSetAttributeOnThisCallback' % (
444 cpp_class_name_or_partial, cpp_class_name)
442 if attribute.is_read_only and 'PutForwards' not in extended_attributes: 445 if attribute.is_read_only and 'PutForwards' not in extended_attributes:
443 return '0' 446 return '0'
444 return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name, attribut e.name) 447 return '%sV8Internal::%sAttributeSetterCallback' % (cpp_class_name_or_partia l, attribute.name)
445 448
446 449
447 # [DoNotCheckSecurity], [Unforgeable] 450 # [DoNotCheckSecurity], [Unforgeable]
448 def access_control_list(attribute): 451 def access_control_list(attribute):
449 extended_attributes = attribute.extended_attributes 452 extended_attributes = attribute.extended_attributes
450 access_control = [] 453 access_control = []
451 if 'DoNotCheckSecurity' in extended_attributes: 454 if 'DoNotCheckSecurity' in extended_attributes:
452 do_not_check_security = extended_attributes['DoNotCheckSecurity'] 455 do_not_check_security = extended_attributes['DoNotCheckSecurity']
453 if do_not_check_security == 'Setter': 456 if do_not_check_security == 'Setter':
454 access_control.append('v8::ALL_CAN_WRITE') 457 access_control.append('v8::ALL_CAN_WRITE')
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 lambda self: strip_suffix(self.base_type, 'Constructor')) 501 lambda self: strip_suffix(self.base_type, 'Constructor'))
499 502
500 503
501 def is_constructor_attribute(attribute): 504 def is_constructor_attribute(attribute):
502 # FIXME: replace this with [ConstructorAttribute] extended attribute 505 # FIXME: replace this with [ConstructorAttribute] extended attribute
503 return attribute.idl_type.name.endswith('Constructor') 506 return attribute.idl_type.name.endswith('Constructor')
504 507
505 508
506 def constructor_getter_context(interface, attribute, context): 509 def constructor_getter_context(interface, attribute, context):
507 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 510 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
OLDNEW
« no previous file with comments | « Source/bindings/scripts/utilities.py ('k') | Source/bindings/scripts/v8_interface.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698