OLD | NEW |
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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 def cpp_type(idl_type): | 56 def cpp_type(idl_type): |
57 # FIXME: remove this function by making callback types consistent | 57 # FIXME: remove this function by making callback types consistent |
58 # (always use usual v8_types.cpp_type) | 58 # (always use usual v8_types.cpp_type) |
59 idl_type_name = idl_type.name | 59 idl_type_name = idl_type.name |
60 if idl_type_name == 'String': | 60 if idl_type_name == 'String': |
61 return 'const String&' | 61 return 'const String&' |
62 if idl_type_name == 'void': | 62 if idl_type_name == 'void': |
63 return 'void' | 63 return 'void' |
64 # Callbacks use raw pointers, so used_as_argument=True | 64 # Callbacks use raw pointers, so used_as_argument=True |
65 usual_cpp_type = idl_type.cpp_type_args(used_as_argument=True) | 65 usual_cpp_type = idl_type.cpp_type_args(used_as_argument=True) |
66 if usual_cpp_type.startswith(('Vector', 'WillBeHeapVector')): | 66 if usual_cpp_type.startswith(('Vector', 'HeapVector', 'WillBeHeapVector')): |
67 return 'const %s&' % usual_cpp_type | 67 return 'const %s&' % usual_cpp_type |
68 return usual_cpp_type | 68 return usual_cpp_type |
69 | 69 |
70 IdlType.callback_cpp_type = property(cpp_type) | 70 IdlType.callback_cpp_type = property(cpp_type) |
71 | 71 |
72 | 72 |
73 def generate_callback_interface(callback_interface): | 73 def generate_callback_interface(callback_interface): |
74 includes.clear() | 74 includes.clear() |
75 includes.update(CALLBACK_INTERFACE_CPP_INCLUDES) | 75 includes.update(CALLBACK_INTERFACE_CPP_INCLUDES) |
76 return { | 76 return { |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 } | 125 } |
126 | 126 |
127 argument_declarations = ['ScriptValue thisValue'] if call_with_this_handle e
lse [] | 127 argument_declarations = ['ScriptValue thisValue'] if call_with_this_handle e
lse [] |
128 argument_declarations.extend( | 128 argument_declarations.extend( |
129 '%s %s' % (argument.idl_type.callback_cpp_type, argument.name) | 129 '%s %s' % (argument.idl_type.callback_cpp_type, argument.name) |
130 for argument in arguments) | 130 for argument in arguments) |
131 return { | 131 return { |
132 'argument_declarations': argument_declarations, | 132 'argument_declarations': argument_declarations, |
133 'arguments': [generate_argument(argument) for argument in arguments], | 133 'arguments': [generate_argument(argument) for argument in arguments], |
134 } | 134 } |
OLD | NEW |