| 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 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 ################################################################################ | 147 ################################################################################ |
| 148 | 148 |
| 149 def cpp_value(interface, method, number_of_arguments): | 149 def cpp_value(interface, method, number_of_arguments): |
| 150 def cpp_argument(argument): | 150 def cpp_argument(argument): |
| 151 argument_name = dart_types.check_reserved_name(argument.name) | 151 argument_name = dart_types.check_reserved_name(argument.name) |
| 152 idl_type = argument.idl_type | 152 idl_type = argument.idl_type |
| 153 | 153 |
| 154 if idl_type.is_typed_array_type: | 154 if idl_type.is_typed_array_type: |
| 155 return '%s.get()' % argument_name | 155 return '%s.get()' % argument_name |
| 156 | 156 |
| 157 # TODO(eseidel): This should check cpp_type.endswith('Handle') |
| 158 if idl_type.name == 'MojoDataPipeConsumer': |
| 159 return '%s.Pass()' % argument_name |
| 160 |
| 157 if idl_type.name == 'EventListener': | 161 if idl_type.name == 'EventListener': |
| 158 if (interface.name == 'EventTarget' and | 162 if (interface.name == 'EventTarget' and |
| 159 method.name == 'removeEventListener'): | 163 method.name == 'removeEventListener'): |
| 160 # FIXME: remove this special case by moving get() into | 164 # FIXME: remove this special case by moving get() into |
| 161 # EventTarget::removeEventListener | 165 # EventTarget::removeEventListener |
| 162 return '%s.get()' % argument_name | 166 return '%s.get()' % argument_name |
| 163 return argument.name | 167 return argument.name |
| 164 if (idl_type.is_callback_interface or | 168 if idl_type.is_callback_interface: |
| 165 idl_type.name in ['NodeFilter', 'XPathNSResolver']): | |
| 166 # FIXME: remove this special case | |
| 167 return '%s.release()' % argument_name | 169 return '%s.release()' % argument_name |
| 168 return argument_name | 170 return argument_name |
| 169 | 171 |
| 170 # Truncate omitted optional arguments | 172 # Truncate omitted optional arguments |
| 171 arguments = method.arguments[:number_of_arguments] | 173 arguments = method.arguments[:number_of_arguments] |
| 172 if method.is_constructor: | 174 if method.is_constructor: |
| 173 call_with_values = interface.extended_attributes.get('ConstructorCallWit
h') | 175 call_with_values = interface.extended_attributes.get('ConstructorCallWit
h') |
| 174 else: | 176 else: |
| 175 call_with_values = method.extended_attributes.get('CallWith') | 177 call_with_values = method.extended_attributes.get('CallWith') |
| 176 cpp_arguments = DartUtilities.call_with_arguments(call_with_values) | 178 cpp_arguments = DartUtilities.call_with_arguments(call_with_values) |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 # removeEventListener methods that should be added in somewhere. | 239 # removeEventListener methods that should be added in somewhere. |
| 238 # There is also some logic in systemnative.py to force a null check | 240 # There is also some logic in systemnative.py to force a null check |
| 239 # for the useCapture argument of those same methods that we may need to | 241 # for the useCapture argument of those same methods that we may need to |
| 240 # pull over. | 242 # pull over. |
| 241 null_check = ((argument.is_optional and idl_type.is_callback_interface) or | 243 null_check = ((argument.is_optional and idl_type.is_callback_interface) or |
| 242 (argument.default_value and argument.default_value.is_null)) | 244 (argument.default_value and argument.default_value.is_null)) |
| 243 | 245 |
| 244 return idl_type.dart_value_to_local_cpp_value( | 246 return idl_type.dart_value_to_local_cpp_value( |
| 245 extended_attributes, name, null_check, has_type_checking_interface, | 247 extended_attributes, name, null_check, has_type_checking_interface, |
| 246 index=index, auto_scope=auto_scope) | 248 index=index, auto_scope=auto_scope) |
| OLD | NEW |