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

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: gyp fix (depends on gyp r1964) 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 this_cpp_value = cpp_value(interface, method, index) 206 this_cpp_value = cpp_value(interface, method, index)
207 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type 207 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type
208 return_promise = (method.idl_type.name == 'Promise' if method.idl_type 208 return_promise = (method.idl_type.name == 'Promise' if method.idl_type
209 else False) 209 else False)
210 210
211 if ('ImplementedInPrivateScript' in extended_attributes and 211 if ('ImplementedInPrivateScript' in extended_attributes and
212 not idl_type.is_wrapper_type and 212 not idl_type.is_wrapper_type and
213 not idl_type.is_basic_type): 213 not idl_type.is_basic_type):
214 raise Exception('Private scripts supports only primitive types and DOM w rappers.') 214 raise Exception('Private scripts supports only primitive types and DOM w rappers.')
215 215
216 default_cpp_value = argument.default_cpp_value
216 return { 217 return {
217 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut es, 218 'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attribut es,
218 raw_type=True, 219 raw_type=True,
219 used_as_variadic_argument=argument.is _variadic), 220 used_as_variadic_argument=argument.is _variadic),
220 'cpp_value': this_cpp_value, 221 'cpp_value': this_cpp_value,
221 # FIXME: check that the default value's type is compatible with the argu ment's 222 # FIXME: check that the default value's type is compatible with the argu ment's
222 'default_value': argument.default_cpp_value, 223 'default_value': default_cpp_value,
223 'enum_validation_expression': idl_type.enum_validation_expression, 224 'enum_validation_expression': idl_type.enum_validation_expression,
224 'handle': '%sHandle' % argument.name, 225 'handle': '%sHandle' % argument.name,
225 # FIXME: remove once [Default] removed and just use argument.default_val ue 226 # FIXME: remove once [Default] removed and just use argument.default_val ue
226 'has_default': 'Default' in extended_attributes or argument.default_valu e, 227 'has_default': 'Default' in extended_attributes or default_cpp_value,
227 'has_type_checking_interface': 228 'has_type_checking_interface':
228 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or 229 (has_extended_attribute_value(interface, 'TypeChecking', 'Interface' ) or
229 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and 230 has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and
230 idl_type.is_wrapper_type, 231 idl_type.is_wrapper_type,
231 'has_type_checking_unrestricted': 232 'has_type_checking_unrestricted':
232 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestrict ed') or 233 (has_extended_attribute_value(interface, 'TypeChecking', 'Unrestrict ed') or
233 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted' )) and 234 has_extended_attribute_value(method, 'TypeChecking', 'Unrestricted' )) and
234 idl_type.name in ('Float', 'Double'), 235 idl_type.name in ('Float', 'Double'),
235 # Dictionary is special-cased, but arrays and sequences shouldn't be 236 # Dictionary is special-cased, but arrays and sequences shouldn't be
236 'idl_type': not idl_type.native_array_element_type and idl_type.base_typ e, 237 'idl_type': not idl_type.native_array_element_type and idl_type.base_typ e,
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 402
402 403
403 def union_arguments(idl_type): 404 def union_arguments(idl_type):
404 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value""" 405 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value"""
405 return [arg 406 return [arg
406 for i in range(len(idl_type.member_types)) 407 for i in range(len(idl_type.member_types))
407 for arg in ['result%sEnabled' % i, 'result%s' % i]] 408 for arg in ['result%sEnabled' % i, 'result%s' % i]]
408 409
409 410
410 def argument_default_cpp_value(argument): 411 def argument_default_cpp_value(argument):
412 if argument.idl_type.is_dictionary:
413 # We always create impl objects for IDL dictionaries.
414 return '%s::create()' % argument.idl_type.base_type
411 if not argument.default_value: 415 if not argument.default_value:
412 return None 416 return None
413 return argument.idl_type.literal_cpp_value(argument.default_value) 417 return argument.idl_type.literal_cpp_value(argument.default_value)
414 418
415 IdlType.union_arguments = property(lambda self: None) 419 IdlType.union_arguments = property(lambda self: None)
416 IdlUnionType.union_arguments = property(union_arguments) 420 IdlUnionType.union_arguments = property(union_arguments)
417 IdlArgument.default_cpp_value = property(argument_default_cpp_value) 421 IdlArgument.default_cpp_value = property(argument_default_cpp_value)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698