| 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 953 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 964 ' }\n' | 964 ' }\n' |
| 965 ' Document& document = *domWindow->document();\n') | 965 ' Document& document = *domWindow->document();\n') |
| 966 | 966 |
| 967 if needs_receiver: | 967 if needs_receiver: |
| 968 body_emitter.Emit( | 968 body_emitter.Emit( |
| 969 ' $WEBCORE_CLASS_NAME* receiver = DartDOMWrapper::receiver< $WE
BCORE_CLASS_NAME >(args);\n', | 969 ' $WEBCORE_CLASS_NAME* receiver = DartDOMWrapper::receiver< $WE
BCORE_CLASS_NAME >(args);\n', |
| 970 WEBCORE_CLASS_NAME=self._interface_type_info.native_type()) | 970 WEBCORE_CLASS_NAME=self._interface_type_info.native_type()) |
| 971 | 971 |
| 972 if requires_stack_info: | 972 if requires_stack_info: |
| 973 self._cpp_impl_includes.add('"ScriptArguments.h"') | 973 self._cpp_impl_includes.add('"ScriptArguments.h"') |
| 974 self._cpp_impl_includes.add('"ScriptCallStack.h"') | |
| 975 body_emitter.Emit( | 974 body_emitter.Emit( |
| 976 '\n' | 975 '\n' |
| 977 ' ScriptState* currentState = DartUtilities::currentScriptState
();\n' | 976 ' ScriptState* currentState = DartUtilities::currentScriptState
();\n' |
| 978 ' if (!currentState) {\n' | 977 ' if (!currentState) {\n' |
| 979 ' exception = Dart_NewStringFromCString("Failed to retrieve
a script state");\n' | 978 ' exception = Dart_NewStringFromCString("Failed to retrieve
a script state");\n' |
| 980 ' goto fail;\n' | 979 ' goto fail;\n' |
| 981 ' }\n' | 980 ' }\n' |
| 982 ' ScriptState& state = *currentState;\n' | 981 ' ScriptState& state = *currentState;\n' |
| 983 '\n' | 982 '\n' |
| 984 ' Dart_Handle customArgument = Dart_GetNativeArgument(args, $IN
DEX);\n' | 983 ' Dart_Handle customArgument = Dart_GetNativeArgument(args, $IN
DEX);\n' |
| 985 ' RefPtr<ScriptArguments> scriptArguments(DartUtilities::create
ScriptArguments(customArgument, exception));\n' | 984 ' RefPtr<ScriptArguments> scriptArguments(DartUtilities::create
ScriptArguments(customArgument, exception));\n' |
| 986 ' if (!scriptArguments)\n' | 985 ' if (!scriptArguments)\n' |
| 987 ' goto fail;\n' | 986 ' goto fail;\n', |
| 988 ' RefPtr<ScriptCallStack> scriptCallStack(DartUtilities::create
ScriptCallStack());\n' | |
| 989 ' if (!scriptCallStack->size())\n' | |
| 990 ' return;\n', | |
| 991 INDEX=len(arguments) + 1) | 987 INDEX=len(arguments) + 1) |
| 992 | 988 |
| 993 if requires_script_arguments: | 989 if requires_script_arguments: |
| 994 self._cpp_impl_includes.add('"ScriptArguments.h"') | 990 self._cpp_impl_includes.add('"ScriptArguments.h"') |
| 995 body_emitter.Emit( | 991 body_emitter.Emit( |
| 996 '\n' | 992 '\n' |
| 997 ' Dart_Handle customArgument = Dart_GetNativeArgument(args, $IN
DEX);\n' | 993 ' Dart_Handle customArgument = Dart_GetNativeArgument(args, $IN
DEX);\n' |
| 998 ' RefPtr<ScriptArguments> scriptArguments(DartUtilities::create
ScriptArguments(customArgument, exception));\n' | 994 ' RefPtr<ScriptArguments> scriptArguments(DartUtilities::create
ScriptArguments(customArgument, exception));\n' |
| 999 ' if (!scriptArguments)\n' | 995 ' if (!scriptArguments)\n' |
| 1000 ' goto fail;\n', | 996 ' goto fail;\n', |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1377 e.Emit("};\n"); | 1373 e.Emit("};\n"); |
| 1378 e.Emit('\n'); | 1374 e.Emit('\n'); |
| 1379 e.Emit('} // namespace WebCore\n'); | 1375 e.Emit('} // namespace WebCore\n'); |
| 1380 | 1376 |
| 1381 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 1377 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 1382 return ( | 1378 return ( |
| 1383 interface.id.endswith('Event') and | 1379 interface.id.endswith('Event') and |
| 1384 operation.id.startswith('init') and | 1380 operation.id.startswith('init') and |
| 1385 argument.ext_attrs.get('Default') == 'Undefined' and | 1381 argument.ext_attrs.get('Default') == 'Undefined' and |
| 1386 argument.type.id == 'DOMString') | 1382 argument.type.id == 'DOMString') |
| OLD | NEW |