Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # coding=utf-8 | 2 # coding=utf-8 |
| 3 # | 3 # |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 1218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1229 return 'result.isNull()' | 1229 return 'result.isNull()' |
| 1230 if idl_type.is_interface_type: | 1230 if idl_type.is_interface_type: |
| 1231 return '!result' | 1231 return '!result' |
| 1232 if idl_type.base_type in ('any', 'object'): | 1232 if idl_type.base_type in ('any', 'object'): |
| 1233 return 'result.isEmpty()' | 1233 return 'result.isEmpty()' |
| 1234 return '' | 1234 return '' |
| 1235 | 1235 |
| 1236 idl_type = getter.idl_type | 1236 idl_type = getter.idl_type |
| 1237 extended_attributes = getter.extended_attributes | 1237 extended_attributes = getter.extended_attributes |
| 1238 is_raises_exception = 'RaisesException' in extended_attributes | 1238 is_raises_exception = 'RaisesException' in extended_attributes |
| 1239 is_call_with_script_state = False | |
| 1240 if 'CallWith' in extended_attributes and extended_attributes['CallWith'] == 'ScriptState': | |
| 1241 is_call_with_script_state = True | |
|
haraken
2015/03/05 05:56:13
Use v8_utilities.has_extended_attribute_value(attr
| |
| 1239 use_output_parameter_for_result = idl_type.use_output_parameter_for_result | 1242 use_output_parameter_for_result = idl_type.use_output_parameter_for_result |
| 1240 | 1243 |
| 1241 # FIXME: make more generic, so can use v8_methods.cpp_value | 1244 # FIXME: make more generic, so can use v8_methods.cpp_value |
| 1242 cpp_method_name = 'impl->%s' % cpp_name(getter) | 1245 cpp_method_name = 'impl->%s' % cpp_name(getter) |
| 1243 | 1246 |
| 1247 if is_call_with_script_state: | |
| 1248 cpp_arguments.insert(0, 'scriptState') | |
| 1244 if is_raises_exception: | 1249 if is_raises_exception: |
| 1245 cpp_arguments.append('exceptionState') | 1250 cpp_arguments.append('exceptionState') |
| 1246 if use_output_parameter_for_result: | 1251 if use_output_parameter_for_result: |
| 1247 cpp_arguments.append('result') | 1252 cpp_arguments.append('result') |
| 1248 | 1253 |
| 1249 cpp_value = '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) | 1254 cpp_value = '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) |
| 1250 | 1255 |
| 1251 return { | 1256 return { |
| 1252 'cpp_type': idl_type.cpp_type, | 1257 'cpp_type': idl_type.cpp_type, |
| 1253 'cpp_value': cpp_value, | 1258 'cpp_value': cpp_value, |
| 1254 'do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, | 1259 'do_not_check_security': 'DoNotCheckSecurity' in extended_attributes, |
| 1255 'is_custom': | 1260 'is_custom': |
| 1256 'Custom' in extended_attributes and | 1261 'Custom' in extended_attributes and |
| 1257 (not extended_attributes['Custom'] or | 1262 (not extended_attributes['Custom'] or |
| 1258 has_extended_attribute_value(getter, 'Custom', 'PropertyGetter')), | 1263 has_extended_attribute_value(getter, 'Custom', 'PropertyGetter')), |
| 1259 'is_custom_property_enumerator': has_extended_attribute_value( | 1264 'is_custom_property_enumerator': has_extended_attribute_value( |
| 1260 getter, 'Custom', 'PropertyEnumerator'), | 1265 getter, 'Custom', 'PropertyEnumerator'), |
| 1261 'is_custom_property_query': has_extended_attribute_value( | 1266 'is_custom_property_query': has_extended_attribute_value( |
| 1262 getter, 'Custom', 'PropertyQuery'), | 1267 getter, 'Custom', 'PropertyQuery'), |
| 1263 'is_enumerable': 'NotEnumerable' not in extended_attributes, | 1268 'is_enumerable': 'NotEnumerable' not in extended_attributes, |
| 1264 'is_null_expression': is_null_expression(idl_type), | 1269 'is_null_expression': is_null_expression(idl_type), |
| 1265 'is_raises_exception': is_raises_exception, | 1270 'is_raises_exception': is_raises_exception, |
| 1271 'is_call_with_script_state': is_call_with_script_state, | |
| 1266 'name': cpp_name(getter), | 1272 'name': cpp_name(getter), |
| 1267 'use_output_parameter_for_result': use_output_parameter_for_result, | 1273 'use_output_parameter_for_result': use_output_parameter_for_result, |
| 1268 'v8_set_return_value': idl_type.v8_set_return_value('result', extended_a ttributes=extended_attributes, script_wrappable='impl', release=idl_type.release ), | 1274 'v8_set_return_value': idl_type.v8_set_return_value('result', extended_a ttributes=extended_attributes, script_wrappable='impl', release=idl_type.release ), |
| 1269 } | 1275 } |
| 1270 | 1276 |
| 1271 | 1277 |
| 1272 def property_setter(setter, interface): | 1278 def property_setter(setter, interface): |
| 1273 if not setter: | 1279 if not setter: |
| 1274 return None | 1280 return None |
| 1275 | 1281 |
| 1276 idl_type = setter.arguments[1].idl_type | 1282 idl_type = setter.arguments[1].idl_type |
| 1277 extended_attributes = setter.extended_attributes | 1283 extended_attributes = setter.extended_attributes |
| 1278 is_raises_exception = 'RaisesException' in extended_attributes | 1284 is_raises_exception = 'RaisesException' in extended_attributes |
| 1285 is_call_with_script_state = False | |
| 1286 if 'CallWith' in extended_attributes and extended_attributes['CallWith'] == 'ScriptState': | |
| 1287 is_call_with_script_state = True | |
| 1279 | 1288 |
| 1280 # [TypeChecking=Interface] / [LegacyInterfaceTypeChecking] | 1289 # [TypeChecking=Interface] / [LegacyInterfaceTypeChecking] |
| 1281 has_type_checking_interface = ( | 1290 has_type_checking_interface = ( |
| 1282 not is_legacy_interface_type_checking(interface, setter) and | 1291 not is_legacy_interface_type_checking(interface, setter) and |
| 1283 idl_type.is_wrapper_type) | 1292 idl_type.is_wrapper_type) |
| 1284 | 1293 |
| 1285 return { | 1294 return { |
| 1286 'has_exception_state': (is_raises_exception or | 1295 'has_exception_state': (is_raises_exception or |
| 1287 idl_type.v8_conversion_needs_exception_state), | 1296 idl_type.v8_conversion_needs_exception_state), |
| 1288 'has_type_checking_interface': has_type_checking_interface, | 1297 'has_type_checking_interface': has_type_checking_interface, |
| 1289 'idl_type': idl_type.base_type, | 1298 'idl_type': idl_type.base_type, |
| 1290 'is_custom': 'Custom' in extended_attributes, | 1299 'is_custom': 'Custom' in extended_attributes, |
| 1291 'is_nullable': idl_type.is_nullable, | 1300 'is_nullable': idl_type.is_nullable, |
| 1292 'is_raises_exception': is_raises_exception, | 1301 'is_raises_exception': is_raises_exception, |
| 1302 'is_call_with_script_state': is_call_with_script_state, | |
| 1293 'name': cpp_name(setter), | 1303 'name': cpp_name(setter), |
| 1294 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( | 1304 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( |
| 1295 extended_attributes, 'v8Value', 'propertyValue'), | 1305 extended_attributes, 'v8Value', 'propertyValue'), |
| 1296 } | 1306 } |
| 1297 | 1307 |
| 1298 | 1308 |
| 1299 def property_deleter(deleter): | 1309 def property_deleter(deleter): |
| 1300 if not deleter: | 1310 if not deleter: |
| 1301 return None | 1311 return None |
| 1302 | 1312 |
| 1303 idl_type = deleter.idl_type | 1313 idl_type = deleter.idl_type |
| 1304 extended_attributes = deleter.extended_attributes | 1314 extended_attributes = deleter.extended_attributes |
| 1315 is_call_with_script_state = False | |
| 1316 if 'CallWith' in extended_attributes and extended_attributes['CallWith'] == 'ScriptState': | |
| 1317 is_call_with_script_state = True | |
| 1305 return { | 1318 return { |
| 1306 'is_custom': 'Custom' in extended_attributes, | 1319 'is_custom': 'Custom' in extended_attributes, |
| 1307 'is_raises_exception': 'RaisesException' in extended_attributes, | 1320 'is_raises_exception': 'RaisesException' in extended_attributes, |
| 1321 'is_call_with_script_state': is_call_with_script_state, | |
| 1308 'name': cpp_name(deleter), | 1322 'name': cpp_name(deleter), |
| 1309 } | 1323 } |
| OLD | NEW |