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

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

Issue 1153613007: bindings: Use CreateDataProperty() instead of ForceSet() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 6 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 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 attribute = next(candidate 318 attribute = next(candidate
319 for candidate in interface.attributes 319 for candidate in interface.attributes
320 if candidate.name == target_attribute_name) 320 if candidate.name == target_attribute_name)
321 except StopIteration: 321 except StopIteration:
322 raise Exception('[PutForward] target not found:\n' 322 raise Exception('[PutForward] target not found:\n'
323 'Attribute "%s" is not present in interface "%s"' % 323 'Attribute "%s" is not present in interface "%s"' %
324 (target_attribute_name, target_interface_name)) 324 (target_attribute_name, target_interface_name))
325 325
326 if ('Replaceable' in attribute.extended_attributes or 326 if ('Replaceable' in attribute.extended_attributes or
327 is_constructor_attribute(attribute)): 327 is_constructor_attribute(attribute)):
328 context['cpp_setter'] = '%sForceSetAttributeOnThis(propertyName, v8Value , info)' % cpp_name(interface) 328 context['cpp_setter'] = '%sCreateDataProperty(propertyName, v8Value, inf o)' % cpp_name(interface)
329 return 329 return
330 330
331 extended_attributes = attribute.extended_attributes 331 extended_attributes = attribute.extended_attributes
332 idl_type = attribute.idl_type 332 idl_type = attribute.idl_type
333 333
334 # [RaisesException], [RaisesException=Setter] 334 # [RaisesException], [RaisesException=Setter]
335 is_setter_raises_exception = ( 335 is_setter_raises_exception = (
336 'RaisesException' in extended_attributes and 336 'RaisesException' in extended_attributes and
337 extended_attributes['RaisesException'] in [None, 'Setter']) 337 extended_attributes['RaisesException'] in [None, 'Setter'])
338 # [TypeChecking=Interface] / [LegacyInterfaceTypeChecking] 338 # [TypeChecking=Interface] / [LegacyInterfaceTypeChecking]
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 return attribute.idl_type.name.endswith('Constructor') 541 return attribute.idl_type.name.endswith('Constructor')
542 542
543 543
544 def update_constructor_attribute_context(interface, attribute, context): 544 def update_constructor_attribute_context(interface, attribute, context):
545 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 545 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
546 # When the attribute name is the same as the interface name, do not generate 546 # When the attribute name is the same as the interface name, do not generate
547 # callback functions for each attribute and use 547 # callback functions for each attribute and use
548 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate 548 # {{cpp_class}}ConstructorAttributeSetterCallback. Otherwise, generate
549 # a callback function in order to hard-code the attribute name. 549 # a callback function in order to hard-code the attribute name.
550 context['needs_constructor_setter_callback'] = context['name'] != context['c onstructor_type'] 550 context['needs_constructor_setter_callback'] = context['name'] != context['c onstructor_type']
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698