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

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

Issue 470063003: IDL: Use IdlArrayOrSequenceType for array/sequence IDL types (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@idl-extend-IdlTypeBase
Patch Set: Created 6 years, 4 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 'property_attributes': property_attributes(attribute), 133 'property_attributes': property_attributes(attribute),
134 'put_forwards': 'PutForwards' in extended_attributes, 134 'put_forwards': 'PutForwards' in extended_attributes,
135 'reflect_empty': extended_attributes.get('ReflectEmpty'), 135 'reflect_empty': extended_attributes.get('ReflectEmpty'),
136 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''), 136 'reflect_invalid': extended_attributes.get('ReflectInvalid', ''),
137 'reflect_missing': extended_attributes.get('ReflectMissing'), 137 'reflect_missing': extended_attributes.get('ReflectMissing'),
138 'reflect_only': extended_attributes['ReflectOnly'].split('|') 138 'reflect_only': extended_attributes['ReflectOnly'].split('|')
139 if 'ReflectOnly' in extended_attributes else None, 139 if 'ReflectOnly' in extended_attributes else None,
140 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a ttribute), # [RuntimeEnabled] 140 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(a ttribute), # [RuntimeEnabled]
141 'setter_callback': setter_callback_name(interface, attribute), 141 'setter_callback': setter_callback_name(interface, attribute),
142 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script), 142 'should_be_exposed_to_script': not (is_implemented_in_private_script and is_only_exposed_to_private_script),
143 'v8_type': v8_types.v8_type(base_idl_type), 143 'v8_type': v8_types.v8_type(base_idl_type) if idl_type.is_interface_type else None,
Nils Barth (inactive) 2014/08/14 14:24:44 Is this worth taking onto IdlType(Base)? IdlType(B
Jens Widell 2014/08/14 15:02:55 Can't think of a reason not to. :-)
144 'world_suffixes': ['', 'ForMainWorld'] 144 'world_suffixes': ['', 'ForMainWorld']
145 if 'PerWorldBindings' in extended_attributes 145 if 'PerWorldBindings' in extended_attributes
146 else [''], # [PerWorldBindings] 146 else [''], # [PerWorldBindings]
147 } 147 }
148 148
149 if is_constructor_attribute(attribute): 149 if is_constructor_attribute(attribute):
150 constructor_getter_context(interface, attribute, context) 150 constructor_getter_context(interface, attribute, context)
151 return context 151 return context
152 if not has_custom_getter(attribute): 152 if not has_custom_getter(attribute):
153 getter_context(interface, attribute, context) 153 getter_context(interface, attribute, context)
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 elif idl_type.base_type == 'EventHandler': 368 elif idl_type.base_type == 'EventHandler':
369 getter_name = scoped_name(interface, attribute, cpp_name(attribute)) 369 getter_name = scoped_name(interface, attribute, cpp_name(attribute))
370 context['event_handler_getter_expression'] = '%s(%s)' % ( 370 context['event_handler_getter_expression'] = '%s(%s)' % (
371 getter_name, ', '.join(arguments)) 371 getter_name, ', '.join(arguments))
372 if (interface.name in ['Window', 'WorkerGlobalScope'] and 372 if (interface.name in ['Window', 'WorkerGlobalScope'] and
373 attribute.name == 'onerror'): 373 attribute.name == 'onerror'):
374 includes.add('bindings/core/v8/V8ErrorHandler.h') 374 includes.add('bindings/core/v8/V8ErrorHandler.h')
375 arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHa ndler>(v8Value, true, ScriptState::current(info.GetIsolate()))') 375 arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHa ndler>(v8Value, true, ScriptState::current(info.GetIsolate()))')
376 else: 376 else:
377 arguments.append('V8EventListenerList::getEventListener(ScriptState: :current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)') 377 arguments.append('V8EventListenerList::getEventListener(ScriptState: :current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)')
378 elif idl_type.is_interface_type and not idl_type.array_element_type: 378 elif idl_type.is_interface_type:
379 # FIXME: should be able to eliminate WTF::getPtr in most or all cases 379 # FIXME: should be able to eliminate WTF::getPtr in most or all cases
380 arguments.append('WTF::getPtr(cppValue)') 380 arguments.append('WTF::getPtr(cppValue)')
381 else: 381 else:
382 arguments.append('cppValue') 382 arguments.append('cppValue')
383 if context['is_setter_raises_exception']: 383 if context['is_setter_raises_exception']:
384 arguments.append('exceptionState') 384 arguments.append('exceptionState')
385 385
386 return '%s(%s)' % (setter_name, ', '.join(arguments)) 386 return '%s(%s)' % (setter_name, ', '.join(arguments))
387 387
388 388
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 # Constructors 489 # Constructors
490 ################################################################################ 490 ################################################################################
491 491
492 idl_types.IdlType.constructor_type_name = property( 492 idl_types.IdlType.constructor_type_name = property(
493 # FIXME: replace this with a [ConstructorAttribute] extended attribute 493 # FIXME: replace this with a [ConstructorAttribute] extended attribute
494 lambda self: strip_suffix(self.base_type, 'Constructor')) 494 lambda self: strip_suffix(self.base_type, 'Constructor'))
495 495
496 496
497 def is_constructor_attribute(attribute): 497 def is_constructor_attribute(attribute):
498 # FIXME: replace this with [ConstructorAttribute] extended attribute 498 # FIXME: replace this with [ConstructorAttribute] extended attribute
499 return attribute.idl_type.base_type.endswith('Constructor') 499 return attribute.idl_type.name.endswith('Constructor')
Jens Widell 2014/08/14 13:56:50 Changed since base_type is sometimes None (more of
Nils Barth (inactive) 2014/08/14 14:24:44 Acknowledged; [ConstructorAttribute] is another lo
500 500
501 501
502 def constructor_getter_context(interface, attribute, context): 502 def constructor_getter_context(interface, attribute, context):
503 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 503 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698