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

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

Issue 10698108: Stop passing HtmlSystemShared around and move html renaming to IDLTypeInfo. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 5 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
Index: lib/dom/scripts/systemnative.py
diff --git a/lib/dom/scripts/systemnative.py b/lib/dom/scripts/systemnative.py
index 255ec92ba5ff93c3f70623329c40454bc47aa805..a2a8d8a4599d44aeb36a5cdcd5cd28a70972dd74 100644
--- a/lib/dom/scripts/systemnative.py
+++ b/lib/dom/scripts/systemnative.py
@@ -10,7 +10,6 @@ import emitter
import os
import systembase
from generator import *
-from systemhtml import HtmlSystemShared
class NativeImplementationSystem(systembase.System):
@@ -21,7 +20,6 @@ class NativeImplementationSystem(systembase.System):
self._auxiliary_dir = auxiliary_dir
self._cpp_header_files = []
self._cpp_impl_files = []
- self._html_system = HtmlSystemShared(database)
def ImplementationGenerator(self, interface):
return NativeImplementationGenerator(self, interface)
@@ -168,9 +166,7 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
system._database, interface)
self._system = system
self._current_secondary_parent = None
- self._html_system = self._system._html_system
- self._html_interface_name = self._html_system._html_renames.get(
- self._interface.id, self._interface.id)
+ self._html_interface_name = DartInterfaceName(self._interface)
def HasImplementation(self):
return not IsPureInterface(self._interface.id)
@@ -321,9 +317,6 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
def _ImplClassName(self, interface_name):
return '_%sImpl' % interface_name
- def _DartType(self, idl_type):
- return self._html_system.DartType(idl_type)
-
def _BaseClassName(self):
root_class = 'NativeFieldWrapperClass1'
@@ -360,7 +353,7 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
template,
FACTORYPROVIDER=factory_provider,
INTERFACE=self._html_interface_name,
- PARAMETERS=constructor_info.ParametersImplementationDeclaration(self._DartType),
+ PARAMETERS=constructor_info.ParametersImplementationDeclaration(),
ARGUMENTS=constructor_info.ParametersAsArgumentList(),
NATIVE_NAME=native_binding)
@@ -480,7 +473,7 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
def _AddGetter(self, attr, html_name):
type_info = GetIDLTypeInfo(attr.type.id)
- dart_declaration = '%s get %s()' % (self._DartType(attr.type.id), html_name)
+ dart_declaration = '%s get %s()' % (DartType(attr.type.id), html_name)
is_custom = 'Custom' in attr.ext_attrs or 'CustomGetter' in attr.ext_attrs
cpp_callback_name = self._GenerateNativeBinding(attr.id, 1,
dart_declaration, 'Getter', is_custom)
@@ -518,7 +511,7 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
def _AddSetter(self, attr, html_name):
type_info = GetIDLTypeInfo(attr.type.id)
- dart_declaration = 'void set %s(%s)' % (html_name, self._DartType(attr.type.id))
+ dart_declaration = 'void set %s(%s)' % (html_name, DartType(attr.type.id))
is_custom = set(['Custom', 'CustomSetter', 'V8CustomSetter']) & set(attr.ext_attrs)
cpp_callback_name = self._GenerateNativeBinding(attr.id, 2,
dart_declaration, 'Setter', is_custom)
@@ -571,7 +564,7 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
#
# class YImpl extends ListBase<T> { copies of transitive XImpl methods; }
#
- dart_element_type = self._DartType(element_type)
+ dart_element_type = DartType(element_type)
if self._HasNativeIndexGetter():
self._EmitNativeIndexGetter(dart_element_type)
else:
@@ -612,7 +605,7 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
# Uint8ClampedArray inherits from Uint8Array, ::set method
# is not virtual and accessing it through Uint8Array pointer
# would lead to wrong semantics (modulo vs. clamping.)
- dart_element_type = self._DartType(element_type)
+ dart_element_type = DartType(element_type)
if self._HasNativeIndexGetter():
self._EmitNativeIndexGetter(dart_element_type)
@@ -637,7 +630,7 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
self._GenerateNativeBinding('numericIndexSetter', 3, dart_declaration,
'Callback', True)
- def _AddOperation(self, info):
+ def AddOperation(self, info, html_name):
"""
Arguments:
info: An OperationInfo object.
@@ -649,22 +642,12 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
# FIXME: exclude from interface as well.
return
- html_name = self._html_system.RenameInHtmlLibrary(
- self._interface.id, info.name, implementation_class=True)
-
- if not html_name and info.name == 'item':
- # FIXME: item should be renamed to operator[], not removed.
- html_name = '_item'
-
- if not html_name:
- return
-
is_custom = 'Custom' in operation.ext_attrs
has_optional_arguments = any(_IsArgumentOptionalInWebCore(argument) for argument in operation.arguments)
needs_dispatcher = not is_custom and (len(info.operations) > 1 or has_optional_arguments)
if not needs_dispatcher:
- type_renamer = self._DartType
+ type_renamer = DartType
default_value = 'null'
else:
type_renamer = lambda x: 'Dynamic'
@@ -672,7 +655,7 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
dart_declaration = '%s%s %s(%s)' % (
'static ' if info.IsStatic() else '',
- self._DartType(info.type_name),
+ DartType(info.type_name),
html_name,
info.ParametersImplementationDeclaration(type_renamer, default_value))
@@ -716,7 +699,7 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
dart_declaration = '%s%s _%s(%s)' % (
'static ' if operation.is_static else '',
- self._DartType(operation.type.id), overload_name, argument_list)
+ DartType(operation.type.id), overload_name, argument_list)
cpp_callback_name = self._GenerateNativeBinding(
overload_name, (0 if operation.is_static else 1) + argument_count,
dart_declaration, 'Callback', False)
@@ -728,7 +711,7 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
argument = operation.arguments[i]
argument_name = argument_names[i]
checks[i] = '(%s is %s || %s === null)' % (
- argument_name, self._DartType(argument.type.id), argument_name)
+ argument_name, DartType(argument.type.id), argument_name)
GenerateCall(operation, argument_count, checks)
# TODO: Optimize the dispatch to avoid repeated checks.
@@ -747,12 +730,6 @@ class NativeImplementationGenerator(systembase.BaseGenerator):
GenerateCall(operation, position, [check])
GenerateCall(operation, len(operation.arguments), [])
- def AddOperation(self, info):
- self._AddOperation(info)
-
- def AddStaticOperation(self, info):
- self._AddOperation(info)
-
def SecondaryContext(self, interface):
pass

Powered by Google App Engine
This is Rietveld 408576698