| OLD | NEW |
| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 def use_local_result(method): | 55 def use_local_result(method): |
| 56 extended_attributes = method.extended_attributes | 56 extended_attributes = method.extended_attributes |
| 57 idl_type = method.idl_type | 57 idl_type = method.idl_type |
| 58 return (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or | 58 return (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or |
| 59 'ImplementedInPrivateScript' in extended_attributes or | 59 'ImplementedInPrivateScript' in extended_attributes or |
| 60 'RaisesException' in extended_attributes or | 60 'RaisesException' in extended_attributes or |
| 61 idl_type.is_union_type or | 61 idl_type.is_union_type or |
| 62 idl_type.is_explicit_nullable) | 62 idl_type.is_explicit_nullable) |
| 63 | 63 |
| 64 | 64 |
| 65 def method_context(interface, method): | 65 def method_context(interface, method, is_visible=True): |
| 66 arguments = method.arguments | 66 arguments = method.arguments |
| 67 extended_attributes = method.extended_attributes | 67 extended_attributes = method.extended_attributes |
| 68 idl_type = method.idl_type | 68 idl_type = method.idl_type |
| 69 is_static = method.is_static | 69 is_static = method.is_static |
| 70 name = method.name | 70 name = method.name |
| 71 | 71 |
| 72 idl_type.add_includes_for_type() | 72 idl_type.add_includes_for_type() |
| 73 this_cpp_value = cpp_value(interface, method, len(arguments)) | 73 this_cpp_value = cpp_value(interface, method, len(arguments)) |
| 74 | 74 |
| 75 def function_template(): | 75 def function_template(): |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local
_cpp_value( | 175 'private_script_v8_value_to_local_cpp_value': idl_type.v8_value_to_local
_cpp_value( |
| 176 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is
olate()', used_in_private_script=True), | 176 extended_attributes, 'v8Value', 'cppValue', isolate='scriptState->is
olate()', used_in_private_script=True), |
| 177 'property_attributes': property_attributes(method), | 177 'property_attributes': property_attributes(method), |
| 178 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m
ethod), # [RuntimeEnabled] | 178 'runtime_enabled_function': v8_utilities.runtime_enabled_function_name(m
ethod), # [RuntimeEnabled] |
| 179 'should_be_exposed_to_script': not (is_implemented_in_private_script and
is_only_exposed_to_private_script), | 179 'should_be_exposed_to_script': not (is_implemented_in_private_script and
is_only_exposed_to_private_script), |
| 180 'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSig
nature' in extended_attributes else 'defaultSignature', | 180 'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSig
nature' in extended_attributes else 'defaultSignature', |
| 181 'union_arguments': idl_type.union_arguments, | 181 'union_arguments': idl_type.union_arguments, |
| 182 'use_local_result': use_local_result(method), | 182 'use_local_result': use_local_result(method), |
| 183 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), | 183 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), |
| 184 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), | 184 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), |
| 185 'visible': is_visible, |
| 185 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended
_attributes else [''], # [PerWorldBindings], | 186 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended
_attributes else [''], # [PerWorldBindings], |
| 186 } | 187 } |
| 187 | 188 |
| 188 | 189 |
| 189 def argument_context(interface, method, argument, index): | 190 def argument_context(interface, method, argument, index): |
| 190 extended_attributes = argument.extended_attributes | 191 extended_attributes = argument.extended_attributes |
| 191 idl_type = argument.idl_type | 192 idl_type = argument.idl_type |
| 192 this_cpp_value = cpp_value(interface, method, index) | 193 this_cpp_value = cpp_value(interface, method, index) |
| 193 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type | 194 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type |
| 194 | 195 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 450 |
| 450 IdlOperation.returns_promise = property(method_returns_promise) | 451 IdlOperation.returns_promise = property(method_returns_promise) |
| 451 | 452 |
| 452 | 453 |
| 453 def argument_conversion_needs_exception_state(method, argument): | 454 def argument_conversion_needs_exception_state(method, argument): |
| 454 idl_type = argument.idl_type | 455 idl_type = argument.idl_type |
| 455 return (idl_type.v8_conversion_needs_exception_state or | 456 return (idl_type.v8_conversion_needs_exception_state or |
| 456 argument.is_variadic or | 457 argument.is_variadic or |
| 457 (method.returns_promise and (idl_type.is_string_type or | 458 (method.returns_promise and (idl_type.is_string_type or |
| 458 idl_type.is_enum))) | 459 idl_type.is_enum))) |
| OLD | NEW |