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

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

Issue 724733002: Support for [Clamp] and [EnforceRange] to IDL dictionary. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 operator 9 import operator
10 from idl_types import IdlType 10 from idl_types import IdlType
11 from v8_globals import includes 11 from v8_globals import includes
12 import v8_types 12 import v8_types
13 import v8_utilities 13 import v8_utilities
14 14
15 15
16 DICTIONARY_H_INCLUDES = frozenset([ 16 DICTIONARY_H_INCLUDES = frozenset([
17 'bindings/core/v8/V8Binding.h', 17 'bindings/core/v8/V8Binding.h',
18 'platform/heap/Handle.h', 18 'platform/heap/Handle.h',
19 ]) 19 ])
20 20
21 DICTIONARY_CPP_INCLUDES = frozenset([ 21 DICTIONARY_CPP_INCLUDES = frozenset([
22 'bindings/core/v8/ExceptionState.h', 22 'bindings/core/v8/ExceptionState.h',
23 # FIXME: Remove this, http://crbug.com/321462
24 'bindings/core/v8/Dictionary.h',
25 ]) 23 ])
26 24
27 25
28 def setter_name_for_dictionary_member(member): 26 def setter_name_for_dictionary_member(member):
29 name = v8_utilities.cpp_name(member) 27 name = v8_utilities.cpp_name(member)
30 return 'set%s' % v8_utilities.capitalize(name) 28 return 'set%s' % v8_utilities.capitalize(name)
31 29
32 30
33 def has_method_name_for_dictionary_member(member): 31 def has_method_name_for_dictionary_member(member):
34 name = v8_utilities.cpp_name(member) 32 name = v8_utilities.cpp_name(member)
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value( 90 'cpp_value_to_v8_value': idl_type.cpp_value_to_v8_value(
93 cpp_value='impl.%s()' % cpp_name, isolate='isolate', 91 cpp_value='impl.%s()' % cpp_name, isolate='isolate',
94 creation_context='creationContext', 92 creation_context='creationContext',
95 extended_attributes=member.extended_attributes), 93 extended_attributes=member.extended_attributes),
96 'enum_validation_expression': idl_type.enum_validation_expression, 94 'enum_validation_expression': idl_type.enum_validation_expression,
97 'has_method_name': has_method_name_for_dictionary_member(member), 95 'has_method_name': has_method_name_for_dictionary_member(member),
98 'is_object': idl_type.name == 'Object', 96 'is_object': idl_type.name == 'Object',
99 'name': member.name, 97 'name': member.name,
100 'setter_name': setter_name_for_dictionary_member(member), 98 'setter_name': setter_name_for_dictionary_member(member),
101 'v8_default_value': v8_default_value, 99 'v8_default_value': v8_default_value,
100 'v8_value_to_local_cpp_value': idl_type.v8_value_to_local_cpp_value(
101 member.extended_attributes, member.name + 'Value',
102 member.name, isolate='isolate'),
102 } 103 }
103 104
104 105
105 # Context for implementation classes 106 # Context for implementation classes
106 107
107 def dictionary_impl_context(dictionary, interfaces_info): 108 def dictionary_impl_context(dictionary, interfaces_info):
108 includes.clear() 109 includes.clear()
109 header_includes = set(['platform/heap/Handle.h']) 110 header_includes = set(['platform/heap/Handle.h'])
110 context = { 111 context = {
111 'header_includes': header_includes, 112 'header_includes': header_includes,
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 'cpp_name': cpp_name, 159 'cpp_name': cpp_name,
159 'getter_expression': getter_expression(), 160 'getter_expression': getter_expression(),
160 'has_method_expression': has_method_expression(), 161 'has_method_expression': has_method_expression(),
161 'has_method_name': has_method_name_for_dictionary_member(member), 162 'has_method_name': has_method_name_for_dictionary_member(member),
162 'is_object': is_object, 163 'is_object': is_object,
163 'is_traceable': idl_type.is_traceable, 164 'is_traceable': idl_type.is_traceable,
164 'member_cpp_type': member_cpp_type(), 165 'member_cpp_type': member_cpp_type(),
165 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True), 166 'rvalue_cpp_type': idl_type.cpp_type_args(used_as_rvalue_type=True),
166 'setter_name': setter_name_for_dictionary_member(member), 167 'setter_name': setter_name_for_dictionary_member(member),
167 } 168 }
OLDNEW
« no previous file with comments | « LayoutTests/fast/dom/idl-dictionary-unittest-expected.txt ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698