Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 """This module provides shared functionality for the systems to generate | 6 """This module provides shared functionality for the systems to generate |
| 7 native binding from the IDL database.""" | 7 native binding from the IDL database.""" |
| 8 | 8 |
| 9 import emitter | 9 import emitter |
| 10 import os | 10 import os |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 376 self._interface_type_info = self._type_registry.TypeInfo(self._interface.id) | 376 self._interface_type_info = self._type_registry.TypeInfo(self._interface.id) |
| 377 self._metadata = options.metadata | 377 self._metadata = options.metadata |
| 378 # These get initialized by StartInterface | 378 # These get initialized by StartInterface |
| 379 self._cpp_header_emitter = None | 379 self._cpp_header_emitter = None |
| 380 self._cpp_impl_emitter = None | 380 self._cpp_impl_emitter = None |
| 381 self._members_emitter = None | 381 self._members_emitter = None |
| 382 self._cpp_declarations_emitter = None | 382 self._cpp_declarations_emitter = None |
| 383 self._cpp_impl_includes = None | 383 self._cpp_impl_includes = None |
| 384 self._cpp_definitions_emitter = None | 384 self._cpp_definitions_emitter = None |
| 385 self._cpp_resolver_emitter = None | 385 self._cpp_resolver_emitter = None |
| 386 self._dart_js_interop = options.dart_js_interop | |
| 386 | 387 |
| 387 def ImplementsMergedMembers(self): | 388 def ImplementsMergedMembers(self): |
| 388 # We could not add merged functions to implementation class because | 389 # We could not add merged functions to implementation class because |
| 389 # underlying c++ object doesn't implement them. Merged functions are | 390 # underlying c++ object doesn't implement them. Merged functions are |
| 390 # generated on merged interface implementation instead. | 391 # generated on merged interface implementation instead. |
| 391 return False | 392 return False |
| 392 | 393 |
| 393 def CustomJSMembers(self): | 394 def CustomJSMembers(self): |
| 394 return {} | 395 return {} |
| 395 | 396 |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1242 if not is_custom: | 1243 if not is_custom: |
| 1243 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name, auto_scope_setup) | 1244 self._GenerateOperationNativeCallback(operation, operation.arguments, cp p_callback_name, auto_scope_setup) |
| 1244 else: | 1245 else: |
| 1245 self._GenerateDispatcher(info, info.operations, dart_declaration, html_nam e) | 1246 self._GenerateDispatcher(info, info.operations, dart_declaration, html_nam e) |
| 1246 | 1247 |
| 1247 def _GenerateDispatcher(self, info, operations, dart_declaration, html_name): | 1248 def _GenerateDispatcher(self, info, operations, dart_declaration, html_name): |
| 1248 | 1249 |
| 1249 def GenerateCall( | 1250 def GenerateCall( |
| 1250 stmts_emitter, call_emitter, version, operation, argument_count): | 1251 stmts_emitter, call_emitter, version, operation, argument_count): |
| 1251 native_suffix = 'Callback' | 1252 native_suffix = 'Callback' |
| 1252 actuals = info.ParametersAsListOfVariables(argument_count, self._type_regi stry if self._dart_use_blink else None) | 1253 actuals = info.ParametersAsListOfVariables(argument_count, |
| 1254 self._type_registry if self._da rt_use_blink else None, | |
|
Alan Knight
2015/07/16 16:55:52
Indentation looks very weird here, but it might be
terry
2015/07/16 17:36:14
Because of the preceding ( it indents after the (
| |
| 1255 self._dart_js_interop) | |
| 1253 actuals_s = ", ".join(actuals) | 1256 actuals_s = ", ".join(actuals) |
| 1254 formals=actuals | 1257 formals=actuals |
| 1255 return_type = self.SecureOutputType(operation.type.id) | 1258 return_type = self.SecureOutputType(operation.type.id) |
| 1256 | 1259 |
| 1257 return_wrap_jso = False | 1260 return_wrap_jso = False |
| 1258 if self._dart_use_blink: | 1261 if self._dart_use_blink: |
| 1259 return_wrap_jso = self._type_registry.HasInterface(return_type) | 1262 return_wrap_jso = self._type_registry.HasInterface(return_type) |
| 1260 | 1263 |
| 1261 native_suffix = 'Callback' | 1264 native_suffix = 'Callback' |
| 1262 is_custom = _IsCustom(operation) | 1265 is_custom = _IsCustom(operation) |
| (...skipping 760 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2023 | 2026 |
| 2024 def _IsCustom(op_or_attr): | 2027 def _IsCustom(op_or_attr): |
| 2025 assert(isinstance(op_or_attr, IDLMember)) | 2028 assert(isinstance(op_or_attr, IDLMember)) |
| 2026 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr s | 2029 return 'Custom' in op_or_attr.ext_attrs or 'DartCustom' in op_or_attr.ext_attr s |
| 2027 | 2030 |
| 2028 def _IsCustomValue(op_or_attr, value): | 2031 def _IsCustomValue(op_or_attr, value): |
| 2029 if _IsCustom(op_or_attr): | 2032 if _IsCustom(op_or_attr): |
| 2030 return op_or_attr.ext_attrs.get('Custom') == value \ | 2033 return op_or_attr.ext_attrs.get('Custom') == value \ |
| 2031 or op_or_attr.ext_attrs.get('DartCustom') == value | 2034 or op_or_attr.ext_attrs.get('DartCustom') == value |
| 2032 return False | 2035 return False |
| OLD | NEW |