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

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

Issue 704503002: IDL: Union type support for attributes (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@union-arraybuffer
Patch Set: Created 6 years, 1 month 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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 'is_explicit_nullable': idl_type.is_explicit_nullable, 118 'is_explicit_nullable': idl_type.is_explicit_nullable,
119 'is_partial_interface_member': 119 'is_partial_interface_member':
120 'PartialInterfaceImplementedAs' in extended_attributes, 120 'PartialInterfaceImplementedAs' in extended_attributes,
121 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, 121 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes,
122 'is_read_only': attribute.is_read_only, 122 'is_read_only': attribute.is_read_only,
123 'is_reflect': is_reflect, 123 'is_reflect': is_reflect,
124 'is_replaceable': 'Replaceable' in attribute.extended_attributes, 124 'is_replaceable': 'Replaceable' in attribute.extended_attributes,
125 'is_static': attribute.is_static, 125 'is_static': attribute.is_static,
126 'is_url': 'URL' in extended_attributes, 126 'is_url': 'URL' in extended_attributes,
127 'is_unforgeable': 'Unforgeable' in extended_attributes, 127 'is_unforgeable': 'Unforgeable' in extended_attributes,
128 'is_union_type': idl_type.is_union_type,
128 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs] 129 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs]
129 'name': attribute.name, 130 'name': attribute.name,
130 'only_exposed_to_private_script': is_only_exposed_to_private_script, 131 'only_exposed_to_private_script': is_only_exposed_to_private_script,
131 'per_context_enabled_function': v8_utilities.per_context_enabled_functio n_name(attribute), # [PerContextEnabled] 132 'per_context_enabled_function': v8_utilities.per_context_enabled_functio n_name(attribute), # [PerContextEnabled]
132 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value( 133 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local _cpp_value(
133 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', used_in_private_script=True), 134 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is olate()', used_in_private_script=True),
134 'property_attributes': property_attributes(attribute), 135 'property_attributes': property_attributes(attribute),
135 'put_forwards': 'PutForwards' in extended_attributes, 136 'put_forwards': 'PutForwards' in extended_attributes,
136 'reflect_empty': extended_attributes.get('ReflectEmpty'), 137 'reflect_empty': extended_attributes.get('ReflectEmpty'),
137 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), 138 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''),
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
227 # static member functions, which for instance members (non-static members) 228 # static member functions, which for instance members (non-static members)
228 # take *impl as their first argument 229 # take *impl as their first argument
229 if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and 230 if ('PartialInterfaceImplementedAs' in attribute.extended_attributes and
230 not 'ImplementedInPrivateScript' in attribute.extended_attributes and 231 not 'ImplementedInPrivateScript' in attribute.extended_attributes and
231 not attribute.is_static): 232 not attribute.is_static):
232 arguments.append('*impl') 233 arguments.append('*impl')
233 if attribute.idl_type.is_explicit_nullable: 234 if attribute.idl_type.is_explicit_nullable:
234 arguments.append('isNull') 235 arguments.append('isNull')
235 if context['is_getter_raises_exception']: 236 if context['is_getter_raises_exception']:
236 arguments.append('exceptionState') 237 arguments.append('exceptionState')
238 # Union type attribute getters take impl class object as the last argument
239 # and set value to it, not returning the value.
240 if attribute.idl_type.is_union_type:
241 arguments.append('result')
237 return '%s(%s)' % (getter_name, ', '.join(arguments)) 242 return '%s(%s)' % (getter_name, ', '.join(arguments))
238 243
239 244
240 CONTENT_ATTRIBUTE_GETTER_NAMES = { 245 CONTENT_ATTRIBUTE_GETTER_NAMES = {
241 'boolean': 'fastHasAttribute', 246 'boolean': 'fastHasAttribute',
242 'long': 'getIntegralAttribute', 247 'long': 'getIntegralAttribute',
243 'unsigned long': 'getUnsignedIntegralAttribute', 248 'unsigned long': 'getUnsignedIntegralAttribute',
244 } 249 }
245 250
246 251
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 lambda self: strip_suffix(self.base_type, 'Constructor')) 506 lambda self: strip_suffix(self.base_type, 'Constructor'))
502 507
503 508
504 def is_constructor_attribute(attribute): 509 def is_constructor_attribute(attribute):
505 # FIXME: replace this with [ConstructorAttribute] extended attribute 510 # FIXME: replace this with [ConstructorAttribute] extended attribute
506 return attribute.idl_type.name.endswith('Constructor') 511 return attribute.idl_type.name.endswith('Constructor')
507 512
508 513
509 def constructor_getter_context(interface, attribute, context): 514 def constructor_getter_context(interface, attribute, context):
510 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 515 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698