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 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
222 if member.default_value and not member.default_value.is_null: | 222 if member.default_value and not member.default_value.is_null: |
223 cpp_default_value = idl_type.literal_cpp_value(member.default_value) | 223 cpp_default_value = idl_type.literal_cpp_value(member.default_value) |
224 | 224 |
225 forward_decl_name = idl_type.impl_forward_declaration_name | 225 forward_decl_name = idl_type.impl_forward_declaration_name |
226 if forward_decl_name: | 226 if forward_decl_name: |
227 includes.update(idl_type.impl_includes_for_type(interfaces_info)) | 227 includes.update(idl_type.impl_includes_for_type(interfaces_info)) |
228 header_forward_decls.add(forward_decl_name) | 228 header_forward_decls.add(forward_decl_name) |
229 else: | 229 else: |
230 header_includes.update(idl_type.impl_includes_for_type(interfaces_info)) | 230 header_includes.update(idl_type.impl_includes_for_type(interfaces_info)) |
231 | 231 |
| 232 setter_value = 'value' |
| 233 if idl_type.is_array_buffer_view_or_typed_array: |
| 234 setter_value += '.view()' |
| 235 |
232 return { | 236 return { |
233 'cpp_default_value': cpp_default_value, | 237 'cpp_default_value': cpp_default_value, |
234 'cpp_name': cpp_name, | 238 'cpp_name': cpp_name, |
235 'getter_expression': 'm_' + cpp_name, | 239 'getter_expression': 'm_' + cpp_name, |
236 'getter_name': getter_name_for_dictionary_member(member), | 240 'getter_name': getter_name_for_dictionary_member(member), |
237 'has_method_expression': has_method_expression(), | 241 'has_method_expression': has_method_expression(), |
238 'has_method_name': has_method_name_for_dictionary_member(member), | 242 'has_method_name': has_method_name_for_dictionary_member(member), |
239 'is_nullable': idl_type.is_nullable, | 243 'is_nullable': idl_type.is_nullable, |
240 'is_traceable': idl_type.is_traceable, | 244 'is_traceable': idl_type.is_traceable, |
241 'member_cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=True), | 245 'member_cpp_type': idl_type.cpp_type_args(used_in_cpp_sequence=True), |
242 'null_setter_name': null_setter_name_for_dictionary_member(member), | 246 'null_setter_name': null_setter_name_for_dictionary_member(member), |
243 'nullable_indicator_name': nullable_indicator_name, | 247 'nullable_indicator_name': nullable_indicator_name, |
244 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), | 248 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), |
245 'setter_name': setter_name_for_dictionary_member(member), | 249 'setter_name': setter_name_for_dictionary_member(member), |
| 250 'setter_value': setter_value, |
246 } | 251 } |
OLD | NEW |