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

Unified Diff: lib/dom/scripts/systemnative.py

Issue 10122011: Do not use overloaded toDartValue for primitive types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use capwords. Created 8 years, 8 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/dom/scripts/generator.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/dom/scripts/systemnative.py
diff --git a/lib/dom/scripts/systemnative.py b/lib/dom/scripts/systemnative.py
index 1bb37dababd0662acf49a120d7935b6d55c6a9ac..495a362ccc4f36d3d5263d9688ad02e36013cadd 100644
--- a/lib/dom/scripts/systemnative.py
+++ b/lib/dom/scripts/systemnative.py
@@ -68,11 +68,11 @@ class NativeImplementationSystem(System):
class_name = 'Dart%s' % self._interface.id
for operation in interface.operations:
if operation.type.id == 'void':
- return_type = 'void'
return_prefix = ''
+ error_return = ''
else:
- return_type = 'bool'
return_prefix = 'return '
+ error_return = ' false'
parameters = []
arguments = []
@@ -80,25 +80,33 @@ class NativeImplementationSystem(System):
argument_type_info = GetIDLTypeInfo(argument.type.id)
parameters.append('%s %s' % (argument_type_info.parameter_type(),
argument.id))
- arguments.append(argument.id)
+ arguments.append(argument_type_info.to_dart_conversion(argument.id))
cpp_impl_includes |= set(argument_type_info.conversion_includes())
+ native_return_type = GetIDLTypeInfo(operation.type.id).native_type()
cpp_header_handlers_emitter.Emit(
'\n'
' virtual $TYPE handleEvent($PARAMETERS);\n',
- TYPE=return_type, PARAMETERS=', '.join(parameters))
+ TYPE=native_return_type, PARAMETERS=', '.join(parameters))
cpp_impl_handlers_emitter.Emit(
'\n'
'$TYPE $CLASS_NAME::handleEvent($PARAMETERS)\n'
'{\n'
- ' $(RETURN_PREFIX)m_callback.handleEvent($ARGUMENTS);\n'
+ ' if (!m_callback.isolate()->isAlive())\n'
+ ' return$ERROR_RETURN;\n'
+ ' DartIsolate::Scope scope(m_callback.isolate());\n'
+ ' DartApiScope apiScope;\n'
+ ' Dart_Handle arguments[] = { $ARGUMENTS };\n'
+ ' $(RETURN_PREFIX)m_callback.handleEvent($ARGUMENT_COUNT, arguments);\n'
'}\n',
- TYPE=return_type,
+ TYPE=native_return_type,
CLASS_NAME=class_name,
PARAMETERS=', '.join(parameters),
+ ERROR_RETURN=error_return,
RETURN_PREFIX=return_prefix,
- ARGUMENTS=', '.join(arguments))
+ ARGUMENTS=', '.join(arguments),
+ ARGUMENT_COUNT=len(arguments))
cpp_header_path = self._FilePathForCppHeader(self._interface.id)
cpp_header_emitter = self._emitters.FileEmitter(cpp_header_path)
« no previous file with comments | « lib/dom/scripts/generator.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698