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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 idl_type.is_explicit_nullable) | 63 idl_type.is_explicit_nullable) |
64 | 64 |
65 | 65 |
66 def method_context(interface, method, is_visible=True): | 66 def method_context(interface, method, is_visible=True): |
67 arguments = method.arguments | 67 arguments = method.arguments |
68 extended_attributes = method.extended_attributes | 68 extended_attributes = method.extended_attributes |
69 idl_type = method.idl_type | 69 idl_type = method.idl_type |
70 is_static = method.is_static | 70 is_static = method.is_static |
71 name = method.name | 71 name = method.name |
72 | 72 |
73 idl_type.add_includes_for_type() | 73 if is_visible: |
| 74 idl_type.add_includes_for_type(extended_attributes) |
| 75 |
74 this_cpp_value = cpp_value(interface, method, len(arguments)) | 76 this_cpp_value = cpp_value(interface, method, len(arguments)) |
75 | 77 |
76 def function_template(): | 78 def function_template(): |
77 if is_static: | 79 if is_static: |
78 return 'functionTemplate' | 80 return 'functionTemplate' |
79 if is_unforgeable(interface, method): | 81 if is_unforgeable(interface, method): |
80 return 'instanceTemplate' | 82 return 'instanceTemplate' |
81 return 'prototypeTemplate' | 83 return 'prototypeTemplate' |
82 | 84 |
83 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_
attributes | 85 is_implemented_in_private_script = 'ImplementedInPrivateScript' in extended_
attributes |
(...skipping 28 matching lines...) Expand all Loading... |
112 | 114 |
113 is_check_security_for_window = ( | 115 is_check_security_for_window = ( |
114 has_extended_attribute_value(interface, 'CheckSecurity', 'Window') and | 116 has_extended_attribute_value(interface, 'CheckSecurity', 'Window') and |
115 not is_do_not_check_security) | 117 not is_do_not_check_security) |
116 | 118 |
117 is_raises_exception = 'RaisesException' in extended_attributes | 119 is_raises_exception = 'RaisesException' in extended_attributes |
118 is_custom_call_epilogue = has_extended_attribute_value(method, 'Custom', 'Ca
llEpilogue') | 120 is_custom_call_epilogue = has_extended_attribute_value(method, 'Custom', 'Ca
llEpilogue') |
119 | 121 |
120 return { | 122 return { |
121 'activity_logging_world_list': v8_utilities.activity_logging_world_list(
method), # [ActivityLogging] | 123 'activity_logging_world_list': v8_utilities.activity_logging_world_list(
method), # [ActivityLogging] |
122 'arguments': [argument_context(interface, method, argument, index) | 124 'arguments': [argument_context(interface, method, argument, index, is_vi
sible=is_visible) |
123 for index, argument in enumerate(arguments)], | 125 for index, argument in enumerate(arguments)], |
124 'argument_declarations_for_private_script': | 126 'argument_declarations_for_private_script': |
125 argument_declarations_for_private_script(interface, method), | 127 argument_declarations_for_private_script(interface, method), |
126 'conditional_string': v8_utilities.conditional_string(method), | 128 'conditional_string': v8_utilities.conditional_string(method), |
127 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type) | 129 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type) |
128 if idl_type.is_explicit_nullable else idl_type.cpp_type), | 130 if idl_type.is_explicit_nullable else idl_type.cpp_type), |
129 'cpp_value': this_cpp_value, | 131 'cpp_value': this_cpp_value, |
130 'cpp_type_initializer': idl_type.cpp_type_initializer, | 132 'cpp_type_initializer': idl_type.cpp_type_initializer, |
131 'custom_registration_extended_attributes': | 133 'custom_registration_extended_attributes': |
132 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( | 134 CUSTOM_REGISTRATION_EXTENDED_ATTRIBUTES.intersection( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSig
nature' in extended_attributes else 'defaultSignature', | 190 'signature': 'v8::Local<v8::Signature>()' if is_static or 'DoNotCheckSig
nature' in extended_attributes else 'defaultSignature', |
189 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res
ult, | 191 'use_output_parameter_for_result': idl_type.use_output_parameter_for_res
ult, |
190 'use_local_result': use_local_result(method), | 192 'use_local_result': use_local_result(method), |
191 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), | 193 'v8_set_return_value': v8_set_return_value(interface.name, method, this_
cpp_value), |
192 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), | 194 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name
, method, this_cpp_value, for_main_world=True), |
193 'visible': is_visible, | 195 'visible': is_visible, |
194 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended
_attributes else [''], # [PerWorldBindings], | 196 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended
_attributes else [''], # [PerWorldBindings], |
195 } | 197 } |
196 | 198 |
197 | 199 |
198 def argument_context(interface, method, argument, index): | 200 def argument_context(interface, method, argument, index, is_visible=True): |
199 extended_attributes = argument.extended_attributes | 201 extended_attributes = argument.extended_attributes |
200 idl_type = argument.idl_type | 202 idl_type = argument.idl_type |
| 203 if is_visible: |
| 204 idl_type.add_includes_for_type(extended_attributes) |
201 this_cpp_value = cpp_value(interface, method, index) | 205 this_cpp_value = cpp_value(interface, method, index) |
202 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type | 206 is_variadic_wrapper_type = argument.is_variadic and idl_type.is_wrapper_type |
203 | 207 |
204 # [TypeChecking=Interface] / [LegacyInterfaceTypeChecking] | 208 # [TypeChecking=Interface] / [LegacyInterfaceTypeChecking] |
205 has_type_checking_interface = ( | 209 has_type_checking_interface = ( |
206 not is_legacy_interface_type_checking(interface, method) and | 210 not is_legacy_interface_type_checking(interface, method) and |
207 idl_type.is_wrapper_type) | 211 idl_type.is_wrapper_type) |
208 | 212 |
209 if ('ImplementedInPrivateScript' in extended_attributes and | 213 if ('ImplementedInPrivateScript' in extended_attributes and |
210 not idl_type.is_wrapper_type and | 214 not idl_type.is_wrapper_type and |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 return method.idl_type and method.idl_type.name == 'Promise' | 456 return method.idl_type and method.idl_type.name == 'Promise' |
453 | 457 |
454 IdlOperation.returns_promise = property(method_returns_promise) | 458 IdlOperation.returns_promise = property(method_returns_promise) |
455 | 459 |
456 | 460 |
457 def argument_conversion_needs_exception_state(method, argument): | 461 def argument_conversion_needs_exception_state(method, argument): |
458 idl_type = argument.idl_type | 462 idl_type = argument.idl_type |
459 return (idl_type.v8_conversion_needs_exception_state or | 463 return (idl_type.v8_conversion_needs_exception_state or |
460 argument.is_variadic or | 464 argument.is_variadic or |
461 (method.returns_promise and idl_type.is_string_type)) | 465 (method.returns_promise and idl_type.is_string_type)) |
OLD | NEW |