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

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

Issue 351403003: IDL: Merge duplicating local variable assignment in attribute_getter (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Further v8Value -> cppValue renaming Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | Source/bindings/templates/attributes.cpp » ('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 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 # avoid the overhead of using a Ref<> temporary, but for some cases 166 # avoid the overhead of using a Ref<> temporary, but for some cases
167 # (nullable types, EventHandler, [CachedAttribute], or if there are 167 # (nullable types, EventHandler, [CachedAttribute], or if there are
168 # exceptions), we need to use a local variable. 168 # exceptions), we need to use a local variable.
169 # FIXME: check if compilers are smart enough to inline this, and if so, 169 # FIXME: check if compilers are smart enough to inline this, and if so,
170 # always use a local variable (for readability and CG simplicity). 170 # always use a local variable (for readability and CG simplicity).
171 release = False 171 release = False
172 if (idl_type.is_nullable or 172 if (idl_type.is_nullable or
173 base_idl_type == 'EventHandler' or 173 base_idl_type == 'EventHandler' or
174 'CachedAttribute' in extended_attributes or 174 'CachedAttribute' in extended_attributes or
175 'ReflectOnly' in extended_attributes or 175 'ReflectOnly' in extended_attributes or
176 context['is_keep_alive_for_gc'] or
176 context['is_getter_raises_exception']): 177 context['is_getter_raises_exception']):
177 context['cpp_value_original'] = cpp_value 178 context['cpp_value_original'] = cpp_value
178 cpp_value = 'v8Value' 179 cpp_value = 'cppValue'
179 # EventHandler has special handling 180 # EventHandler has special handling
180 if base_idl_type != 'EventHandler' and idl_type.is_interface_type: 181 if base_idl_type != 'EventHandler' and idl_type.is_interface_type:
181 release = True 182 release = True
182 183
183 def v8_set_return_value_statement(for_main_world=False): 184 def v8_set_return_value_statement(for_main_world=False):
184 if context['is_keep_alive_for_gc']: 185 if context['is_keep_alive_for_gc']:
185 return 'v8SetReturnValue(info, wrapper)' 186 return 'v8SetReturnValue(info, wrapper)'
186 return idl_type.v8_set_return_value(cpp_value, extended_attributes=exten ded_attributes, script_wrappable='impl', release=release, for_main_world=for_mai n_world) 187 return idl_type.v8_set_return_value(cpp_value, extended_attributes=exten ded_attributes, script_wrappable='impl', release=release, for_main_world=for_mai n_world)
187 188
188 context.update({ 189 context.update({
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 lambda self: strip_suffix(self.base_type, 'Constructor')) 432 lambda self: strip_suffix(self.base_type, 'Constructor'))
432 433
433 434
434 def is_constructor_attribute(attribute): 435 def is_constructor_attribute(attribute):
435 # FIXME: replace this with [ConstructorAttribute] extended attribute 436 # FIXME: replace this with [ConstructorAttribute] extended attribute
436 return attribute.idl_type.base_type.endswith('Constructor') 437 return attribute.idl_type.base_type.endswith('Constructor')
437 438
438 439
439 def constructor_getter_context(interface, attribute, context): 440 def constructor_getter_context(interface, attribute, context):
440 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/templates/attributes.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698