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

Unified Diff: dart/tools/dom/scripts/systemnative.py

Issue 119673004: Version 1.1.0-dev.5.2 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 6 years, 11 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 | « dart/tools/build.py ('k') | dart/tools/gyp/configurations.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tools/dom/scripts/systemnative.py
===================================================================
--- dart/tools/dom/scripts/systemnative.py (revision 31530)
+++ dart/tools/dom/scripts/systemnative.py (working copy)
@@ -89,6 +89,17 @@
_cpp_partial_map = {}
+_cpp_no_auto_scope_list = set([
+ ('Node', 'firstChild', 'Getter'),
+ ('Node', 'lastChild', 'Getter'),
+ ('Node', 'nextSibling', 'Getter'),
+ ('Node', 'previousSibling', 'Getter'),
+ ('Node', 'childNodes', 'Getter'),
+ ('NodeList', 'length', 'Getter'),
+ ('NodeList', 'item', 'Callback'),
+ ('Document', 'body', 'Getter'),
+])
+
def _GetCPPPartialNames(interface):
interface_name = interface.ext_attrs.get('ImplementedAs', interface.id)
if not _cpp_partial_map:
@@ -438,8 +449,10 @@
' DartDOMWrapper::lookupWrapper<Dart$(INTERFACE)>(domData, value);\n'
' if (result)\n'
' Dart_SetWeakHandleReturnValue(args, result);\n'
- ' else\n'
+ ' else {\n'
+ ' DartApiScope apiScope();\n'
' Dart_SetReturnValue(args, createWrapper(domData, value));\n'
+ ' }\n'
' }\n'
' }\n',
INTERFACE=self._interface.id)
@@ -1060,6 +1073,12 @@
def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration,
native_suffix, is_custom, emit_metadata=True):
+
+ def _GenerateAutoSetupScope(self, idl_name, native_suffix):
+ if ((self._interface.id, idl_name, native_suffix) not in _cpp_no_auto_scope_list):
+ return 'true'
+ return 'false'
+
metadata = []
if emit_metadata:
metadata = self._metadata.GetFormattedMetadata(
@@ -1076,15 +1095,17 @@
NATIVE_BINDING=native_binding)
cpp_callback_name = '%s%s' % (idl_name, native_suffix)
+ auto_scope_setup = _GenerateAutoSetupScope(self, idl_name, native_suffix)
self._cpp_resolver_emitter.Emit(
' if (argumentCount == $ARGC && name == "$NATIVE_BINDING") {\n'
- ' *autoSetupScope = true;\n'
+ ' *autoSetupScope = $AUTO_SCOPE_SETUP;\n'
' return Dart$(INTERFACE_NAME)Internal::$CPP_CALLBACK_NAME;\n'
' }\n',
ARGC=argument_count,
NATIVE_BINDING=native_binding,
INTERFACE_NAME=self._interface.id,
+ AUTO_SCOPE_SETUP=auto_scope_setup,
CPP_CALLBACK_NAME=cpp_callback_name)
if is_custom:
« no previous file with comments | « dart/tools/build.py ('k') | dart/tools/gyp/configurations.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698