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

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

Issue 1186823014: [bindings] Eliminate custom bindings for DeviceOrientationEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Introducing |TreatUndefinedAs=Null| Created 5 years, 6 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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 218
219 if ('ImplementedInPrivateScript' in extended_attributes and 219 if ('ImplementedInPrivateScript' in extended_attributes and
220 not idl_type.is_wrapper_type and 220 not idl_type.is_wrapper_type and
221 not idl_type.is_basic_type): 221 not idl_type.is_basic_type):
222 raise Exception('Private scripts supports only primitive types and DOM w rappers.') 222 raise Exception('Private scripts supports only primitive types and DOM w rappers.')
223 223
224 set_default_value = argument.set_default_value 224 set_default_value = argument.set_default_value
225 this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attribut es, 225 this_cpp_type = idl_type.cpp_type_args(extended_attributes=extended_attribut es,
226 raw_type=True, 226 raw_type=True,
227 used_as_variadic_argument=argument.is _variadic) 227 used_as_variadic_argument=argument.is _variadic)
228 is_undefined_to_null = idl_type.is_primitive_type and \
haraken 2015/06/17 16:01:42 \ is not needed.
229 has_extended_attribute_value(argument, "Default", "Undefined") and \
haraken 2015/06/17 16:01:42 Do we need this condition? I mean, what should hap
230 has_extended_attribute_value(argument, "TreatUndefinedAs", "Null")
231
228 return { 232 return {
229 'cpp_type': ( 233 'cpp_type': (
230 v8_types.cpp_template_type('Nullable', this_cpp_type) 234 v8_types.cpp_template_type('Nullable', this_cpp_type)
231 if idl_type.is_explicit_nullable and not argument.is_variadic 235 if idl_type.is_explicit_nullable and not argument.is_variadic
232 else this_cpp_type), 236 else this_cpp_type),
233 'cpp_value': this_cpp_value, 237 'cpp_value': this_cpp_value,
234 # FIXME: check that the default value's type is compatible with the argu ment's 238 # FIXME: check that the default value's type is compatible with the argu ment's
235 'set_default_value': set_default_value, 239 'set_default_value': set_default_value,
236 'enum_type': idl_type.enum_type, 240 'enum_type': idl_type.enum_type,
237 'enum_values': idl_type.enum_values, 241 'enum_values': idl_type.enum_values,
238 'handle': '%sHandle' % argument.name, 242 'handle': '%sHandle' % argument.name,
239 # FIXME: remove once [Default] removed and just use argument.default_val ue 243 # FIXME: remove once [Default] removed and just use argument.default_val ue
240 'has_default': 'Default' in extended_attributes or set_default_value, 244 'has_default': 'Default' in extended_attributes or set_default_value,
241 'has_type_checking_interface': has_type_checking_interface, 245 'has_type_checking_interface': has_type_checking_interface,
242 # Dictionary is special-cased, but arrays and sequences shouldn't be 246 # Dictionary is special-cased, but arrays and sequences shouldn't be
243 'idl_type': idl_type.base_type, 247 'idl_type': idl_type.base_type,
244 'idl_type_object': idl_type, 248 'idl_type_object': idl_type,
245 'index': index, 249 'index': index,
246 'is_callback_function': idl_type.is_callback_function, 250 'is_callback_function': idl_type.is_callback_function,
247 'is_callback_interface': idl_type.is_callback_interface, 251 'is_callback_interface': idl_type.is_callback_interface,
248 # FIXME: Remove generic 'Dictionary' special-casing 252 # FIXME: Remove generic 'Dictionary' special-casing
249 'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictio nary', 253 'is_dictionary': idl_type.is_dictionary or idl_type.base_type == 'Dictio nary',
250 'is_explicit_nullable': idl_type.is_explicit_nullable, 254 'is_explicit_nullable': idl_type.is_explicit_nullable,
251 'is_nullable': idl_type.is_nullable, 255 'is_nullable': idl_type.is_nullable,
252 'is_optional': argument.is_optional, 256 'is_optional': argument.is_optional,
257 'is_undefined_to_null': is_undefined_to_null,
253 'is_variadic': argument.is_variadic, 258 'is_variadic': argument.is_variadic,
254 'is_variadic_wrapper_type': is_variadic_wrapper_type, 259 'is_variadic_wrapper_type': is_variadic_wrapper_type,
255 'is_wrapper_type': idl_type.is_wrapper_type, 260 'is_wrapper_type': idl_type.is_wrapper_type,
256 'name': argument.name, 261 'name': argument.name,
257 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( 262 'private_script_cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(
258 argument.name, isolate='scriptState->isolate()', 263 argument.name, isolate='scriptState->isolate()',
259 creation_context='scriptState->context()->Global()'), 264 creation_context='scriptState->context()->Global()'),
260 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion' in extended_attributes, 265 'use_permissive_dictionary_conversion': 'PermissiveDictionaryConversion' in extended_attributes,
261 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value), 266 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value),
262 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True), 267 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True),
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after
466 return method.idl_type and method.idl_type.name == 'Promise' 471 return method.idl_type and method.idl_type.name == 'Promise'
467 472
468 IdlOperation.returns_promise = property(method_returns_promise) 473 IdlOperation.returns_promise = property(method_returns_promise)
469 474
470 475
471 def argument_conversion_needs_exception_state(method, argument): 476 def argument_conversion_needs_exception_state(method, argument):
472 idl_type = argument.idl_type 477 idl_type = argument.idl_type
473 return (idl_type.v8_conversion_needs_exception_state or 478 return (idl_type.v8_conversion_needs_exception_state or
474 argument.is_variadic or 479 argument.is_variadic or
475 (method.returns_promise and idl_type.is_string_type)) 480 (method.returns_promise and idl_type.is_string_type))
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698