Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Side by Side Diff: Source/bindings/scripts/v8_dictionary.py

Issue 479563003: IDL: Set dictionary default values in impl constructor (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 copy 9 import copy
10 import operator 10 import operator
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 return '!m_%s.isNull()' % member.name 114 return '!m_%s.isNull()' % member.name
115 else: 115 else:
116 return 'm_%s' % member.name 116 return 'm_%s' % member.name
117 117
118 def member_cpp_type(): 118 def member_cpp_type():
119 member_cpp_type = idl_type.cpp_type_args(used_in_cpp_sequence=True) 119 member_cpp_type = idl_type.cpp_type_args(used_in_cpp_sequence=True)
120 if idl_type.impl_should_use_nullable_container: 120 if idl_type.impl_should_use_nullable_container:
121 return v8_types.cpp_template_type('Nullable', member_cpp_type) 121 return v8_types.cpp_template_type('Nullable', member_cpp_type)
122 return member_cpp_type 122 return member_cpp_type
123 123
124 cpp_default_value = None
125 if member.default_value and not member.default_value.is_null:
126 cpp_default_value = str(member.default_value)
127
124 header_includes.update(idl_type.impl_includes_for_type(interfaces_info)) 128 header_includes.update(idl_type.impl_includes_for_type(interfaces_info))
125 return { 129 return {
130 'cpp_default_value': cpp_default_value,
126 'getter_expression': getter_expression(), 131 'getter_expression': getter_expression(),
127 'has_method_expression': has_method_expression(), 132 'has_method_expression': has_method_expression(),
128 'has_method_name': has_method_name_for_dictionary_member(member), 133 'has_method_name': has_method_name_for_dictionary_member(member),
129 'is_traceable': (idl_type.is_garbage_collected or 134 'is_traceable': (idl_type.is_garbage_collected or
130 idl_type.is_will_be_garbage_collected), 135 idl_type.is_will_be_garbage_collected),
131 'member_cpp_type': member_cpp_type(), 136 'member_cpp_type': member_cpp_type(),
132 'name': member.name, 137 'name': member.name,
133 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), 138 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
134 'setter_name': setter_name_for_dictionary_member(member), 139 'setter_name': setter_name_for_dictionary_member(member),
135 } 140 }
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/dictionary_impl.h » ('j') | Source/bindings/templates/dictionary_impl.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698