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

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

Issue 360703003: Implement Blink-in-JS for DOM methods (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 implemented_as_class = idl_type.implemented_as 184 implemented_as_class = idl_type.implemented_as
185 if raw_type: 185 if raw_type:
186 return implemented_as_class + '*' 186 return implemented_as_class + '*'
187 new_type = 'Member' if used_in_cpp_sequence else 'RawPtr' 187 new_type = 'Member' if used_in_cpp_sequence else 'RawPtr'
188 ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_argument else 'RefPtr') , new_type, idl_type.gc_type) 188 ptr_type = cpp_ptr_type(('PassRefPtr' if used_as_argument else 'RefPtr') , new_type, idl_type.gc_type)
189 return cpp_template_type(ptr_type, implemented_as_class) 189 return cpp_template_type(ptr_type, implemented_as_class)
190 # Default, assume native type is a pointer with same type name as idl type 190 # Default, assume native type is a pointer with same type name as idl type
191 return base_idl_type + '*' 191 return base_idl_type + '*'
192 192
193 193
194 def cpp_type_union(idl_type, extended_attributes=None): 194 def cpp_type_union(idl_type, extended_attributes=None, raw_type=False):
195 return (member_type.cpp_type for member_type in idl_type.member_types) 195 return (member_type.cpp_type for member_type in idl_type.member_types)
196 196
197 197
198 # Allow access as idl_type.cpp_type if no arguments 198 # Allow access as idl_type.cpp_type if no arguments
199 IdlType.cpp_type = property(cpp_type) 199 IdlType.cpp_type = property(cpp_type)
200 IdlUnionType.cpp_type = property(cpp_type_union) 200 IdlUnionType.cpp_type = property(cpp_type_union)
201 IdlType.cpp_type_args = cpp_type 201 IdlType.cpp_type_args = cpp_type
202 IdlUnionType.cpp_type_args = cpp_type_union 202 IdlUnionType.cpp_type_args = cpp_type_union
203 203
204 204
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 700
701 def literal_cpp_value(idl_type, idl_literal): 701 def literal_cpp_value(idl_type, idl_literal):
702 """Converts an expression that is a valid C++ literal for this type.""" 702 """Converts an expression that is a valid C++ literal for this type."""
703 # FIXME: add validation that idl_type and idl_literal are compatible 703 # FIXME: add validation that idl_type and idl_literal are compatible
704 literal_value = str(idl_literal) 704 literal_value = str(idl_literal)
705 if idl_type.base_type in CPP_UNSIGNED_TYPES: 705 if idl_type.base_type in CPP_UNSIGNED_TYPES:
706 return literal_value + 'u' 706 return literal_value + 'u'
707 return literal_value 707 return literal_value
708 708
709 IdlType.literal_cpp_value = literal_cpp_value 709 IdlType.literal_cpp_value = literal_cpp_value
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698