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

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

Issue 119543002: - Setup infrastructure to white list some native methods as not requiring (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/dom/scripts/systemnative.py
===================================================================
--- tools/dom/scripts/systemnative.py (revision 31340)
+++ tools/dom/scripts/systemnative.py (working copy)
@@ -89,6 +89,17 @@
_cpp_partial_map = {}
+_cpp_no_auto_scope_list = [
+ ['Node', 'firstChild', 'Getter'],
vsm 2013/12/20 18:18:56 More efficient to make this a set of tuples instea
siva 2013/12/20 18:46:00 Done.
+ ['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,15 @@
def _GenerateNativeBinding(self, idl_name, argument_count, dart_declaration,
native_suffix, is_custom, emit_metadata=True):
+
+ def _GenerateAutoSetupScope(self, idl_name, native_suffix):
vsm 2013/12/20 18:18:56 With the above, this function can be: return (sel
siva 2013/12/20 18:46:00 Done.
+ for no_scope in _cpp_no_auto_scope_list:
+ if (self._interface.id == no_scope[0] and
+ idl_name == no_scope[1] and
+ native_suffix == no_scope[2]):
+ return 'false'
+ return 'true'
+
metadata = []
if emit_metadata:
metadata = self._metadata.GetFormattedMetadata(
@@ -1076,15 +1098,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 | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698