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

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

Issue 385603002: IDL: Support using nullable on any method return type (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: use_result_local => use_local_result 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
« no previous file with comments | « Source/bindings/scripts/idl_definitions.py ('k') | Source/bindings/scripts/v8_methods.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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_ attributes 75 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_ attributes
76 if is_implemented_in_private_script: 76 if is_implemented_in_private_script:
77 includes.add('bindings/core/v8/PrivateScriptRunner.h') 77 includes.add('bindings/core/v8/PrivateScriptRunner.h')
78 includes.add('core/frame/LocalFrame.h') 78 includes.add('core/frame/LocalFrame.h')
79 79
80 if (base_idl_type == 'EventHandler' and 80 if (base_idl_type == 'EventHandler' and
81 interface.name in ['Window', 'WorkerGlobalScope'] and 81 interface.name in ['Window', 'WorkerGlobalScope'] and
82 attribute.name == 'onerror'): 82 attribute.name == 'onerror'):
83 includes.add('bindings/core/v8/V8ErrorHandler.h') 83 includes.add('bindings/core/v8/V8ErrorHandler.h')
84 84
85 # Nullable type where the corresponding C++ type supports a null value.
86 is_nullable_simple = idl_type.is_nullable and (
87 (idl_type.is_string_type or idl_type.is_wrapper_type) and
88 not idl_type.native_array_element_type)
89
90 context = { 85 context = {
91 'access_control_list': access_control_list(attribute), 86 'access_control_list': access_control_list(attribute),
92 '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]
93 '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]
94 '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]
95 '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]
96 'argument_cpp_type': idl_type.cpp_type_args(used_as_argument=True), 91 'argument_cpp_type': idl_type.cpp_type_args(used_as_argument=True),
97 'cached_attribute_validation_method': extended_attributes.get('CachedAtt ribute'), 92 'cached_attribute_validation_method': extended_attributes.get('CachedAtt ribute'),
98 'conditional_string': v8_utilities.conditional_string(attribute), 93 'conditional_string': v8_utilities.conditional_string(attribute),
99 'constructor_type': idl_type.constructor_type_name 94 'constructor_type': idl_type.constructor_type_name
(...skipping 12 matching lines...) Expand all
112 'is_custom_element_callbacks': is_custom_element_callbacks, 107 'is_custom_element_callbacks': is_custom_element_callbacks,
113 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes, 108 'is_expose_js_accessors': 'ExposeJSAccessors' in extended_attributes,
114 'is_getter_raises_exception': # [RaisesException] 109 'is_getter_raises_exception': # [RaisesException]
115 'RaisesException' in extended_attributes and 110 'RaisesException' in extended_attributes and
116 extended_attributes['RaisesException'] in (None, 'Getter'), 111 extended_attributes['RaisesException'] in (None, 'Getter'),
117 'is_implemented_in_private_script': is_implemented_in_private_script, 112 'is_implemented_in_private_script': is_implemented_in_private_script,
118 'is_initialized_by_event_constructor': 113 'is_initialized_by_event_constructor':
119 'InitializedByEventConstructor' in extended_attributes, 114 'InitializedByEventConstructor' in extended_attributes,
120 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute), 115 'is_keep_alive_for_gc': is_keep_alive_for_gc(interface, attribute),
121 'is_nullable': idl_type.is_nullable, 116 'is_nullable': idl_type.is_nullable,
122 'is_nullable_simple': is_nullable_simple, 117 'is_nullable_simple': idl_type.is_nullable_simple,
123 'is_partial_interface_member': 118 'is_partial_interface_member':
124 'PartialInterfaceImplementedAs' in extended_attributes, 119 'PartialInterfaceImplementedAs' in extended_attributes,
125 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes, 120 'is_per_world_bindings': 'PerWorldBindings' in extended_attributes,
126 'is_read_only': attribute.is_read_only, 121 'is_read_only': attribute.is_read_only,
127 'is_reflect': is_reflect, 122 'is_reflect': is_reflect,
128 'is_replaceable': 'Replaceable' in attribute.extended_attributes, 123 'is_replaceable': 'Replaceable' in attribute.extended_attributes,
129 'is_static': attribute.is_static, 124 'is_static': attribute.is_static,
130 'is_url': 'URL' in extended_attributes, 125 'is_url': 'URL' in extended_attributes,
131 'is_unforgeable': 'Unforgeable' in extended_attributes, 126 'is_unforgeable': 'Unforgeable' in extended_attributes,
132 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs] 127 'measure_as': v8_utilities.measure_as(attribute), # [MeasureAs]
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 lambda self: strip_suffix(self.base_type, 'Constructor')) 466 lambda self: strip_suffix(self.base_type, 'Constructor'))
472 467
473 468
474 def is_constructor_attribute(attribute): 469 def is_constructor_attribute(attribute):
475 # FIXME: replace this with [ConstructorAttribute] extended attribute 470 # FIXME: replace this with [ConstructorAttribute] extended attribute
476 return attribute.idl_type.base_type.endswith('Constructor') 471 return attribute.idl_type.base_type.endswith('Constructor')
477 472
478 473
479 def constructor_getter_context(interface, attribute, context): 474 def constructor_getter_context(interface, attribute, context):
480 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 475 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
OLDNEW
« no previous file with comments | « Source/bindings/scripts/idl_definitions.py ('k') | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698