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

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

Issue 203143002: Simplify EventTarget bindings generation (2) (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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
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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 # Value handling 169 # Value handling
170 ################################################################################ 170 ################################################################################
171 171
172 def cpp_value(interface, method, number_of_arguments): 172 def cpp_value(interface, method, number_of_arguments):
173 def cpp_argument(argument): 173 def cpp_argument(argument):
174 idl_type = argument.idl_type 174 idl_type = argument.idl_type
175 if (idl_type.is_callback_interface or 175 if (idl_type.is_callback_interface or
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 if (interface.name == 'EventTarget' and
180 method.name == 'removeEventListener' and
181 idl_type.name == 'EventListener'):
182 # FIXME: remove this special case by moving get() into
183 # EventTarget::removeEventListener
184 return '%s.get()' % argument.name
179 return argument.name 185 return argument.name
180 186
181 # Truncate omitted optional arguments 187 # Truncate omitted optional arguments
182 arguments = method.arguments[:number_of_arguments] 188 arguments = method.arguments[:number_of_arguments]
183 cpp_arguments = v8_utilities.call_with_arguments(method) 189 cpp_arguments = v8_utilities.call_with_arguments(method)
184 if ('ImplementedBy' in method.extended_attributes and 190 if ('ImplementedBy' in method.extended_attributes and
185 not method.is_static): 191 not method.is_static):
186 cpp_arguments.append('*impl') 192 cpp_arguments.append('*impl')
187 cpp_arguments.extend(cpp_argument(argument) for argument in arguments) 193 cpp_arguments.extend(cpp_argument(argument) for argument in arguments)
188 this_union_arguments = method.idl_type.union_arguments 194 this_union_arguments = method.idl_type.union_arguments
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 256
251 257
252 def union_arguments(idl_type): 258 def union_arguments(idl_type):
253 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value""" 259 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value"""
254 return [arg 260 return [arg
255 for i in range(len(idl_type.member_types)) 261 for i in range(len(idl_type.member_types))
256 for arg in ['result%sEnabled' % i, 'result%s' % i]] 262 for arg in ['result%sEnabled' % i, 'result%s' % i]]
257 263
258 IdlType.union_arguments = property(lambda self: None) 264 IdlType.union_arguments = property(lambda self: None)
259 IdlUnionType.union_arguments = property(union_arguments) 265 IdlUnionType.union_arguments = property(union_arguments)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/scripts/v8_types.py » ('j') | Source/bindings/templates/methods.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698