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

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

Issue 338843005: IDL: For DOMString? attribute getters, use null string to represent null (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 5 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 has_type_checking_unrestricted = ( 70 has_type_checking_unrestricted = (
71 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or 71 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestricted') or
72 has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted') ) and 72 has_extended_attribute_value(attribute, 'TypeChecking', 'Unrestricted') ) and
73 idl_type.name in ('Float', 'Double')) 73 idl_type.name in ('Float', 'Double'))
74 74
75 if (base_idl_type == 'EventHandler' and 75 if (base_idl_type == 'EventHandler' and
76 interface.name in ['Window', 'WorkerGlobalScope'] and 76 interface.name in ['Window', 'WorkerGlobalScope'] and
77 attribute.name == 'onerror'): 77 attribute.name == 'onerror'):
78 includes.add('bindings/v8/V8ErrorHandler.h') 78 includes.add('bindings/v8/V8ErrorHandler.h')
79 79
80 # Nullable type where the corresponding C++ type supports a null value.
81 is_nullable_simple = idl_type.is_nullable and (
82 (idl_type.is_string_type or idl_type.is_wrapper_type) and
83 not idl_type.array_or_sequence_type)
84
80 context = { 85 context = {
81 'access_control_list': access_control_list(attribute), 86 'access_control_list': access_control_list(attribute),
82 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging] 87 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging]
83 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_ world_list(attribute, 'Setter'), # [ActivityLogging] 88 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_ world_list(attribute, 'Setter'), # [ActivityLogging]
84 'activity_logging_include_old_value_for_setter': 'LogPreviousValue' in e xtended_attributes, # [ActivityLogging] 89 'activity_logging_include_old_value_for_setter': 'LogPreviousValue' in e xtended_attributes, # [ActivityLogging]
85 'activity_logging_world_check': v8_utilities.activity_logging_world_chec k(attribute), # [ActivityLogging] 90 'activity_logging_world_check': v8_utilities.activity_logging_world_chec k(attribute), # [ActivityLogging]
86 'cached_attribute_validation_method': extended_attributes.get('CachedAtt ribute'), 91 'cached_attribute_validation_method': extended_attributes.get('CachedAtt ribute'),
87 'conditional_string': v8_utilities.conditional_string(attribute), 92 'conditional_string': v8_utilities.conditional_string(attribute),
88 'constructor_type': idl_type.constructor_type_name 93 'constructor_type': idl_type.constructor_type_name
89 if is_constructor_attribute(attribute) else None, 94 if is_constructor_attribute(attribute) else None,
(...skipping 11 matching lines...) Expand all
101 'is_check_security_for_node': is_check_security_for_node, 106 'is_check_security_for_node': is_check_security_for_node,
102 'is_custom_element_callbacks': is_custom_element_callbacks, 107 'is_custom_element_callbacks': is_custom_element_callbacks,
103 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, 108 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes,
104 'is_getter_raises_exception': # [RaisesException] 109 'is_getter_raises_exception': # [RaisesException]
105 'RaisesException' in extended_attributes and 110 'RaisesException' in extended_attributes and
106 extended_attributes['RaisesException'] in (None, 'Getter'), 111 extended_attributes['RaisesException'] in (None, 'Getter'),
107 'is_initialized_by_event_constructor': 112 'is_initialized_by_event_constructor':
108 'InitializedByEventConstructor' in extended_attributes, 113 'InitializedByEventConstructor' in extended_attributes,
109 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), 114 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute),
110 'is_nullable': idl_type.is_nullable, 115 'is_nullable': idl_type.is_nullable,
111 'is_nullable_simple': idl_type.is_nullable and idl_type.is_wrapper_type, # null value maps to C++ null pointer 116 'is_nullable_simple': is_nullable_simple,
112 'is_partial_interface_member': 117 'is_partial_interface_member':
113 'PartialInterfaceImplementedAs' in extended_attributes, 118 'PartialInterfaceImplementedAs' in extended_attributes,
114 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, 119 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes,
115 'is_read_only': attribute.is_read_only, 120 'is_read_only': attribute.is_read_only,
116 'is_reflect': is_reflect, 121 'is_reflect': is_reflect,
117 'is_replaceable': 'Replaceable' in attribute.extended_attributes, 122 'is_replaceable': 'Replaceable' in attribute.extended_attributes,
118 'is_static': attribute.is_static, 123 'is_static': attribute.is_static,
119 'is_url': 'URL' in extended_attributes, 124 'is_url': 'URL' in extended_attributes,
120 'is_unforgeable': 'Unforgeable' in extended_attributes, 125 'is_unforgeable': 'Unforgeable' in extended_attributes,
121 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs] 126 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs]
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 lambda self: strip_suffix(self.base_type, 'Constructor')) 432 lambda self: strip_suffix(self.base_type, 'Constructor'))
428 433
429 434
430 def is_constructor_attribute(attribute): 435 def is_constructor_attribute(attribute):
431 # FIXME: replace this with [ConstructorAttribute] extended attribute 436 # FIXME: replace this with [ConstructorAttribute] extended attribute
432 return attribute.idl_type.base_type.endswith('Constructor') 437 return attribute.idl_type.base_type.endswith('Constructor')
433 438
434 439
435 def constructor_getter_context(interface, attribute, context): 440 def constructor_getter_context(interface, attribute, context):
436 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 441 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/tests/results/V8TestObject.cpp » ('j') | Source/bindings/tests/results/V8TestObject.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698