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

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

Issue 429853002: IDL: Add build target for IDL dictionary impl generation in core (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 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 # 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 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 extended_attributes = argument.extended_attributes 200 extended_attributes = argument.extended_attributes
201 idl_type = argument.idl_type 201 idl_type = argument.idl_type
202 this_cpp_value = cpp_value(interface, method, index) 202 this_cpp_value = cpp_value(interface, method, index)
203 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type 203 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type
204 204
205 if ('ImplementedInPrivateScript' in extended_attributes and 205 if ('ImplementedInPrivateScript' in extended_attributes and
206 not idl_type.is_wrapper_type and 206 not idl_type.is_wrapper_type and
207 not idl_type.is_basic_type): 207 not idl_type.is_basic_type):
208 raise Exception('Private scripts supports only primitive types and DOM w rappers.') 208 raise Exception('Private scripts supports only primitive types and DOM w rappers.')
209 209
210 default_cpp_value = argument.default_cpp_value
210 return { 211 return {
211 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut es, 212 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut es,
212 raw_type=True, 213 raw_type=True,
213 used_as_variadic_argument=argument.is _variadic), 214 used_as_variadic_argument=argument.is _variadic),
214 'cpp_value': this_cpp_value, 215 'cpp_value': this_cpp_value,
215 # FIXME: check that the default value's type is compatible with the argu ment's 216 # FIXME: check that the default value's type is compatible with the argu ment's
216 'default_value': argument.default_cpp_value, 217 'default_value': default_cpp_value,
217 'enum_validation_expression': idl_type.enum_validation_expression, 218 'enum_validation_expression': idl_type.enum_validation_expression,
218 'handle': '%sHandle' % argument.name, 219 'handle': '%sHandle' % argument.name,
219 # FIXME: remove once [Default] removed and just use argument.default_val ue 220 # FIXME: remove once [Default] removed and just use argument.default_val ue
220 'has_default': 'Default' in extended_attributes or argument.default_valu e, 221 'has_default': 'Default' in extended_attributes or default_cpp_value,
221 'has_type_checking_interface': 222 'has_type_checking_interface':
222 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or 223 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or
223 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and 224 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and
224 idl_type.is_wrapper_type, 225 idl_type.is_wrapper_type,
225 'has_type_checking_unrestricted': 226 'has_type_checking_unrestricted':
226 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestrict ed') or 227 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestrict ed') or
227 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted' )) and 228 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted' )) and
228 idl_type.name in ('Float', 'Double'), 229 idl_type.name in ('Float', 'Double'),
229 # Dictionary is special-cased, but arrays and sequences shouldn't be 230 # Dictionary is special-cased, but arrays and sequences shouldn't be
230 'idl_type': not idl_type.native_array_element_type and idl_type.base_typ e, 231 'idl_type': not idl_type.native_array_element_type and idl_type.base_typ e,
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
386 387
387 388
388 def union_arguments(idl_type): 389 def union_arguments(idl_type):
389 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value""" 390 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value"""
390 return [arg 391 return [arg
391 for i in range(len(idl_type.member_types)) 392 for i in range(len(idl_type.member_types))
392 for arg in ['result%sEnabled' % i, 'result%s' % i]] 393 for arg in ['result%sEnabled' % i, 'result%s' % i]]
393 394
394 395
395 def argument_default_cpp_value(argument): 396 def argument_default_cpp_value(argument):
397 if argument.idl_type.is_dictionary:
398 return '%s::create()' % argument.idl_type.base_type
396 if not argument.default_value: 399 if not argument.default_value:
397 return None 400 return None
398 return argument.idl_type.literal_cpp_value(argument.default_value) 401 return argument.idl_type.literal_cpp_value(argument.default_value)
399 402
400 IdlType.union_arguments = property(lambda self: None) 403 IdlType.union_arguments = property(lambda self: None)
401 IdlUnionType.union_arguments = property(union_arguments) 404 IdlUnionType.union_arguments = property(union_arguments)
402 IdlArgument.default_cpp_value = property(argument_default_cpp_value) 405 IdlArgument.default_cpp_value = property(argument_default_cpp_value)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698