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

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

Issue 185413023: Oilpan: move Touch related objects to the oilpan heap. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Improve element type of variadic vectors Created 6 years, 9 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 (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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True), 133 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True),
134 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value), 134 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value),
135 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended _attributes else [''], # [PerWorldBindings] 135 'world_suffixes': ['', 'ForMainWorld'] if 'PerWorldBindings' in extended _attributes else [''], # [PerWorldBindings]
136 } 136 }
137 137
138 138
139 def generate_argument(interface, method, argument, index): 139 def generate_argument(interface, method, argument, index):
140 extended_attributes = argument.extended_attributes 140 extended_attributes = argument.extended_attributes
141 idl_type = argument.idl_type 141 idl_type = argument.idl_type
142 this_cpp_value = cpp_value(interface, method, index) 142 this_cpp_value = cpp_value(interface, method, index)
143 is_variadic_wrapper_type = argument.is_variadic and v8_types.is_wrapper_type (idl_type)
144 use_heap_vector_type = is_variadic_wrapper_type and v8_types.is_will_be_garb age_collected(idl_type)
143 return { 145 return {
144 'cpp_type': v8_types.cpp_type(idl_type), 146 'cpp_type': v8_types.cpp_type(idl_type, used_as_member=use_heap_vector_t ype),
145 'cpp_value': this_cpp_value, 147 'cpp_value': this_cpp_value,
146 'enum_validation_expression': v8_utilities.enum_validation_expression(id l_type), 148 'enum_validation_expression': v8_utilities.enum_validation_expression(id l_type),
147 'has_default': 'Default' in extended_attributes, 149 'has_default': 'Default' in extended_attributes,
148 'idl_type': idl_type, 150 'idl_type': idl_type,
149 'index': index, 151 'index': index,
150 'is_clamp': 'Clamp' in extended_attributes, 152 'is_clamp': 'Clamp' in extended_attributes,
151 'is_callback_interface': v8_types.is_callback_interface(idl_type), 153 'is_callback_interface': v8_types.is_callback_interface(idl_type),
152 'is_nullable': argument.is_nullable, 154 'is_nullable': argument.is_nullable,
153 'is_optional': argument.is_optional, 155 'is_optional': argument.is_optional,
154 'is_strict_type_checking': 'StrictTypeChecking' in extended_attributes, 156 'is_strict_type_checking': 'StrictTypeChecking' in extended_attributes,
155 'is_variadic_wrapper_type': argument.is_variadic and v8_types.is_wrapper _type(idl_type), 157 'is_variadic_wrapper_type': is_variadic_wrapper_type,
158 'vector_type': 'WillBeHeapVector' if use_heap_vector_type else 'Vector',
Nils Barth (inactive) 2014/03/05 07:49:13 +haraken@: thoughts on naming? Technically Vector/
sof 2014/03/05 08:15:17 I think vector_type is fine (possibly with a cpp_
Nils Barth (inactive) 2014/03/05 09:20:10 Barring objections from haraken, this seems fine.
156 'is_wrapper_type': v8_types.is_wrapper_type(idl_type), 159 'is_wrapper_type': v8_types.is_wrapper_type(idl_type),
157 'name': argument.name, 160 'name': argument.name,
158 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True), 161 'v8_set_return_value_for_main_world': v8_set_return_value(interface.name , method, this_cpp_value, for_main_world=True),
159 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value), 162 'v8_set_return_value': v8_set_return_value(interface.name, method, this_ cpp_value),
160 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, ind ex), 163 'v8_value_to_local_cpp_value': v8_value_to_local_cpp_value(argument, ind ex),
161 } 164 }
162 165
163 166
164 ################################################################################ 167 ################################################################################
165 # Value handling 168 # Value handling
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 218
216 script_wrappable = 'imp' if v8_types.inherits_interface(interface_name, 'Nod e') else '' 219 script_wrappable = 'imp' if v8_types.inherits_interface(interface_name, 'Nod e') else ''
217 return v8_types.v8_set_return_value(idl_type, cpp_value, extended_attributes , script_wrappable=script_wrappable, release=release, for_main_world=for_main_wo rld) 220 return v8_types.v8_set_return_value(idl_type, cpp_value, extended_attributes , script_wrappable=script_wrappable, release=release, for_main_world=for_main_wo rld)
218 221
219 222
220 def v8_value_to_local_cpp_value(argument, index): 223 def v8_value_to_local_cpp_value(argument, index):
221 extended_attributes = argument.extended_attributes 224 extended_attributes = argument.extended_attributes
222 idl_type = argument.idl_type 225 idl_type = argument.idl_type
223 name = argument.name 226 name = argument.name
224 if argument.is_variadic: 227 if argument.is_variadic:
225 return 'V8TRYCATCH_VOID(Vector<{cpp_type}>, {name}, toNativeArguments<{c pp_type}>(info, {index}))'.format( 228 vector_type = 'WillBeHeapVector' if v8_types.is_will_be_garbage_collecte d(idl_type) else 'Vector'
226 cpp_type=v8_types.cpp_type(idl_type), name=name, index=index) 229 return 'V8TRYCATCH_VOID({vector_type}<{cpp_type}>, {name}, toNativeArgum ents<{cpp_type}>(info, {index}))'.format(
230 cpp_type=v8_types.cpp_type(idl_type), name=name, index=index, ve ctor_type=vector_type)
227 # [Default=NullString] 231 # [Default=NullString]
228 if (argument.is_optional and idl_type == 'DOMString' and 232 if (argument.is_optional and idl_type == 'DOMString' and
229 extended_attributes.get('Default') == 'NullString'): 233 extended_attributes.get('Default') == 'NullString'):
230 v8_value = 'argumentOrNull(info, %s)' % index 234 v8_value = 'argumentOrNull(info, %s)' % index
231 else: 235 else:
232 v8_value = 'info[%s]' % index 236 v8_value = 'info[%s]' % index
233 return v8_types.v8_value_to_local_cpp_value( 237 return v8_types.v8_value_to_local_cpp_value(
234 idl_type, argument.extended_attributes, v8_value, name, index=index) 238 idl_type, argument.extended_attributes, v8_value, name, index=index)
235 239
236 240
(...skipping 14 matching lines...) Expand all
251 return property_attributes_list 255 return property_attributes_list
252 256
253 257
254 def union_arguments(idl_type): 258 def union_arguments(idl_type):
255 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value""" 259 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value"""
256 if not v8_types.is_union_type(idl_type): 260 if not v8_types.is_union_type(idl_type):
257 return None 261 return None
258 return [arg 262 return [arg
259 for i in range(len(idl_type.union_member_types)) 263 for i in range(len(idl_type.union_member_types))
260 for arg in ['result%sEnabled' % i, 'result%s' % i]] 264 for arg in ['result%sEnabled' % i, 'result%s' % i]]
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698