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

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: Add test 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
« no previous file with comments | « no previous file | Source/bindings/templates/methods.cpp » ('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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 } 165 }
166 166
167 167
168 ################################################################################ 168 ################################################################################
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.name == 'EventListener':
176 if (interface.name == 'EventTarget' and
177 method.name == 'removeEventListener'):
178 # FIXME: remove this special case by moving get() into
179 # EventTarget::removeEventListener
180 return '%s.get()' % argument.name
181 return argument.name
175 if (idl_type.is_callback_interface or 182 if (idl_type.is_callback_interface or
176 idl_type.name in ['NodeFilter', 'XPathNSResolver']): 183 idl_type.name in ['NodeFilter', 'XPathNSResolver']):
177 # FIXME: remove this special case 184 # FIXME: remove this special case
178 return '%s.release()' % argument.name 185 return '%s.release()' % argument.name
179 return argument.name 186 return argument.name
180 187
181 # Truncate omitted optional arguments 188 # Truncate omitted optional arguments
182 arguments = method.arguments[:number_of_arguments] 189 arguments = method.arguments[:number_of_arguments]
183 cpp_arguments = v8_utilities.call_with_arguments(method) 190 cpp_arguments = v8_utilities.call_with_arguments(method)
184 if ('ImplementedBy' in method.extended_attributes and 191 if ('ImplementedBy' in method.extended_attributes and
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 257
251 258
252 def union_arguments(idl_type): 259 def union_arguments(idl_type):
253 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value""" 260 """Return list of ['result0Enabled', 'result0', 'result1Enabled', ...] for u nion types, for use in setting return value"""
254 return [arg 261 return [arg
255 for i in range(len(idl_type.member_types)) 262 for i in range(len(idl_type.member_types))
256 for arg in ['result%sEnabled' % i, 'result%s' % i]] 263 for arg in ['result%sEnabled' % i, 'result%s' % i]]
257 264
258 IdlType.union_arguments = property(lambda self: None) 265 IdlType.union_arguments = property(lambda self: None)
259 IdlUnionType.union_arguments = property(union_arguments) 266 IdlUnionType.union_arguments = property(union_arguments)
OLDNEW
« no previous file with comments | « no previous file | Source/bindings/templates/methods.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698