Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: Source/bindings/scripts/v8_interface.py

Issue 1086113002: IDL: Improve "includes for type" mechanism in various ways (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « Source/bindings/scripts/v8_dictionary.py ('k') | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 if idl_type.use_output_parameter_for_result: 1245 if idl_type.use_output_parameter_for_result:
1246 return 'result.isNull()' 1246 return 'result.isNull()'
1247 if idl_type.is_string_type: 1247 if idl_type.is_string_type:
1248 return 'result.isNull()' 1248 return 'result.isNull()'
1249 if idl_type.is_interface_type: 1249 if idl_type.is_interface_type:
1250 return '!result' 1250 return '!result'
1251 if idl_type.base_type in ('any', 'object'): 1251 if idl_type.base_type in ('any', 'object'):
1252 return 'result.isEmpty()' 1252 return 'result.isEmpty()'
1253 return '' 1253 return ''
1254 1254
1255 extended_attributes = getter.extended_attributes
1255 idl_type = getter.idl_type 1256 idl_type = getter.idl_type
1256 extended_attributes = getter.extended_attributes 1257 idl_type.add_includes_for_type(extended_attributes)
1257 is_call_with_script_state = v8_utilities.has_extended_attribute_value(getter , 'CallWith', 'ScriptState') 1258 is_call_with_script_state = v8_utilities.has_extended_attribute_value(getter , 'CallWith', 'ScriptState')
1258 is_raises_exception = 'RaisesException' in extended_attributes 1259 is_raises_exception = 'RaisesException' in extended_attributes
1259 use_output_parameter_for_result = idl_type.use_output_parameter_for_result 1260 use_output_parameter_for_result = idl_type.use_output_parameter_for_result
1260 1261
1261 # FIXME: make more generic, so can use v8_methods.cpp_value 1262 # FIXME: make more generic, so can use v8_methods.cpp_value
1262 cpp_method_name = 'impl->%s' % cpp_name(getter) 1263 cpp_method_name = 'impl->%s' % cpp_name(getter)
1263 1264
1264 if is_call_with_script_state: 1265 if is_call_with_script_state:
1265 cpp_arguments.insert(0, 'scriptState') 1266 cpp_arguments.insert(0, 'scriptState')
1266 if is_raises_exception: 1267 if is_raises_exception:
(...skipping 22 matching lines...) Expand all
1289 'name': cpp_name(getter), 1290 'name': cpp_name(getter),
1290 'use_output_parameter_for_result': use_output_parameter_for_result, 1291 'use_output_parameter_for_result': use_output_parameter_for_result,
1291 'v8_set_return_value': idl_type.v8_set_return_value('result', extended_a ttributes=extended_attributes, script_wrappable='impl', release=idl_type.release ), 1292 'v8_set_return_value': idl_type.v8_set_return_value('result', extended_a ttributes=extended_attributes, script_wrappable='impl', release=idl_type.release ),
1292 } 1293 }
1293 1294
1294 1295
1295 def property_setter(setter, interface): 1296 def property_setter(setter, interface):
1296 if not setter: 1297 if not setter:
1297 return None 1298 return None
1298 1299
1300 extended_attributes = setter.extended_attributes
1299 idl_type = setter.arguments[1].idl_type 1301 idl_type = setter.arguments[1].idl_type
1300 extended_attributes = setter.extended_attributes 1302 idl_type.add_includes_for_type(extended_attributes)
1301 is_call_with_script_state = v8_utilities.has_extended_attribute_value(setter , 'CallWith', 'ScriptState') 1303 is_call_with_script_state = v8_utilities.has_extended_attribute_value(setter , 'CallWith', 'ScriptState')
1302 is_raises_exception = 'RaisesException' in extended_attributes 1304 is_raises_exception = 'RaisesException' in extended_attributes
1303 1305
1304 # [TypeChecking=Interface] / [LegacyInterfaceTypeChecking] 1306 # [TypeChecking=Interface] / [LegacyInterfaceTypeChecking]
1305 has_type_checking_interface = ( 1307 has_type_checking_interface = (
1306 not is_legacy_interface_type_checking(interface, setter) and 1308 not is_legacy_interface_type_checking(interface, setter) and
1307 idl_type.is_wrapper_type) 1309 idl_type.is_wrapper_type)
1308 1310
1309 return { 1311 return {
1310 'has_exception_state': (is_raises_exception or 1312 'has_exception_state': (is_raises_exception or
1311 idl_type.v8_conversion_needs_exception_state), 1313 idl_type.v8_conversion_needs_exception_state),
1312 'has_type_checking_interface': has_type_checking_interface, 1314 'has_type_checking_interface': has_type_checking_interface,
1313 'idl_type': idl_type.base_type, 1315 'idl_type': idl_type.base_type,
1314 'is_call_with_script_state': is_call_with_script_state, 1316 'is_call_with_script_state': is_call_with_script_state,
1315 'is_custom': 'Custom' in extended_attributes, 1317 'is_custom': 'Custom' in extended_attributes,
1316 'is_nullable': idl_type.is_nullable, 1318 'is_nullable': idl_type.is_nullable,
1317 'is_raises_exception': is_raises_exception, 1319 'is_raises_exception': is_raises_exception,
1318 'name': cpp_name(setter), 1320 'name': cpp_name(setter),
1319 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value( 1321 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value(
1320 extended_attributes, 'v8Value', 'propertyValue'), 1322 extended_attributes, 'v8Value', 'propertyValue'),
1321 } 1323 }
1322 1324
1323 1325
1324 def property_deleter(deleter): 1326 def property_deleter(deleter):
1325 if not deleter: 1327 if not deleter:
1326 return None 1328 return None
1327 1329
1330 extended_attributes = deleter.extended_attributes
1328 idl_type = deleter.idl_type 1331 idl_type = deleter.idl_type
1329 extended_attributes = deleter.extended_attributes
1330 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') 1332 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState')
1331 return { 1333 return {
1332 'is_call_with_script_state': is_call_with_script_state, 1334 'is_call_with_script_state': is_call_with_script_state,
1333 'is_custom': 'Custom' in extended_attributes, 1335 'is_custom': 'Custom' in extended_attributes,
1334 'is_raises_exception': 'RaisesException' in extended_attributes, 1336 'is_raises_exception': 'RaisesException' in extended_attributes,
1335 'name': cpp_name(deleter), 1337 'name': cpp_name(deleter),
1336 } 1338 }
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_dictionary.py ('k') | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698