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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 # Normally we can inline the function call into the return statement to | 162 # Normally we can inline the function call into the return statement to |
163 # avoid the overhead of using a Ref<> temporary, but for some cases | 163 # avoid the overhead of using a Ref<> temporary, but for some cases |
164 # (nullable types, EventHandler, [CachedAttribute], or if there are | 164 # (nullable types, EventHandler, [CachedAttribute], or if there are |
165 # exceptions), we need to use a local variable. | 165 # exceptions), we need to use a local variable. |
166 # FIXME: check if compilers are smart enough to inline this, and if so, | 166 # FIXME: check if compilers are smart enough to inline this, and if so, |
167 # always use a local variable (for readability and CG simplicity). | 167 # always use a local variable (for readability and CG simplicity). |
168 release = False | 168 release = False |
169 if (idl_type.is_nullable or | 169 if (idl_type.is_nullable or |
170 base_idl_type == 'EventHandler' or | 170 base_idl_type == 'EventHandler' or |
171 'CachedAttribute' in extended_attributes or | 171 'CachedAttribute' in extended_attributes or |
| 172 'ReflectOnly' in extended_attributes or |
172 contents['is_getter_raises_exception']): | 173 contents['is_getter_raises_exception']): |
173 contents['cpp_value_original'] = cpp_value | 174 contents['cpp_value_original'] = cpp_value |
174 cpp_value = 'jsValue' | 175 cpp_value = 'jsValue' |
175 # EventHandler has special handling | 176 # EventHandler has special handling |
176 if base_idl_type != 'EventHandler' and idl_type.is_interface_type: | 177 if base_idl_type != 'EventHandler' and idl_type.is_interface_type: |
177 release = True | 178 release = True |
178 | 179 |
179 if 'ReflectOnly' in extended_attributes: | |
180 contents['cpp_value_original'] = cpp_value | |
181 # FIXME: rename to jsValue | |
182 cpp_value = 'resultValue' | |
183 | |
184 def v8_set_return_value_statement(for_main_world=False): | 180 def v8_set_return_value_statement(for_main_world=False): |
185 if contents['is_keep_alive_for_gc']: | 181 if contents['is_keep_alive_for_gc']: |
186 return 'v8SetReturnValue(info, wrapper)' | 182 return 'v8SetReturnValue(info, wrapper)' |
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) | 183 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) |
188 | 184 |
189 contents.update({ | 185 contents.update({ |
190 'cpp_value': cpp_value, | 186 'cpp_value': cpp_value, |
191 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_
main_world=True), | 187 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_
main_world=True), |
192 'v8_set_return_value': v8_set_return_value_statement(), | 188 'v8_set_return_value': v8_set_return_value_statement(), |
193 }) | 189 }) |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
402 lambda self: strip_suffix(self.base_type, 'Constructor')) | 398 lambda self: strip_suffix(self.base_type, 'Constructor')) |
403 | 399 |
404 | 400 |
405 def is_constructor_attribute(attribute): | 401 def is_constructor_attribute(attribute): |
406 # FIXME: replace this with [ConstructorAttribute] extended attribute | 402 # FIXME: replace this with [ConstructorAttribute] extended attribute |
407 return attribute.idl_type.base_type.endswith('Constructor') | 403 return attribute.idl_type.base_type.endswith('Constructor') |
408 | 404 |
409 | 405 |
410 def generate_constructor_getter(interface, attribute, contents): | 406 def generate_constructor_getter(interface, attribute, contents): |
411 contents['needs_constructor_getter_callback'] = contents['measure_as'] or co
ntents['deprecate_as'] | 407 contents['needs_constructor_getter_callback'] = contents['measure_as'] or co
ntents['deprecate_as'] |
OLD | NEW |