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

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

Issue 265293004: Create fewer local v8::TryCatch objects in generated bindings code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: call block.ReThrow() when throwing exceptions Created 6 years, 7 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 # coding=utf-8 2 # coding=utf-8
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 counter[item] += 1 553 counter[item] += 1
554 return counter 554 return counter
555 555
556 556
557 ################################################################################ 557 ################################################################################
558 # Constructors 558 # Constructors
559 ################################################################################ 559 ################################################################################
560 560
561 # [Constructor] 561 # [Constructor]
562 def generate_constructor(interface, constructor): 562 def generate_constructor(interface, constructor):
563 generated_arguments = [v8_methods.generate_argument(interface, constructor, argument, index)
564 for index, argument in enumerate(constructor.argument s)]
565
563 return { 566 return {
564 'argument_list': constructor_argument_list(interface, constructor), 567 'argument_list': constructor_argument_list(interface, constructor),
565 'arguments': [v8_methods.generate_argument(interface, constructor, argum ent, index) 568 'arguments': generated_arguments,
566 for index, argument in enumerate(constructor.arguments)], 569 'arguments_need_try_catch': any(
570 v8_methods.argument_needs_try_catch(argument)
571 for argument in generated_arguments),
567 'cpp_type': cpp_template_type( 572 'cpp_type': cpp_template_type(
568 cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)), 573 cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)),
569 cpp_name(interface)), 574 cpp_name(interface)),
570 'has_exception_state': 575 'has_exception_state':
571 # [RaisesException=Constructor] 576 # [RaisesException=Constructor]
572 interface.extended_attributes.get('RaisesException') == 'Constructor ' or 577 interface.extended_attributes.get('RaisesException') == 'Constructor ' or
573 any(argument for argument in constructor.arguments 578 any(argument for argument in constructor.arguments
574 if argument.idl_type.name == 'SerializedScriptValue' or 579 if argument.idl_type.name == 'SerializedScriptValue' or
575 argument.idl_type.is_integer_type), 580 argument.idl_type.is_integer_type),
576 'is_constructor': True, 581 'is_constructor': True,
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 deleter = next( 830 deleter = next(
826 method 831 method
827 for method in interface.operations 832 for method in interface.operations
828 if ('deleter' in method.specials and 833 if ('deleter' in method.specials and
829 len(method.arguments) == 1 and 834 len(method.arguments) == 1 and
830 str(method.arguments[0].idl_type) == 'DOMString')) 835 str(method.arguments[0].idl_type) == 'DOMString'))
831 except StopIteration: 836 except StopIteration:
832 return None 837 return None
833 838
834 return property_deleter(deleter) 839 return property_deleter(deleter)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_methods.py » ('j') | Source/bindings/v8/V8BindingMacros.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698