| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 """Generate template contexts of dictionaries for both v8 bindings and | 5 """Generate template contexts of dictionaries for both v8 bindings and |
| 6 implementation classes that are used by blink's core/modules. | 6 implementation classes that are used by blink's core/modules. |
| 7 """ | 7 """ |
| 8 | 8 |
| 9 import operator | 9 import operator |
| 10 from idl_types import IdlType | 10 from idl_types import IdlType |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 if member.default_value and not member.default_value.is_null: | 224 if member.default_value and not member.default_value.is_null: |
| 225 cpp_default_value = idl_type.literal_cpp_value(member.default_value) | 225 cpp_default_value = idl_type.literal_cpp_value(member.default_value) |
| 226 | 226 |
| 227 forward_decl_name = idl_type.impl_forward_declaration_name | 227 forward_decl_name = idl_type.impl_forward_declaration_name |
| 228 if forward_decl_name: | 228 if forward_decl_name: |
| 229 includes.update(idl_type.impl_includes_for_type(interfaces_info)) | 229 includes.update(idl_type.impl_includes_for_type(interfaces_info)) |
| 230 header_forward_decls.add(forward_decl_name) | 230 header_forward_decls.add(forward_decl_name) |
| 231 else: | 231 else: |
| 232 header_includes.update(idl_type.impl_includes_for_type(interfaces_info)) | 232 header_includes.update(idl_type.impl_includes_for_type(interfaces_info)) |
| 233 | 233 |
| 234 setter_value = 'value' | |
| 235 if idl_type.is_array_buffer_view_or_typed_array: | |
| 236 setter_value += '.View()' | |
| 237 | |
| 238 return { | 234 return { |
| 239 'cpp_default_value': cpp_default_value, | 235 'cpp_default_value': cpp_default_value, |
| 240 'cpp_name': cpp_name, | 236 'cpp_name': cpp_name, |
| 241 'getter_expression': 'm_' + cpp_name, | 237 'getter_expression': 'm_' + cpp_name, |
| 242 'getter_name': getter_name_for_dictionary_member(member), | 238 'getter_name': getter_name_for_dictionary_member(member), |
| 243 'has_method_expression': has_method_expression(), | 239 'has_method_expression': has_method_expression(), |
| 244 'has_method_name': has_method_name_for_dictionary_member(member), | 240 'has_method_name': has_method_name_for_dictionary_member(member), |
| 245 'is_nullable': idl_type.is_nullable, | 241 'is_nullable': idl_type.is_nullable, |
| 246 'is_traceable': idl_type.is_traceable, | 242 'is_traceable': idl_type.is_traceable, |
| 247 'member_cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=True), | 243 'member_cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=True), |
| 248 'null_setter_name': null_setter_name_for_dictionary_member(member), | 244 'null_setter_name': null_setter_name_for_dictionary_member(member), |
| 249 'nullable_indicator_name': nullable_indicator_name, | 245 'nullable_indicator_name': nullable_indicator_name, |
| 250 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), | 246 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), |
| 251 'setter_name': setter_name_for_dictionary_member(member), | 247 'setter_name': setter_name_for_dictionary_member(member), |
| 252 'setter_value': setter_value, | |
| 253 } | 248 } |
| OLD | NEW |