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

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: simplify cpp_type_has_null_value() 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
« no previous file with comments | « Source/bindings/scripts/idl_types.py ('k') | Source/bindings/scripts/v8_dictionary.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 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),
144 'world_suffixes': ['', 'ForMainWorld'] 143 'world_suffixes': ['', 'ForMainWorld']
145 if 'PerWorldBindings' in extended_attributes 144 if 'PerWorldBindings' in extended_attributes
146 else [''], # [PerWorldBindings] 145 else [''], # [PerWorldBindings]
147 } 146 }
148 147
149 if is_constructor_attribute(attribute): 148 if is_constructor_attribute(attribute):
150 constructor_getter_context(interface, attribute, context) 149 constructor_getter_context(interface, attribute, context)
151 return context 150 return context
152 if not has_custom_getter(attribute): 151 if not has_custom_getter(attribute):
153 getter_context(interface, attribute, context) 152 getter_context(interface, attribute, context)
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
368 elif idl_type.base_type == 'EventHandler': 367 elif idl_type.base_type == 'EventHandler':
369 getter_name = scoped_name(interface, attribute, cpp_name(attribute)) 368 getter_name = scoped_name(interface, attribute, cpp_name(attribute))
370 context['event_handler_getter_expression'] = '%s(%s)' % ( 369 context['event_handler_getter_expression'] = '%s(%s)' % (
371 getter_name, ', '.join(arguments)) 370 getter_name, ', '.join(arguments))
372 if (interface.name in ['Window', 'WorkerGlobalScope'] and 371 if (interface.name in ['Window', 'WorkerGlobalScope'] and
373 attribute.name == 'onerror'): 372 attribute.name == 'onerror'):
374 includes.add('bindings/core/v8/V8ErrorHandler.h') 373 includes.add('bindings/core/v8/V8ErrorHandler.h')
375 arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHa ndler>(v8Value, true, ScriptState::current(info.GetIsolate()))') 374 arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHa ndler>(v8Value, true, ScriptState::current(info.GetIsolate()))')
376 else: 375 else:
377 arguments.append('V8EventListenerList::getEventListener(ScriptState: :current(info.GetIsolate()), v8Value, true, ListenerFindOrCreate)') 376 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: 377 elif idl_type.is_interface_type:
379 # FIXME: should be able to eliminate WTF::getPtr in most or all cases 378 # FIXME: should be able to eliminate WTF::getPtr in most or all cases
380 arguments.append('WTF::getPtr(cppValue)') 379 arguments.append('WTF::getPtr(cppValue)')
381 else: 380 else:
382 arguments.append('cppValue') 381 arguments.append('cppValue')
383 if context['is_setter_raises_exception']: 382 if context['is_setter_raises_exception']:
384 arguments.append('exceptionState') 383 arguments.append('exceptionState')
385 384
386 return '%s(%s)' % (setter_name, ', '.join(arguments)) 385 return '%s(%s)' % (setter_name, ', '.join(arguments))
387 386
388 387
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 # Constructors 488 # Constructors
490 ################################################################################ 489 ################################################################################
491 490
492 idl_types.IdlType.constructor_type_name = property( 491 idl_types.IdlType.constructor_type_name = property(
493 # FIXME: replace this with a [ConstructorAttribute] extended attribute 492 # FIXME: replace this with a [ConstructorAttribute] extended attribute
494 lambda self: strip_suffix(self.base_type, 'Constructor')) 493 lambda self: strip_suffix(self.base_type, 'Constructor'))
495 494
496 495
497 def is_constructor_attribute(attribute): 496 def is_constructor_attribute(attribute):
498 # FIXME: replace this with [ConstructorAttribute] extended attribute 497 # FIXME: replace this with [ConstructorAttribute] extended attribute
499 return attribute.idl_type.base_type.endswith('Constructor') 498 return attribute.idl_type.name.endswith('Constructor')
500 499
501 500
502 def constructor_getter_context(interface, attribute, context): 501 def constructor_getter_context(interface, attribute, context):
503 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 502 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
OLDNEW
« no previous file with comments | « Source/bindings/scripts/idl_types.py ('k') | Source/bindings/scripts/v8_dictionary.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698