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

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

Issue 357413003: IDL: Drop redundant null check for string and wrapper type attributes (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
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_types.py » ('j') | Source/bindings/scripts/v8_types.py » ('J')
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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 '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]
88 '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]
89 '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]
90 '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]
91 'cached_attribute_validation_method': extended_attributes.get('CachedAtt ribute'), 91 'cached_attribute_validation_method': extended_attributes.get('CachedAtt ribute'),
92 'conditional_string': v8_utilities.conditional_string(attribute), 92 'conditional_string': v8_utilities.conditional_string(attribute),
93 'constructor_type': idl_type.constructor_type_name 93 'constructor_type': idl_type.constructor_type_name
94 if is_constructor_attribute(attribute) else None, 94 if is_constructor_attribute(attribute) else None,
95 'cpp_name': cpp_name(attribute), 95 'cpp_name': cpp_name(attribute),
96 'cpp_type': idl_type.cpp_type, 96 'cpp_type': idl_type.cpp_type,
97 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(cpp_value='origi nal', creation_context='info.Holder()'), 97 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(cpp_value='origi nal', creation_context='info.Holder()'),
Jens Widell 2014/07/01 06:43:22 Dropped this because it's overridden by getter_con
98 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] 98 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs]
99 'enum_validation_expression': idl_type.enum_validation_expression, 99 'enum_validation_expression': idl_type.enum_validation_expression,
100 'has_custom_getter': has_custom_getter, 100 'has_custom_getter': has_custom_getter,
101 'has_custom_setter': has_custom_setter, 101 'has_custom_setter': has_custom_setter,
102 'has_type_checking_unrestricted': has_type_checking_unrestricted, 102 'has_type_checking_unrestricted': has_type_checking_unrestricted,
103 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType 103 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType
104 'is_call_with_execution_context': v8_utilities.has_extended_attribute_va lue(attribute, 'CallWith', 'ExecutionContext'), 104 'is_call_with_execution_context': v8_utilities.has_extended_attribute_va lue(attribute, 'CallWith', 'ExecutionContext'),
105 'is_call_with_script_state': v8_utilities.has_extended_attribute_value(a ttribute, 'CallWith', 'ScriptState'), 105 'is_call_with_script_state': v8_utilities.has_extended_attribute_value(a ttribute, 'CallWith', 'ScriptState'),
106 'is_check_security_for_node': is_check_security_for_node, 106 'is_check_security_for_node': is_check_security_for_node,
107 'is_custom_element_callbacks': is_custom_element_callbacks, 107 'is_custom_element_callbacks': is_custom_element_callbacks,
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 extended_attributes = attribute.extended_attributes 163 extended_attributes = attribute.extended_attributes
164 164
165 cpp_value = getter_expression(interface, attribute, context) 165 cpp_value = getter_expression(interface, attribute, context)
166 # Normally we can inline the function call into the return statement to 166 # Normally we can inline the function call into the return statement to
167 # avoid the overhead of using a Ref<> temporary, but for some cases 167 # avoid the overhead of using a Ref<> temporary, but for some cases
168 # (nullable types, EventHandler, [CachedAttribute], or if there are 168 # (nullable types, EventHandler, [CachedAttribute], or if there are
169 # exceptions), we need to use a local variable. 169 # exceptions), we need to use a local variable.
170 # FIXME: check if compilers are smart enough to inline this, and if so, 170 # FIXME: check if compilers are smart enough to inline this, and if so,
171 # always use a local variable (for readability and CG simplicity). 171 # always use a local variable (for readability and CG simplicity).
172 release = False 172 release = False
173 if (idl_type.is_nullable or 173 if ((idl_type.is_nullable and not context['is_nullable_simple']) or
174 base_idl_type == 'EventHandler' or 174 base_idl_type == 'EventHandler' or
175 'CachedAttribute' in extended_attributes or 175 'CachedAttribute' in extended_attributes or
176 'ReflectOnly' in extended_attributes or 176 'ReflectOnly' in extended_attributes or
177 context['is_keep_alive_for_gc'] or 177 context['is_keep_alive_for_gc'] or
178 context['is_getter_raises_exception']): 178 context['is_getter_raises_exception']):
179 context['cpp_value_original'] = cpp_value 179 context['cpp_value_original'] = cpp_value
180 cpp_value = 'cppValue' 180 cpp_value = 'cppValue'
181 # EventHandler has special handling 181 # EventHandler has special handling
182 if base_idl_type != 'EventHandler' and idl_type.is_interface_type: 182 if base_idl_type != 'EventHandler' and idl_type.is_interface_type:
183 release = True 183 release = True
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 lambda self: strip_suffix(self.base_type, 'Constructor')) 432 lambda self: strip_suffix(self.base_type, 'Constructor'))
433 433
434 434
435 def is_constructor_attribute(attribute): 435 def is_constructor_attribute(attribute):
436 # FIXME: replace this with [ConstructorAttribute] extended attribute 436 # FIXME: replace this with [ConstructorAttribute] extended attribute
437 return attribute.idl_type.base_type.endswith('Constructor') 437 return attribute.idl_type.base_type.endswith('Constructor')
438 438
439 439
440 def constructor_getter_context(interface, attribute, context): 440 def constructor_getter_context(interface, attribute, context):
441 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/scripts/v8_types.py » ('j') | Source/bindings/scripts/v8_types.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698