OLD | NEW |
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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 'ReflectOnly' in extended_attributes or | 184 'ReflectOnly' in extended_attributes or |
185 context['is_keep_alive_for_gc'] or | 185 context['is_keep_alive_for_gc'] or |
186 context['is_getter_raises_exception']): | 186 context['is_getter_raises_exception']): |
187 context['cpp_value_original'] = cpp_value | 187 context['cpp_value_original'] = cpp_value |
188 cpp_value = 'cppValue' | 188 cpp_value = 'cppValue' |
189 # EventHandler has special handling | 189 # EventHandler has special handling |
190 if base_idl_type != 'EventHandler': | 190 if base_idl_type != 'EventHandler': |
191 release = idl_type.release | 191 release = idl_type.release |
192 | 192 |
193 def v8_set_return_value_statement(for_main_world=False): | 193 def v8_set_return_value_statement(for_main_world=False): |
194 if context['is_keep_alive_for_gc']: | 194 if context['is_keep_alive_for_gc'] or 'CachedAttribute' in extended_attr
ibutes: |
195 return 'v8SetReturnValue(info, wrapper)' | 195 return 'v8SetReturnValue(info, v8Value)' |
196 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) | 196 return idl_type.v8_set_return_value( |
| 197 cpp_value, extended_attributes=extended_attributes, script_wrappable
='impl', |
| 198 release=release, for_main_world=for_main_world) |
197 | 199 |
198 context.update({ | 200 context.update({ |
199 'cpp_value': cpp_value, | 201 'cpp_value': cpp_value, |
200 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( | 202 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( |
201 cpp_value=cpp_value, creation_context='info.Holder()', | 203 cpp_value=cpp_value, creation_context='info.Holder()', |
202 extended_attributes=extended_attributes), | 204 extended_attributes=extended_attributes), |
203 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_
main_world=True), | 205 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_
main_world=True), |
204 'v8_set_return_value': v8_set_return_value_statement(), | 206 'v8_set_return_value': v8_set_return_value_statement(), |
205 }) | 207 }) |
206 | 208 |
207 | |
208 def getter_expression(interface, attribute, context): | 209 def getter_expression(interface, attribute, context): |
209 arguments = [] | 210 arguments = [] |
210 this_getter_base_name = getter_base_name(interface, attribute, arguments) | 211 this_getter_base_name = getter_base_name(interface, attribute, arguments) |
211 getter_name = scoped_name(interface, attribute, this_getter_base_name) | 212 getter_name = scoped_name(interface, attribute, this_getter_base_name) |
212 | 213 |
213 if 'ImplementedInPrivateScript' in attribute.extended_attributes: | 214 if 'ImplementedInPrivateScript' in attribute.extended_attributes: |
214 arguments.append('toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->G
etCurrentContext()))') | 215 arguments.append('toLocalFrame(toFrameIfNotDetached(info.GetIsolate()->G
etCurrentContext()))') |
215 arguments.append('impl') | 216 arguments.append('impl') |
216 arguments.append('&result') | 217 arguments.append('&result') |
217 arguments.extend(v8_utilities.call_with_arguments( | 218 arguments.extend(v8_utilities.call_with_arguments( |
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
511 lambda self: strip_suffix(self.base_type, 'Constructor')) | 512 lambda self: strip_suffix(self.base_type, 'Constructor')) |
512 | 513 |
513 | 514 |
514 def is_constructor_attribute(attribute): | 515 def is_constructor_attribute(attribute): |
515 # FIXME: replace this with [ConstructorAttribute] extended attribute | 516 # FIXME: replace this with [ConstructorAttribute] extended attribute |
516 return attribute.idl_type.name.endswith('Constructor') | 517 return attribute.idl_type.name.endswith('Constructor') |
517 | 518 |
518 | 519 |
519 def constructor_getter_context(interface, attribute, context): | 520 def constructor_getter_context(interface, attribute, context): |
520 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] | 521 context['needs_constructor_getter_callback'] = context['measure_as'] or cont
ext['deprecate_as'] |
OLD | NEW |