Index: Source/bindings/scripts/v8_methods.py |
diff --git a/Source/bindings/scripts/v8_methods.py b/Source/bindings/scripts/v8_methods.py |
index 7d2b9f8c2d185e24f6ce5231ec40a29d1f35be9b..e0190cdba1ce700d0bbdc30d0ae1633d28d6a1c9 100644 |
--- a/Source/bindings/scripts/v8_methods.py |
+++ b/Source/bindings/scripts/v8_methods.py |
@@ -197,17 +197,22 @@ def argument_context(interface, method, argument, index): |
has_extended_attribute_value(method, 'TypeChecking', 'Interface')) and |
idl_type.is_wrapper_type) |
- type_checked = (type_checking_interface and |
- # These allow null and undefined values, so a type-check is still required. |
- not idl_type.is_nullable and |
- not (argument.is_optional and |
- 'Default' in extended_attributes)) |
- |
if ('ImplementedInPrivateScript' in extended_attributes and |
not idl_type.is_wrapper_type and |
not idl_type.is_basic_type): |
raise Exception('Private scripts supports only primitive types and DOM wrappers.') |
+ convert_v8_value_to_local_cpp_value = v8_value_to_local_cpp_value( |
+ argument, index, return_promise=method.returns_promise) |
+ |
+ # "Unsafe" conversion, to use when the argument's type has already been |
+ # checked. Set to None if same as regular conversion, to avoid emitting |
+ # duplicate copies of the same code. |
+ convert_v8_value_to_local_cpp_value_unsafe = v8_value_to_local_cpp_value( |
haraken
2014/10/14 13:54:07
convert_v8_value_to_local_cpp_value_unsafe => conv
|
+ argument, index, type_checked=True, return_promise=method.returns_promise) |
haraken
2014/10/14 13:54:07
I'd rename type_checked to needs_type_check and fl
|
+ if convert_v8_value_to_local_cpp_value == convert_v8_value_to_local_cpp_value_unsafe: |
+ convert_v8_value_to_local_cpp_value_unsafe = None |
+ |
default_cpp_value = argument.default_cpp_value |
return { |
'cpp_type': idl_type.cpp_type_args(extended_attributes=extended_attributes, |
@@ -242,7 +247,8 @@ def argument_context(interface, method, argument, index): |
creation_context='scriptState->context()->Global()'), |
'v8_set_return_value': v8_set_return_value(interface.name, method, this_cpp_value), |
'v8_set_return_value_for_main_world': v8_set_return_value(interface.name, method, this_cpp_value, for_main_world=True), |
- 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, index, type_checked, return_promise=method.returns_promise), |
+ 'v8_value_to_local_cpp_value': convert_v8_value_to_local_cpp_value, |
+ 'v8_value_to_local_cpp_value_unsafe': convert_v8_value_to_local_cpp_value_unsafe, |
'vector_type': v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc_type), |
} |
@@ -370,7 +376,7 @@ def v8_value_to_local_cpp_variadic_value(argument, index, return_promise): |
return '%s%s(%s)' % (macro, suffix, ', '.join(macro_args)) |
-def v8_value_to_local_cpp_value(argument, index, type_checked, return_promise=False): |
+def v8_value_to_local_cpp_value(argument, index, type_checked=False, return_promise=False): |
extended_attributes = argument.extended_attributes |
idl_type = argument.idl_type |
name = argument.name |