Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(458)

Side by Side Diff: tools/dom/scripts/systemnative.py

Issue 113913010: Add auto scope setup parameter to the native resolvers in preparation for (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/dom/templates/html/dartium/cpp_header.template » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 '\n' 1071 '\n'
1072 ' $METADATA$DART_DECLARATION native "$NATIVE_BINDING";\n', 1072 ' $METADATA$DART_DECLARATION native "$NATIVE_BINDING";\n',
1073 DOMINTERFACE=self._interface.id, 1073 DOMINTERFACE=self._interface.id,
1074 METADATA=metadata, 1074 METADATA=metadata,
1075 DART_DECLARATION=dart_declaration, 1075 DART_DECLARATION=dart_declaration,
1076 NATIVE_BINDING=native_binding) 1076 NATIVE_BINDING=native_binding)
1077 1077
1078 cpp_callback_name = '%s%s' % (idl_name, native_suffix) 1078 cpp_callback_name = '%s%s' % (idl_name, native_suffix)
1079 1079
1080 self._cpp_resolver_emitter.Emit( 1080 self._cpp_resolver_emitter.Emit(
1081 ' if (argumentCount == $ARGC && name == "$NATIVE_BINDING")\n' 1081 ' if (argumentCount == $ARGC && name == "$NATIVE_BINDING") {\n'
1082 ' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n', 1082 ' *autoSetupScope = true;\n'
1083 ' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n'
1084 ' }\n',
1083 ARGC=argument_count, 1085 ARGC=argument_count,
1084 NATIVE_BINDING=native_binding, 1086 NATIVE_BINDING=native_binding,
1085 INTERFACE_NAME=self._interface.id, 1087 INTERFACE_NAME=self._interface.id,
1086 CPP_CALLBACK_NAME=cpp_callback_name) 1088 CPP_CALLBACK_NAME=cpp_callback_name)
1087 1089
1088 if is_custom: 1090 if is_custom:
1089 self._cpp_declarations_emitter.Emit( 1091 self._cpp_declarations_emitter.Emit(
1090 '\n' 1092 '\n'
1091 'void $CPP_CALLBACK_NAME(Dart_NativeArguments);\n', 1093 'void $CPP_CALLBACK_NAME(Dart_NativeArguments);\n',
1092 CPP_CALLBACK_NAME=cpp_callback_name) 1094 CPP_CALLBACK_NAME=cpp_callback_name)
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 file_path = os.path.join(output_dir, '%s_DartResolver.cpp' % library_name) 1176 file_path = os.path.join(output_dir, '%s_DartResolver.cpp' % library_name)
1175 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emi t( 1177 includes_emitter, body_emitter = self._emitters.FileEmitter(file_path).Emi t(
1176 template, 1178 template,
1177 LIBRARY_NAME=library_name) 1179 LIBRARY_NAME=library_name)
1178 1180
1179 headers = self._library_headers[library_name] 1181 headers = self._library_headers[library_name]
1180 for header_file in headers: 1182 for header_file in headers:
1181 path = os.path.relpath(header_file, output_dir) 1183 path = os.path.relpath(header_file, output_dir)
1182 includes_emitter.Emit('#include "$PATH"\n', PATH=path) 1184 includes_emitter.Emit('#include "$PATH"\n', PATH=path)
1183 body_emitter.Emit( 1185 body_emitter.Emit(
1184 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount))\n' 1186 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu mentCount, autoSetupScope))\n'
1185 ' return func;\n', 1187 ' return func;\n',
1186 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) 1188 CLASS_NAME=os.path.splitext(os.path.basename(path))[0])
1187 1189
1188 def EmitClassIdTable(self, database, output_dir, type_registry, renamer): 1190 def EmitClassIdTable(self, database, output_dir, type_registry, renamer):
1189 path = os.path.join(output_dir, 'DartWebkitClassIds.h') 1191 path = os.path.join(output_dir, 'DartWebkitClassIds.h')
1190 e = self._emitters.FileEmitter(path) 1192 e = self._emitters.FileEmitter(path)
1191 e.Emit('// Copyright (c) 2013, the Dart project authors. Please see the AUT HORS file\n'); 1193 e.Emit('// Copyright (c) 2013, the Dart project authors. Please see the AUT HORS file\n');
1192 e.Emit('// for details. All rights reserved. Use of this source code is gove rned by a\n'); 1194 e.Emit('// for details. All rights reserved. Use of this source code is gove rned by a\n');
1193 e.Emit('// BSD-style license that can be found in the LICENSE file.\n'); 1195 e.Emit('// BSD-style license that can be found in the LICENSE file.\n');
1194 e.Emit('// WARNING: Do not edit - generated code.\n'); 1196 e.Emit('// WARNING: Do not edit - generated code.\n');
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
1279 e.Emit("};\n"); 1281 e.Emit("};\n");
1280 e.Emit('\n'); 1282 e.Emit('\n');
1281 e.Emit('} // namespace WebCore\n'); 1283 e.Emit('} // namespace WebCore\n');
1282 1284
1283 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): 1285 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument):
1284 return ( 1286 return (
1285 interface.id.endswith('Event') and 1287 interface.id.endswith('Event') and
1286 operation.id.startswith('init') and 1288 operation.id.startswith('init') and
1287 argument.ext_attrs.get('Default') == 'Undefined' and 1289 argument.ext_attrs.get('Default') == 'Undefined' and
1288 argument.type.id == 'DOMString') 1290 argument.type.id == 'DOMString')
OLDNEW
« no previous file with comments | « no previous file | tools/dom/templates/html/dartium/cpp_header.template » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698