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

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

Issue 234403004: Rename V8TRYCATCH_* macros in v8/V8BindingMacros.h (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: BOOL*_BOOL -> BOOL* Created 6 years, 8 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 | « no previous file | 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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else '' 242 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else ''
243 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w rappable=script_wrappable, release=release, for_main_world=for_main_world) 243 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w rappable=script_wrappable, release=release, for_main_world=for_main_world)
244 244
245 245
246 def v8_value_to_local_cpp_value(argument, index): 246 def v8_value_to_local_cpp_value(argument, index):
247 extended_attributes = argument.extended_attributes 247 extended_attributes = argument.extended_attributes
248 idl_type = argument.idl_type 248 idl_type = argument.idl_type
249 name = argument.name 249 name = argument.name
250 if argument.is_variadic: 250 if argument.is_variadic:
251 vector_type = v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc_ type) 251 vector_type = v8_types.cpp_ptr_type('Vector', 'HeapVector', idl_type.gc_ type)
252 return 'V8TRYCATCH_VOID({vector_type}<{cpp_type}>, {name}, toNativeArgum ents<{cpp_type}>(info, {index}))'.format( 252 return 'TONATIVE_VOID({vector_type}<{cpp_type}>, {name}, toNativeArgumen ts<{cpp_type}>(info, {index}))'.format(
253 cpp_type=idl_type.cpp_type, name=name, index=index, vector_type= vector_type) 253 vector_type=vector_type, cpp_type=idl_type.cpp_type, name=name,
254 index=index)
254 # [Default=NullString] 255 # [Default=NullString]
255 if (argument.is_optional and idl_type.name == 'String' and 256 if (argument.is_optional and idl_type.name == 'String' and
256 extended_attributes.get('Default') == 'NullString'): 257 extended_attributes.get('Default') == 'NullString'):
257 v8_value = 'argumentOrNull(info, %s)' % index 258 v8_value = 'argumentOrNull(info, %s)' % index
258 else: 259 else:
259 v8_value = 'info[%s]' % index 260 v8_value = 'info[%s]' % index
260 return idl_type.v8_value_to_local_cpp_value(argument.extended_attributes, 261 return idl_type.v8_value_to_local_cpp_value(extended_attributes, v8_value,
261 v8_value, name, index=index) 262 name, index=index)
262 263
263 264
264 ################################################################################ 265 ################################################################################
265 # Auxiliary functions 266 # Auxiliary functions
266 ################################################################################ 267 ################################################################################
267 268
268 # [NotEnumerable] 269 # [NotEnumerable]
269 def property_attributes(method): 270 def property_attributes(method):
270 extended_attributes = method.extended_attributes 271 extended_attributes = method.extended_attributes
271 property_attributes_list = [] 272 property_attributes_list = []
272 if 'NotEnumerable' in extended_attributes: 273 if 'NotEnumerable' in extended_attributes:
273 property_attributes_list.append('v8::DontEnum') 274 property_attributes_list.append('v8::DontEnum')
274 if 'ReadOnly' in extended_attributes: 275 if 'ReadOnly' in extended_attributes:
275 property_attributes_list.append('v8::ReadOnly') 276 property_attributes_list.append('v8::ReadOnly')
276 if property_attributes_list: 277 if property_attributes_list:
277 property_attributes_list.insert(0, 'v8::DontDelete') 278 property_attributes_list.insert(0, 'v8::DontDelete')
278 return property_attributes_list 279 return property_attributes_list
279 280
280 281
281 def union_arguments(idl_type): 282 def union_arguments(idl_type):
282 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value""" 283 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value"""
283 return [arg 284 return [arg
284 for i in range(len(idl_type.member_types)) 285 for i in range(len(idl_type.member_types))
285 for arg in ['result%sEnabled' % i, 'result%s' % i]] 286 for arg in ['result%sEnabled' % i, 'result%s' % i]]
286 287
287 IdlType.union_arguments = property(lambda self: None) 288 IdlType.union_arguments = property(lambda self: None)
288 IdlUnionType.union_arguments = property(union_arguments) 289 IdlUnionType.union_arguments = property(union_arguments)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698