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

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

Issue 2329463004: ABANDONED CL: Changes needed to make things compile after running rewrite_to_chrome_style tool. (Closed)
Patch Set: More fixes - things build fine at this point. Created 3 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
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 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 has_extended_attribute_value(interface, 'RaisesException', 'Construct or'))): 315 has_extended_attribute_value(interface, 'RaisesException', 'Construct or'))):
316 cpp_arguments.append('exceptionState') 316 cpp_arguments.append('exceptionState')
317 317
318 # If a method returns an IDL dictionary or union type, the return value is 318 # If a method returns an IDL dictionary or union type, the return value is
319 # passed as an argument to impl classes. 319 # passed as an argument to impl classes.
320 idl_type = method.idl_type 320 idl_type = method.idl_type
321 if idl_type and idl_type.use_output_parameter_for_result: 321 if idl_type and idl_type.use_output_parameter_for_result:
322 cpp_arguments.append('result') 322 cpp_arguments.append('result')
323 323
324 if method.name == 'Constructor': 324 if method.name == 'Constructor':
325 base_name = 'create' 325 base_name = 'Create'
326 elif method.name == 'NamedConstructor': 326 elif method.name == 'NamedConstructor':
327 base_name = 'createForJSConstructor' 327 base_name = 'CreateForJSConstructor'
328 else: 328 else:
329 base_name = v8_utilities.cpp_name(method) 329 base_name = v8_utilities.cpp_name(method)
330 330
331 cpp_method_name = v8_utilities.scoped_name(interface, method, base_name) 331 cpp_method_name = v8_utilities.scoped_name(interface, method, base_name)
332 return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments)) 332 return '%s(%s)' % (cpp_method_name, ', '.join(cpp_arguments))
333 333
334 334
335 def v8_set_return_value(interface_name, method, cpp_value, for_main_world=False) : 335 def v8_set_return_value(interface_name, method, cpp_value, for_main_world=False) :
336 idl_type = method.idl_type 336 idl_type = method.idl_type
337 extended_attributes = method.extended_attributes 337 extended_attributes = method.extended_attributes
338 if not idl_type or idl_type.name == 'void': 338 if not idl_type or idl_type.name == 'void':
339 # Constructors and void methods don't have a return type 339 # Constructors and void methods don't have a return type
340 return None 340 return None
341 341
342 # [CallWith=ScriptState], [RaisesException] 342 # [CallWith=ScriptState], [RaisesException]
343 if use_local_result(method): 343 if use_local_result(method):
344 if idl_type.is_explicit_nullable: 344 if idl_type.is_explicit_nullable:
345 # result is of type Nullable<T> 345 # result is of type Nullable<T>
346 cpp_value = 'result.get()' 346 cpp_value = 'result.Get()'
347 else: 347 else:
348 cpp_value = 'result' 348 cpp_value = 'result'
349 349
350 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else '' 350 script_wrappable = 'impl' if inherits_interface(interface_name, 'Node') else ''
351 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w rappable=script_wrappable, for_main_world=for_main_world, is_static=method.is_st atic) 351 return idl_type.v8_set_return_value(cpp_value, extended_attributes, script_w rappable=script_wrappable, for_main_world=for_main_world, is_static=method.is_st atic)
352 352
353 353
354 def v8_value_to_local_cpp_variadic_value(method, argument, index, return_promise ): 354 def v8_value_to_local_cpp_variadic_value(method, argument, index, return_promise ):
355 assert argument.is_variadic 355 assert argument.is_variadic
356 idl_type = argument.idl_type 356 idl_type = argument.idl_type
357 this_cpp_type = idl_type.cpp_type 357 this_cpp_type = idl_type.cpp_type
358 358
359 if idl_type.is_dictionary or idl_type.is_union_type: 359 if idl_type.is_dictionary or idl_type.is_union_type:
360 vector_type = 'HeapVector' 360 vector_type = 'HeapVector'
361 else: 361 else:
362 vector_type = 'Vector' 362 vector_type = 'Vector'
363 363
364 return { 364 return {
365 'assign_expression': 'toImplArguments<%s<%s>>(info, %s, exceptionState)' % (vector_type, this_cpp_type, index), 365 'assign_expression': 'ToImplArguments<%s<%s>>(info, %s, exceptionState)' % (vector_type, this_cpp_type, index),
366 'check_expression': 'exceptionState.hadException()', 366 'check_expression': 'exceptionState.HadException()',
367 'cpp_type': this_cpp_type, 367 'cpp_type': this_cpp_type,
368 'cpp_name': argument.name, 368 'cpp_name': argument.name,
369 'declare_variable': False, 369 'declare_variable': False,
370 } 370 }
371 371
372 372
373 def v8_value_to_local_cpp_value(method, argument, index, return_promise=False): 373 def v8_value_to_local_cpp_value(method, argument, index, return_promise=False):
374 extended_attributes = argument.extended_attributes 374 extended_attributes = argument.extended_attributes
375 idl_type = argument.idl_type 375 idl_type = argument.idl_type
376 name = argument.name 376 name = argument.name
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 return method.idl_type and method.idl_type.name == 'Promise' 446 return method.idl_type and method.idl_type.name == 'Promise'
447 447
448 IdlOperation.returns_promise = property(method_returns_promise) 448 IdlOperation.returns_promise = property(method_returns_promise)
449 449
450 450
451 def argument_conversion_needs_exception_state(method, argument): 451 def argument_conversion_needs_exception_state(method, argument):
452 idl_type = argument.idl_type 452 idl_type = argument.idl_type
453 return (idl_type.v8_conversion_needs_exception_state or 453 return (idl_type.v8_conversion_needs_exception_state or
454 argument.is_variadic or 454 argument.is_variadic or
455 (method.returns_promise and idl_type.is_string_type)) 455 (method.returns_promise and idl_type.is_string_type))
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/scripts/v8_interface.py ('k') | third_party/WebKit/Source/bindings/scripts/v8_types.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698