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

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

Issue 202203009: Rename |imp| => |impl| in bindings generation (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: custom/v8 too 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 | Annotate | Revision Log
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 idl_type.name in ['NodeFilter', 'XPathNSResolver']): 176 idl_type.name in ['NodeFilter', 'XPathNSResolver']):
177 # FIXME: remove this special case 177 # FIXME: remove this special case
178 return '%s.release()' % argument.name 178 return '%s.release()' % argument.name
179 return argument.name 179 return argument.name
180 180
181 # Truncate omitted optional arguments 181 # Truncate omitted optional arguments
182 arguments = method.arguments[:number_of_arguments] 182 arguments = method.arguments[:number_of_arguments]
183 cpp_arguments = v8_utilities.call_with_arguments(method) 183 cpp_arguments = v8_utilities.call_with_arguments(method)
184 if ('ImplementedBy' in method.extended_attributes and 184 if ('ImplementedBy' in method.extended_attributes and
185 not method.is_static): 185 not method.is_static):
186 cpp_arguments.append('*imp') 186 cpp_arguments.append('*impl')
187 cpp_arguments.extend(cpp_argument(argument) for argument in arguments) 187 cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
188 this_union_arguments = method.idl_type.union_arguments 188 this_union_arguments = method.idl_type.union_arguments
189 if this_union_arguments: 189 if this_union_arguments:
190 cpp_arguments.extend(this_union_arguments) 190 cpp_arguments.extend(this_union_arguments)
191 191
192 if 'RaisesException' in method.extended_attributes: 192 if 'RaisesException' in method.extended_attributes:
193 cpp_arguments.append('exceptionState') 193 cpp_arguments.append('exceptionState')
194 194
195 cpp_method_name = v8_utilities.scoped_name(interface, method, v8_utilities.c pp_name(method)) 195 cpp_method_name = v8_utilities.scoped_name(interface, method, v8_utilities.c pp_name(method))
196 return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) 196 return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
197 197
198 198
199 def v8_set_return_value(interface_name, method, cpp_value, for_main_world=False) : 199 def v8_set_return_value(interface_name, method, cpp_value, for_main_world=False) :
200 idl_type = method.idl_type 200 idl_type = method.idl_type
201 extended_attributes = method.extended_attributes 201 extended_attributes = method.extended_attributes
202 if idl_type.name == 'void': 202 if idl_type.name == 'void':
203 return None 203 return None
204 204
205 release = False 205 release = False
206 # [CallWith=ScriptState], [RaisesException] 206 # [CallWith=ScriptState], [RaisesException]
207 if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or 207 if (has_extended_attribute_value(method, 'CallWith', 'ScriptState') or
208 'RaisesException' in extended_attributes or 208 'RaisesException' in extended_attributes or
209 idl_type.is_union_type): 209 idl_type.is_union_type):
210 cpp_value = 'result' # use local variable for value 210 cpp_value = 'result' # use local variable for value
211 release = idl_type.release 211 release = idl_type.release
212 212
213 script_wrappable = 'imp' if inherits_interface(interface_name, 'Node') else '' 213 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else ''
214 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w rappable=script_wrappable, release=release, for_main_world=for_main_world) 214 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w rappable=script_wrappable, release=release, for_main_world=for_main_world)
215 215
216 216
217 def v8_value_to_local_cpp_value(argument, index): 217 def v8_value_to_local_cpp_value(argument, index):
218 extended_attributes = argument.extended_attributes 218 extended_attributes = argument.extended_attributes
219 idl_type = argument.idl_type 219 idl_type = argument.idl_type
220 name = argument.name 220 name = argument.name
221 if argument.is_variadic: 221 if argument.is_variadic:
222 vector_type = 'WillBeHeapVector' if idl_type.is_will_be_garbage_collecte d else 'Vector' 222 vector_type = 'WillBeHeapVector' if idl_type.is_will_be_garbage_collecte d else 'Vector'
223 return 'V8TRYCATCH_VOID({vector_type}<{cpp_type}>, {name}, toNativeArgum ents<{cpp_type}>(info, {index}))'.format( 223 return 'V8TRYCATCH_VOID({vector_type}<{cpp_type}>, {name}, toNativeArgum ents<{cpp_type}>(info, {index}))'.format(
(...skipping 26 matching lines...) Expand all
250 250
251 251
252 def union_arguments(idl_type): 252 def union_arguments(idl_type):
253 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value""" 253 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value"""
254 return [arg 254 return [arg
255 for i in range(len(idl_type.member_types)) 255 for i in range(len(idl_type.member_types))
256 for arg in ['result%sEnabled' % i, 'result%s' % i]] 256 for arg in ['result%sEnabled' % i, 'result%s' % i]]
257 257
258 IdlType.union_arguments = property(lambda self: None) 258 IdlType.union_arguments = property(lambda self: None)
259 IdlUnionType.union_arguments = property(union_arguments) 259 IdlUnionType.union_arguments = property(union_arguments)
OLDNEW
« no previous file with comments | « Source/bindings/scripts/v8_interface.py ('k') | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698