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

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: added comment 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
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_methods.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 # 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 732 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 l.sort(key=key) 743 l.sort(key=key)
744 return ((k, list(g)) for k, g in itertools.groupby(l, key)) 744 return ((k, list(g)) for k, g in itertools.groupby(l, key))
745 745
746 746
747 ################################################################################ 747 ################################################################################
748 # Constructors 748 # Constructors
749 ################################################################################ 749 ################################################################################
750 750
751 # [Constructor] 751 # [Constructor]
752 def generate_constructor(interface, constructor): 752 def generate_constructor(interface, constructor):
753 arguments_need_try_catch = any(v8_methods.argument_needs_try_catch(argument)
754 for argument in constructor.arguments)
755
753 return { 756 return {
754 'argument_list': constructor_argument_list(interface, constructor), 757 'argument_list': constructor_argument_list(interface, constructor),
755 'arguments': [v8_methods.generate_argument(interface, constructor, argum ent, index) 758 'arguments': [v8_methods.generate_argument(interface, constructor, argum ent, index, arguments_need_try_catch)
756 for index, argument in enumerate(constructor.arguments)], 759 for index, argument in enumerate(constructor.arguments)],
760 'arguments_need_try_catch': arguments_need_try_catch,
757 'cpp_type': cpp_template_type( 761 'cpp_type': cpp_template_type(
758 cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)), 762 cpp_ptr_type('RefPtr', 'RawPtr', gc_type(interface)),
759 cpp_name(interface)), 763 cpp_name(interface)),
760 'has_exception_state': 764 'has_exception_state':
761 # [RaisesException=Constructor] 765 # [RaisesException=Constructor]
762 interface.extended_attributes.get('RaisesException') == 'Constructor ' or 766 interface.extended_attributes.get('RaisesException') == 'Constructor ' or
763 any(argument for argument in constructor.arguments 767 any(argument for argument in constructor.arguments
764 if argument.idl_type.name == 'SerializedScriptValue' or 768 if argument.idl_type.name == 'SerializedScriptValue' or
765 argument.idl_type.is_integer_type), 769 argument.idl_type.is_integer_type),
766 'is_constructor': True, 770 'is_constructor': True,
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1003 deleter = next( 1007 deleter = next(
1004 method 1008 method
1005 for method in interface.operations 1009 for method in interface.operations
1006 if ('deleter' in method.specials and 1010 if ('deleter' in method.specials and
1007 len(method.arguments) == 1 and 1011 len(method.arguments) == 1 and
1008 str(method.arguments[0].idl_type) == 'DOMString')) 1012 str(method.arguments[0].idl_type) == 'DOMString'))
1009 except StopIteration: 1013 except StopIteration:
1010 return None 1014 return None
1011 1015
1012 return property_deleter(deleter) 1016 return property_deleter(deleter)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_methods.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698