Chromium Code Reviews| 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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 161 | 161 |
| 162 def getter_expression(interface, attribute, contents, includes): | 162 def getter_expression(interface, attribute, contents, includes): |
| 163 arguments = [] | 163 arguments = [] |
| 164 if 'Reflect' in attribute.extended_attributes: | 164 if 'Reflect' in attribute.extended_attributes: |
| 165 getter_base_name = content_attribute_getter_base_name(attribute, include s, arguments) | 165 getter_base_name = content_attribute_getter_base_name(attribute, include s, arguments) |
| 166 else: | 166 else: |
| 167 getter_base_name = uncapitalize(cpp_name(attribute)) | 167 getter_base_name = uncapitalize(cpp_name(attribute)) |
| 168 | 168 |
| 169 getter_name = scoped_name(interface, attribute, getter_base_name) | 169 getter_name = scoped_name(interface, attribute, getter_base_name) |
| 170 | 170 |
| 171 arguments.extend(v8_utilities.call_with_arguments(attribute, contents)) | 171 call_with = attribute.extended_attributes.get('CallWith', '') |
|
haraken
2013/10/21 07:36:52
Why do we need ", ''" ? I'm a bit afraid that it's
Nils Barth (inactive)
2013/10/21 08:03:05
Changed.
|get| defaults to returning None;
this m
| |
| 172 arguments.extend(v8_utilities.call_with_arguments(call_with, contents)) | |
| 172 if attribute.is_nullable: | 173 if attribute.is_nullable: |
| 173 arguments.append('isNull') | 174 arguments.append('isNull') |
| 174 if contents['is_getter_raises_exception']: | 175 if contents['is_getter_raises_exception']: |
| 175 arguments.append('es') | 176 arguments.append('es') |
| 176 if attribute.data_type == 'EventHandler': | 177 if attribute.data_type == 'EventHandler': |
| 177 arguments.append('isolatedWorldForIsolate(info.GetIsolate())') | 178 arguments.append('isolatedWorldForIsolate(info.GetIsolate())') |
| 178 return '%s(%s)' % (getter_name, ', '.join(arguments)) | 179 return '%s(%s)' % (getter_name, ', '.join(arguments)) |
| 179 | 180 |
| 180 | 181 |
| 181 CONTENT_ATTRIBUTE_GETTER_NAMES = { | 182 CONTENT_ATTRIBUTE_GETTER_NAMES = { |
| (...skipping 30 matching lines...) Expand all Loading... | |
| 212 else: | 213 else: |
| 213 cpp_value = 'cppValue' | 214 cpp_value = 'cppValue' |
| 214 contents.update({ | 215 contents.update({ |
| 215 'cpp_setter': setter_expression(interface, attribute, contents, includes ), | 216 'cpp_setter': setter_expression(interface, attribute, contents, includes ), |
| 216 'enum_validation_expression': enum_validation_expression(idl_type), | 217 'enum_validation_expression': enum_validation_expression(idl_type), |
| 217 'v8_value_to_local_cpp_value': v8_types.v8_value_to_local_cpp_value(idl_ type, attribute.extended_attributes, 'jsValue', 'cppValue', includes, 'info.GetI solate()'), | 218 'v8_value_to_local_cpp_value': v8_types.v8_value_to_local_cpp_value(idl_ type, attribute.extended_attributes, 'jsValue', 'cppValue', includes, 'info.GetI solate()'), |
| 218 }) | 219 }) |
| 219 | 220 |
| 220 | 221 |
| 221 def setter_expression(interface, attribute, contents, includes): | 222 def setter_expression(interface, attribute, contents, includes): |
| 222 arguments = v8_utilities.call_with_arguments(attribute, contents) | 223 call_with = attribute.extended_attributes.get('SetterCallWith') or attribute .extended_attributes.get('CallWith', '') |
| 224 arguments = v8_utilities.call_with_arguments(call_with, contents) | |
| 223 idl_type = attribute.data_type | 225 idl_type = attribute.data_type |
| 224 if idl_type == 'EventHandler': | 226 if idl_type == 'EventHandler': |
| 225 # FIXME: move V8EventListenerList.h to INCLUDES_FOR_TYPE | 227 # FIXME: move V8EventListenerList.h to INCLUDES_FOR_TYPE |
| 226 includes.add('bindings/v8/V8EventListenerList.h') | 228 includes.add('bindings/v8/V8EventListenerList.h') |
| 227 # FIXME: pass the isolate instead of the isolated world | 229 # FIXME: pass the isolate instead of the isolated world |
| 228 isolated_world = 'isolatedWorldForIsolate(info.GetIsolate())' | 230 isolated_world = 'isolatedWorldForIsolate(info.GetIsolate())' |
| 229 arguments.extend(['V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate)', isolated_world]) | 231 arguments.extend(['V8EventListenerList::getEventListener(jsValue, true, ListenerFindOrCreate)', isolated_world]) |
| 230 contents['event_handler_getter_expression'] = 'imp->%s(%s)' % (cpp_name( attribute), isolated_world) | 232 contents['event_handler_getter_expression'] = 'imp->%s(%s)' % (cpp_name( attribute), isolated_world) |
| 231 elif v8_types.is_interface_type(idl_type) and not v8_types.array_type(idl_ty pe): | 233 elif v8_types.is_interface_type(idl_type) and not v8_types.array_type(idl_ty pe): |
| 232 # FIXME: should be able to eliminate WTF::getPtr in most or all cases | 234 # FIXME: should be able to eliminate WTF::getPtr in most or all cases |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 317 if 'PerWorldBindings' not in attribute.extended_attributes: | 319 if 'PerWorldBindings' not in attribute.extended_attributes: |
| 318 return '0' | 320 return '0' |
| 319 return '%sV8Internal::%sAttributeGetterCallbackForMainWorld' % (cpp_name(int erface), attribute.name) | 321 return '%sV8Internal::%sAttributeGetterCallbackForMainWorld' % (cpp_name(int erface), attribute.name) |
| 320 | 322 |
| 321 | 323 |
| 322 def setter_callback_name_for_main_world(interface, attribute): | 324 def setter_callback_name_for_main_world(interface, attribute): |
| 323 if ('PerWorldBindings' not in attribute.extended_attributes or | 325 if ('PerWorldBindings' not in attribute.extended_attributes or |
| 324 attribute.is_read_only): | 326 attribute.is_read_only): |
| 325 return '0' | 327 return '0' |
| 326 return '%sV8Internal::%sAttributeSetterCallbackForMainWorld' % (cpp_name(int erface), attribute.name) | 328 return '%sV8Internal::%sAttributeSetterCallbackForMainWorld' % (cpp_name(int erface), attribute.name) |
| OLD | NEW |