Chromium Code Reviews| Index: client/dom/scripts/systemnative.py |
| diff --git a/client/dom/scripts/systemnative.py b/client/dom/scripts/systemnative.py |
| index 7e8116719f029427e71b41d2701330fb6224162c..9235f9ed8eccdc7b37817c1433d45a51a89af1e0 100644 |
| --- a/client/dom/scripts/systemnative.py |
| +++ b/client/dom/scripts/systemnative.py |
| @@ -279,6 +279,18 @@ class NativeImplementationGenerator(systemwrapping.WrappingInterfaceGenerator): |
| type_info = GetIDLTypeInfo(self._interface) |
| arguments = [] |
| parameter_definitions_emitter = emitter.Emitter() |
| + create_function = 'create' |
| + if 'NamedConstructor' in self._interface.ext_attrs: |
| + raises_dart_exceptions = True |
| + parameter_definitions_emitter.Emit( |
| + ' DOMWindow* domWindow = DartUtilities::domWindowForCurrentIsolate();\n' |
| + ' if (!domWindow) {\n' |
| + ' exception = Dart_NewString("Failed to fetch domWindow");\n' |
| + ' goto fail;\n' |
| + ' }\n' |
| + ' Document* document = domWindow->document();\n') |
|
podivilov
2012/02/27 15:53:48
Our constructors seems to be very simple comparing
antonm
2012/02/27 15:59:36
I am not sure. For example, I am not sure they re
|
| + arguments.append('document') |
| + create_function = 'createForJSConstructor' |
| if 'CallWith' in self._interface.ext_attrs: |
| call_with = self._interface.ext_attrs['CallWith'] |
| if call_with == 'ScriptExecutionContext': |
| @@ -302,7 +314,7 @@ class NativeImplementationGenerator(systemwrapping.WrappingInterfaceGenerator): |
| callback_name='constructorCallback', |
| idl_node=self._interface, |
| parameter_definitions=parameter_definitions_emitter.Fragments(), |
| - needs_receiver=False, function_name='%s::create' % type_info.native_type(), |
| + needs_receiver=False, function_name='%s::%s' % (type_info.native_type(), create_function), |
| arguments=arguments, |
| idl_return_type=self._interface, |
| raises_dart_exceptions=raises_dart_exceptions, |
| @@ -314,8 +326,7 @@ class NativeImplementationGenerator(systemwrapping.WrappingInterfaceGenerator): |
| def _IsConstructable(self): |
| # FIXME: support ConstructorTemplate. |
| - # FIXME: support NamedConstructor. |
| - return set(['CustomConstructor', 'V8CustomConstructor', 'Constructor']) & set(self._interface.ext_attrs) |
| + return set(['CustomConstructor', 'V8CustomConstructor', 'Constructor', 'NamedConstructor']) & set(self._interface.ext_attrs) |
| def FinishInterface(self): |
| base = self._BaseClassName(self._interface) |
| @@ -736,7 +747,7 @@ class NativeImplementationGenerator(systemwrapping.WrappingInterfaceGenerator): |
| if include_name: |
| self._cpp_impl_includes[include_name] = 1 |
| flags = '' |
| - if idl_argument.ext_attrs.get('Optionial') == 'DefaultIsNullString': |
| + if idl_argument.ext_attrs.get('Optional') == 'DefaultIsNullString': |
|
podivilov
2012/02/27 15:53:48
This code is not actually used, do we really want
antonm
2012/02/27 15:59:36
Why it's not used? It's need, e.g., to make (most
podivilov
2012/02/27 16:59:49
Ok, seems like it is used for constructor paramete
|
| flags = ', DartUtilities::ConvertNullToEmptyString' |
| emitter.Emit( |
| '\n' |