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

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

Issue 2709983004: WIP bindings: Add support for the record<K,V> WebIDL type. (Closed)
Patch Set: Rebased patch using NativeValueTraits for IDL types Created 3 years, 9 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
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 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after
1091 # [constructor(sequence<DOMString> arg), constructor(Dictionary arg)] 1091 # [constructor(sequence<DOMString> arg), constructor(Dictionary arg)]
1092 # interface I { ... } 1092 # interface I { ... }
1093 # (Need to check array types before objects because an array is an object) 1093 # (Need to check array types before objects because an array is an object)
1094 for idl_type, method in idl_types_methods: 1094 for idl_type, method in idl_types_methods:
1095 if idl_type.native_array_element_type: 1095 if idl_type.native_array_element_type:
1096 # (We test for Array instead of generic Object to type-check.) 1096 # (We test for Array instead of generic Object to type-check.)
1097 # FIXME: test for Object during resolution, then have type check for 1097 # FIXME: test for Object during resolution, then have type check for
1098 # Array in overloaded method: http://crbug.com/262383 1098 # Array in overloaded method: http://crbug.com/262383
1099 yield '%s->IsArray()' % cpp_value, method 1099 yield '%s->IsArray()' % cpp_value, method
1100 for idl_type, method in idl_types_methods: 1100 for idl_type, method in idl_types_methods:
1101 if idl_type.is_dictionary or idl_type.name == 'Dictionary' or idl_type.i s_callback_interface: 1101 if idl_type.is_dictionary or idl_type.name == 'Dictionary' or \
1102 idl_type.is_callback_interface or idl_type.is_record_type:
1102 # FIXME: should be '{1}->IsObject() && !{1}->IsRegExp()'.format(cpp_ value) 1103 # FIXME: should be '{1}->IsObject() && !{1}->IsRegExp()'.format(cpp_ value)
1103 # FIXME: the IsRegExp checks can be skipped if we've 1104 # FIXME: the IsRegExp checks can be skipped if we've
1104 # already generated tests for them. 1105 # already generated tests for them.
1105 yield '%s->IsObject()' % cpp_value, method 1106 yield '%s->IsObject()' % cpp_value, method
1106 1107
1107 # (Check for exact type matches before performing automatic type conversion; 1108 # (Check for exact type matches before performing automatic type conversion;
1108 # only needed if distinguishing between primitive types.) 1109 # only needed if distinguishing between primitive types.)
1109 if len([idl_type.is_primitive_type for idl_type in idl_types]) > 1: 1110 if len([idl_type.is_primitive_type for idl_type in idl_types]) > 1:
1110 # (Only needed if match in step 11, otherwise redundant.) 1111 # (Only needed if match in step 11, otherwise redundant.)
1111 if any(idl_type.is_string_type or idl_type.is_enum 1112 if any(idl_type.is_string_type or idl_type.is_enum
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after
1369 extended_attributes = deleter.extended_attributes 1370 extended_attributes = deleter.extended_attributes
1370 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') 1371 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState')
1371 is_ce_reactions = 'CEReactions' in extended_attributes 1372 is_ce_reactions = 'CEReactions' in extended_attributes
1372 return { 1373 return {
1373 'is_call_with_script_state': is_call_with_script_state, 1374 'is_call_with_script_state': is_call_with_script_state,
1374 'is_ce_reactions': is_ce_reactions, 1375 'is_ce_reactions': is_ce_reactions,
1375 'is_custom': 'Custom' in extended_attributes, 1376 'is_custom': 'Custom' in extended_attributes,
1376 'is_raises_exception': 'RaisesException' in extended_attributes, 1377 'is_raises_exception': 'RaisesException' in extended_attributes,
1377 'name': cpp_name(deleter), 1378 'name': cpp_name(deleter),
1378 } 1379 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698