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

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

Issue 2873543002: First implementation of lazily cached accessor for DOM attributes. (Closed)
Patch Set: whitespace and renaming fixes Created 3 years, 7 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 cached_attribute_validation_method = extended_attributes.get('CachedAttribut e') 111 cached_attribute_validation_method = extended_attributes.get('CachedAttribut e')
112 keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute) 112 keep_alive_for_gc = is_keep_alive_for_gc(interface, attribute)
113 if cached_attribute_validation_method or keep_alive_for_gc: 113 if cached_attribute_validation_method or keep_alive_for_gc:
114 includes.add('platform/bindings/V8PrivateProperty.h') 114 includes.add('platform/bindings/V8PrivateProperty.h')
115 115
116 # [CachedAccessor] 116 # [CachedAccessor]
117 is_cached_accessor = 'CachedAccessor' in extended_attributes 117 is_cached_accessor = 'CachedAccessor' in extended_attributes
118 if is_cached_accessor: 118 if is_cached_accessor:
119 includes.add('platform/bindings/V8PrivateProperty.h') 119 includes.add('platform/bindings/V8PrivateProperty.h')
120 is_lazy_cached_accessor = is_cached_accessor and extended_attributes.get('Ca chedAccessor') == 'Lazy'
120 121
121 context = { 122 context = {
122 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging] 123 'activity_logging_world_list_for_getter': v8_utilities.activity_logging_ world_list(attribute, 'Getter'), # [ActivityLogging]
123 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_ world_list(attribute, 'Setter'), # [ActivityLogging] 124 'activity_logging_world_list_for_setter': v8_utilities.activity_logging_ world_list(attribute, 'Setter'), # [ActivityLogging]
124 'activity_logging_world_check': v8_utilities.activity_logging_world_chec k(attribute), # [ActivityLogging] 125 'activity_logging_world_check': v8_utilities.activity_logging_world_chec k(attribute), # [ActivityLogging]
125 'cached_attribute_validation_method': cached_attribute_validation_method , 126 'cached_attribute_validation_method': cached_attribute_validation_method ,
126 'constructor_type': constructor_type, 127 'constructor_type': constructor_type,
127 'cpp_name': cpp_name(attribute), 128 'cpp_name': cpp_name(attribute),
128 'cpp_type': idl_type.cpp_type, 129 'cpp_type': idl_type.cpp_type,
129 'cpp_type_initializer': idl_type.cpp_type_initializer, 130 'cpp_type_initializer': idl_type.cpp_type_initializer,
130 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs] 131 'deprecate_as': v8_utilities.deprecate_as(attribute), # [DeprecateAs]
131 'enum_type': idl_type.enum_type, 132 'enum_type': idl_type.enum_type,
132 'enum_values': idl_type.enum_values, 133 'enum_values': idl_type.enum_values,
133 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed] 134 'exposed_test': v8_utilities.exposed(attribute, interface), # [Exposed]
134 'has_cross_origin_getter': 135 'has_cross_origin_getter':
135 has_extended_attribute_value(attribute, 'CrossOrigin', None) or 136 has_extended_attribute_value(attribute, 'CrossOrigin', None) or
136 has_extended_attribute_value(attribute, 'CrossOrigin', 'Getter'), 137 has_extended_attribute_value(attribute, 'CrossOrigin', 'Getter'),
137 'has_cross_origin_setter': has_extended_attribute_value(attribute, 'Cros sOrigin', 'Setter'), 138 'has_cross_origin_setter': has_extended_attribute_value(attribute, 'Cros sOrigin', 'Setter'),
138 'has_custom_getter': has_custom_getter(attribute), 139 'has_custom_getter': has_custom_getter(attribute),
139 'has_custom_setter': has_custom_setter(attribute), 140 'has_custom_setter': has_custom_setter(attribute),
140 'has_setter': has_setter(interface, attribute), 141 'has_setter': has_setter(interface, attribute),
141 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType 142 'idl_type': str(idl_type), # need trailing [] on array for Dictionary:: ConversionContext::setConversionType
142 'is_cached_accessor': is_cached_accessor, 143 'is_cached_accessor': is_cached_accessor,
144 'is_lazy_cached_accessor': is_lazy_cached_accessor,
143 'is_call_with_execution_context': has_extended_attribute_value(attribute , 'CallWith', 'ExecutionContext'), 145 'is_call_with_execution_context': has_extended_attribute_value(attribute , 'CallWith', 'ExecutionContext'),
144 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca llWith', 'ScriptState'), 146 'is_call_with_script_state': has_extended_attribute_value(attribute, 'Ca llWith', 'ScriptState'),
145 'is_ce_reactions': is_ce_reactions, 147 'is_ce_reactions': is_ce_reactions,
146 'is_check_security_for_receiver': is_check_security_for_receiver, 148 'is_check_security_for_receiver': is_check_security_for_receiver,
147 'is_check_security_for_return_value': is_check_security_for_return_value , 149 'is_check_security_for_return_value': is_check_security_for_return_value ,
148 'is_custom_element_callbacks': is_custom_element_callbacks, 150 'is_custom_element_callbacks': is_custom_element_callbacks,
149 # TODO(yukishiino): Make all DOM attributes accessor-type properties. 151 # TODO(yukishiino): Make all DOM attributes accessor-type properties.
150 'is_data_type_property': is_data_type_property(interface, attribute), 152 'is_data_type_property': is_data_type_property(interface, attribute),
151 'is_getter_raises_exception': # [RaisesException] 153 'is_getter_raises_exception': # [RaisesException]
152 'RaisesException' in extended_attributes and 154 'RaisesException' in extended_attributes and
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 def is_constructor_attribute(attribute): 572 def is_constructor_attribute(attribute):
571 return attribute.idl_type.name.endswith('Constructor') 573 return attribute.idl_type.name.endswith('Constructor')
572 574
573 575
574 def is_named_constructor_attribute(attribute): 576 def is_named_constructor_attribute(attribute):
575 return attribute.idl_type.name.endswith('ConstructorConstructor') 577 return attribute.idl_type.name.endswith('ConstructorConstructor')
576 578
577 579
578 def update_constructor_attribute_context(interface, attribute, context): 580 def update_constructor_attribute_context(interface, attribute, context):
579 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as'] 581 context['needs_constructor_getter_callback'] = context['measure_as'] or cont ext['deprecate_as']
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698