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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
101 idl_type.is_explicit_nullable) | 101 idl_type.is_explicit_nullable) |
102 | 102 |
103 | 103 |
104 def method_context(interface, method, is_visible=True): | 104 def method_context(interface, method, is_visible=True): |
105 arguments = method.arguments | 105 arguments = method.arguments |
106 extended_attributes = method.extended_attributes | 106 extended_attributes = method.extended_attributes |
107 idl_type = method.idl_type | 107 idl_type = method.idl_type |
108 is_static = method.is_static | 108 is_static = method.is_static |
109 name = method.name | 109 name = method.name |
110 | 110 |
111 # TODO(binji): better way to do this? | |
112 if idl_type.is_explicit_nullable: | |
113 this_cpp_type = v8_types.cpp_template_type('Nullable', | |
114 idl_type.cpp_type) | |
115 elif idl_type.is_array_buffer_view_or_typed_array: | |
116 this_cpp_type = '%s::TypedArrayType*' % idl_type.cpp_type | |
haraken
2017/04/06 08:43:54
How is this type used? I cannot find this type in
binji
2017/04/09 00:40:02
This happens when a interface method returns an Ar
| |
117 else: | |
118 this_cpp_type = idl_type.cpp_type | |
119 | |
111 if is_visible: | 120 if is_visible: |
112 idl_type.add_includes_for_type(extended_attributes) | 121 idl_type.add_includes_for_type(extended_attributes) |
113 | 122 |
114 this_cpp_value = cpp_value(interface, method, len(arguments)) | 123 this_cpp_value = cpp_value(interface, method, len(arguments)) |
115 | 124 |
116 is_call_with_script_arguments = has_extended_attribute_value(method, 'CallWi th', 'ScriptArguments') | 125 is_call_with_script_arguments = has_extended_attribute_value(method, 'CallWi th', 'ScriptArguments') |
117 if is_call_with_script_arguments: | 126 if is_call_with_script_arguments: |
118 includes.update(['bindings/core/v8/ScriptCallStack.h', | 127 includes.update(['bindings/core/v8/ScriptCallStack.h', |
119 'core/inspector/ScriptArguments.h']) | 128 'core/inspector/ScriptArguments.h']) |
120 is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState') | 129 is_call_with_script_state = has_extended_attribute_value(method, 'CallWith', 'ScriptState') |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 if 'LenientThis' in extended_attributes: | 161 if 'LenientThis' in extended_attributes: |
153 raise Exception('[LenientThis] is not supported for operations.') | 162 raise Exception('[LenientThis] is not supported for operations.') |
154 | 163 |
155 argument_contexts = [ | 164 argument_contexts = [ |
156 argument_context(interface, method, argument, index, is_visible=is_visib le) | 165 argument_context(interface, method, argument, index, is_visible=is_visib le) |
157 for index, argument in enumerate(arguments)] | 166 for index, argument in enumerate(arguments)] |
158 | 167 |
159 return { | 168 return { |
160 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging] | 169 'activity_logging_world_list': v8_utilities.activity_logging_world_list( method), # [ActivityLogging] |
161 'arguments': argument_contexts, | 170 'arguments': argument_contexts, |
162 'cpp_type': (v8_types.cpp_template_type('Nullable', idl_type.cpp_type) | 171 'cpp_type': this_cpp_type, |
163 if idl_type.is_explicit_nullable else idl_type.cpp_type), | |
164 'cpp_value': this_cpp_value, | 172 'cpp_value': this_cpp_value, |
165 'cpp_type_initializer': idl_type.cpp_type_initializer, | 173 'cpp_type_initializer': idl_type.cpp_type_initializer, |
166 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] | 174 'deprecate_as': v8_utilities.deprecate_as(method), # [DeprecateAs] |
167 'do_not_test_new_object': 'DoNotTestNewObject' in extended_attributes, | 175 'do_not_test_new_object': 'DoNotTestNewObject' in extended_attributes, |
168 'exposed_test': v8_utilities.exposed(method, interface), # [Exposed] | 176 'exposed_test': v8_utilities.exposed(method, interface), # [Exposed] |
169 'has_exception_state': | 177 'has_exception_state': |
170 is_raises_exception or | 178 is_raises_exception or |
171 is_check_security_for_receiver or | 179 is_check_security_for_receiver or |
172 any(argument for argument in arguments | 180 any(argument for argument in arguments |
173 if (argument.idl_type.name == 'SerializedScriptValue' or | 181 if (argument.idl_type.name == 'SerializedScriptValue' or |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
446 return method.idl_type and method.idl_type.name == 'Promise' | 454 return method.idl_type and method.idl_type.name == 'Promise' |
447 | 455 |
448 IdlOperation.returns_promise = property(method_returns_promise) | 456 IdlOperation.returns_promise = property(method_returns_promise) |
449 | 457 |
450 | 458 |
451 def argument_conversion_needs_exception_state(method, argument): | 459 def argument_conversion_needs_exception_state(method, argument): |
452 idl_type = argument.idl_type | 460 idl_type = argument.idl_type |
453 return (idl_type.v8_conversion_needs_exception_state or | 461 return (idl_type.v8_conversion_needs_exception_state or |
454 argument.is_variadic or | 462 argument.is_variadic or |
455 (method.returns_promise and idl_type.is_string_type)) | 463 (method.returns_promise and idl_type.is_string_type)) |
OLD | NEW |