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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 45 conversion_includes = [] | 45 conversion_includes = [] |
| 46 for argument in operation.arguments: | 46 for argument in operation.arguments: |
| 47 argument_type_info = self._TypeInfo(argument.type.id) | 47 argument_type_info = self._TypeInfo(argument.type.id) |
| 48 parameters.append('%s %s' % (argument_type_info.parameter_type(), | 48 parameters.append('%s %s' % (argument_type_info.parameter_type(), |
| 49 argument.id)) | 49 argument.id)) |
| 50 arguments.append(argument_type_info.to_dart_conversion(argument.id)) | 50 arguments.append(argument_type_info.to_dart_conversion(argument.id)) |
| 51 conversion_includes.extend(argument_type_info.conversion_includes()) | 51 conversion_includes.extend(argument_type_info.conversion_includes()) |
| 52 | 52 |
| 53 cpp_header_handlers_emitter.Emit( | 53 cpp_header_handlers_emitter.Emit( |
| 54 '\n' | 54 '\n' |
| 55 ' virtual bool handleEvent($PARAMETERS);\n', | 55 ' virtual void handleEvent($PARAMETERS);\n', |
|
Anton Muhin
2012/10/18 09:59:16
that's wrong: handleEvent in WebKit should return
| |
| 56 PARAMETERS=', '.join(parameters)) | 56 PARAMETERS=', '.join(parameters)) |
| 57 | 57 |
| 58 if 'Custom' in operation.ext_attrs: | 58 if 'Custom' in operation.ext_attrs: |
| 59 continue | 59 continue |
| 60 | 60 |
| 61 cpp_impl_includes |= set(conversion_includes) | 61 cpp_impl_includes |= set(conversion_includes) |
| 62 arguments_declaration = 'Dart_Handle arguments[] = { %s }' % ', '.join(arg uments) | 62 arguments_declaration = 'Dart_Handle arguments[] = { %s }' % ', '.join(arg uments) |
| 63 if not len(arguments): | 63 if not len(arguments): |
| 64 arguments_declaration = 'Dart_Handle* arguments = 0' | 64 arguments_declaration = 'Dart_Handle* arguments = 0' |
| 65 cpp_impl_handlers_emitter.Emit( | 65 cpp_impl_handlers_emitter.Emit( |
| 66 '\n' | 66 '\n' |
| 67 'bool $CLASS_NAME::handleEvent($PARAMETERS)\n' | 67 'void $CLASS_NAME::handleEvent($PARAMETERS)\n' |
|
Anton Muhin
2012/10/18 09:59:16
ditto
| |
| 68 '{\n' | 68 '{\n' |
| 69 ' if (!m_callback.isolate()->isAlive())\n' | 69 ' if (!m_callback.isolate()->isAlive())\n' |
| 70 ' return false;\n' | 70 ' return false;\n' |
| 71 ' DartIsolate::Scope scope(m_callback.isolate());\n' | 71 ' DartIsolate::Scope scope(m_callback.isolate());\n' |
| 72 ' DartApiScope apiScope;\n' | 72 ' DartApiScope apiScope;\n' |
| 73 ' $ARGUMENTS_DECLARATION;\n' | 73 ' $ARGUMENTS_DECLARATION;\n' |
| 74 ' return m_callback.handleEvent($ARGUMENT_COUNT, arguments);\n' | 74 ' return m_callback.handleEvent($ARGUMENT_COUNT, arguments);\n' |
| 75 '}\n', | 75 '}\n', |
| 76 CLASS_NAME=class_name, | 76 CLASS_NAME=class_name, |
| 77 PARAMETERS=', '.join(parameters), | 77 PARAMETERS=', '.join(parameters), |
| (...skipping 783 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 861 def EmitResolver(self, template, output_dir): | 861 def EmitResolver(self, template, output_dir): |
| 862 file_path = os.path.join(output_dir, 'DartResolver.cpp') | 862 file_path = os.path.join(output_dir, 'DartResolver.cpp') |
| 863 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template) | 863 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emit( template) |
| 864 for header_file in self._headers_list: | 864 for header_file in self._headers_list: |
| 865 path = os.path.relpath(header_file, output_dir) | 865 path = os.path.relpath(header_file, output_dir) |
| 866 includes_emitter.Emit('#include "$PATH"\n', PATH=path) | 866 includes_emitter.Emit('#include "$PATH"\n', PATH=path) |
| 867 body_emitter.Emit( | 867 body_emitter.Emit( |
| 868 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n' | 868 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argume ntCount))\n' |
| 869 ' return func;\n', | 869 ' return func;\n', |
| 870 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 870 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| OLD | NEW |