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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 release = True | 176 release = True |
177 | 177 |
178 if 'ReflectOnly' in extended_attributes: | 178 if 'ReflectOnly' in extended_attributes: |
179 contents['cpp_value_original'] = cpp_value | 179 contents['cpp_value_original'] = cpp_value |
180 # FIXME: rename to jsValue | 180 # FIXME: rename to jsValue |
181 cpp_value = 'resultValue' | 181 cpp_value = 'resultValue' |
182 | 182 |
183 def v8_set_return_value_statement(for_main_world=False): | 183 def v8_set_return_value_statement(for_main_world=False): |
184 if contents['is_keep_alive_for_gc']: | 184 if contents['is_keep_alive_for_gc']: |
185 return 'v8SetReturnValue(info, wrapper)' | 185 return 'v8SetReturnValue(info, wrapper)' |
186 return idl_type.v8_set_return_value(cpp_value, extended_attributes=exten
ded_attributes, script_wrappable='imp', release=release, for_main_world=for_main
_world) | 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 | 187 |
188 contents.update({ | 188 contents.update({ |
189 'cpp_value': cpp_value, | 189 'cpp_value': cpp_value, |
190 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_
main_world=True), | 190 'v8_set_return_value_for_main_world': v8_set_return_value_statement(for_
main_world=True), |
191 'v8_set_return_value': v8_set_return_value_statement(), | 191 'v8_set_return_value': v8_set_return_value_statement(), |
192 }) | 192 }) |
193 | 193 |
194 | 194 |
195 def getter_expression(interface, attribute, contents): | 195 def getter_expression(interface, attribute, contents): |
196 arguments = [] | 196 arguments = [] |
197 this_getter_base_name = getter_base_name(interface, attribute, arguments) | 197 this_getter_base_name = getter_base_name(interface, attribute, arguments) |
198 getter_name = scoped_name(interface, attribute, this_getter_base_name) | 198 getter_name = scoped_name(interface, attribute, this_getter_base_name) |
199 | 199 |
200 arguments.extend(v8_utilities.call_with_arguments(attribute)) | 200 arguments.extend(v8_utilities.call_with_arguments(attribute)) |
201 if ('ImplementedBy' in attribute.extended_attributes and | 201 if ('ImplementedBy' in attribute.extended_attributes and |
202 not attribute.is_static): | 202 not attribute.is_static): |
203 arguments.append('*imp') | 203 arguments.append('*impl') |
204 if attribute.idl_type.is_nullable: | 204 if attribute.idl_type.is_nullable: |
205 arguments.append('isNull') | 205 arguments.append('isNull') |
206 if contents['is_getter_raises_exception']: | 206 if contents['is_getter_raises_exception']: |
207 arguments.append('exceptionState') | 207 arguments.append('exceptionState') |
208 return '%s(%s)' % (getter_name, ', '.join(arguments)) | 208 return '%s(%s)' % (getter_name, ', '.join(arguments)) |
209 | 209 |
210 | 210 |
211 CONTENT_ATTRIBUTE_GETTER_NAMES = { | 211 CONTENT_ATTRIBUTE_GETTER_NAMES = { |
212 'boolean': 'fastHasAttribute', | 212 'boolean': 'fastHasAttribute', |
213 'long': 'getIntegralAttribute', | 213 'long': 'getIntegralAttribute', |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
289 | 289 |
290 def setter_expression(interface, attribute, contents): | 290 def setter_expression(interface, attribute, contents): |
291 extended_attributes = attribute.extended_attributes | 291 extended_attributes = attribute.extended_attributes |
292 arguments = v8_utilities.call_with_arguments(attribute, extended_attributes.
get('SetterCallWith')) | 292 arguments = v8_utilities.call_with_arguments(attribute, extended_attributes.
get('SetterCallWith')) |
293 | 293 |
294 this_setter_base_name = setter_base_name(interface, attribute, arguments) | 294 this_setter_base_name = setter_base_name(interface, attribute, arguments) |
295 setter_name = scoped_name(interface, attribute, this_setter_base_name) | 295 setter_name = scoped_name(interface, attribute, this_setter_base_name) |
296 | 296 |
297 if ('ImplementedBy' in extended_attributes and | 297 if ('ImplementedBy' in extended_attributes and |
298 not attribute.is_static): | 298 not attribute.is_static): |
299 arguments.append('*imp') | 299 arguments.append('*impl') |
300 idl_type = attribute.idl_type | 300 idl_type = attribute.idl_type |
301 if idl_type.base_type == 'EventHandler': | 301 if idl_type.base_type == 'EventHandler': |
302 getter_name = scoped_name(interface, attribute, cpp_name(attribute)) | 302 getter_name = scoped_name(interface, attribute, cpp_name(attribute)) |
303 contents['event_handler_getter_expression'] = '%s(%s)' % ( | 303 contents['event_handler_getter_expression'] = '%s(%s)' % ( |
304 getter_name, ', '.join(arguments)) | 304 getter_name, ', '.join(arguments)) |
305 if (interface.name in ['Window', 'WorkerGlobalScope'] and | 305 if (interface.name in ['Window', 'WorkerGlobalScope'] and |
306 attribute.name == 'onerror'): | 306 attribute.name == 'onerror'): |
307 includes.add('bindings/v8/V8ErrorHandler.h') | 307 includes.add('bindings/v8/V8ErrorHandler.h') |
308 arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHa
ndler>(jsValue, true, info.GetIsolate())') | 308 arguments.append('V8EventListenerList::findOrCreateWrapper<V8ErrorHa
ndler>(jsValue, true, info.GetIsolate())') |
309 else: | 309 else: |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 lambda self: strip_suffix(self.base_type, 'Constructor')) | 401 lambda self: strip_suffix(self.base_type, 'Constructor')) |
402 | 402 |
403 | 403 |
404 def is_constructor_attribute(attribute): | 404 def is_constructor_attribute(attribute): |
405 # FIXME: replace this with [ConstructorAttribute] extended attribute | 405 # FIXME: replace this with [ConstructorAttribute] extended attribute |
406 return attribute.idl_type.base_type.endswith('Constructor') | 406 return attribute.idl_type.base_type.endswith('Constructor') |
407 | 407 |
408 | 408 |
409 def generate_constructor_getter(interface, attribute, contents): | 409 def generate_constructor_getter(interface, attribute, contents): |
410 contents['needs_constructor_getter_callback'] = contents['measure_as'] or co
ntents['deprecate_as'] | 410 contents['needs_constructor_getter_callback'] = contents['measure_as'] or co
ntents['deprecate_as'] |
OLD | NEW |