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

Unified Diff: mojo/public/tools/bindings/generators/go_templates/interface.tmpl

Issue 1719873003: Mojom runtime type info: New implementation for Go. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebasing Created 4 years, 10 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: mojo/public/tools/bindings/generators/go_templates/interface.tmpl
diff --git a/mojo/public/tools/bindings/generators/go_templates/interface.tmpl b/mojo/public/tools/bindings/generators/go_templates/interface.tmpl
index ebb618b344069b13fc7e1adc714072c193dbd7e5..294bf02477f6886a362fadf834729db9ed785454 100644
--- a/mojo/public/tools/bindings/generators/go_templates/interface.tmpl
+++ b/mojo/public/tools/bindings/generators/go_templates/interface.tmpl
@@ -3,7 +3,6 @@
// found in the LICENSE file.
{% import "struct.tmpl" as struct_macros %}
-{% import "mojom_type_macros.tmpl" as mojom_type_macros %}
{%- macro declare_params(struct) %}
{%- for field in struct.fields -%}
@@ -77,6 +76,7 @@ func (f *{{interface|name}}_ServiceFactory) Name() string {
}
{% endif %}
+// TODO(rudominer) This should only be defined for top-level interfaces.
func (f *{{interface|name}}_ServiceFactory) ServiceDescription() {{descpkg}}ServiceDescription {
return &{{interface|name}}_ServiceDescription{}
}
@@ -183,7 +183,6 @@ func New{{interface|name}}Stub(r {{interface|name}}_Request, impl {{interface|na
return bindings.NewStub(connector, &{{interface|name(False)}}_Stub{connector, impl})
}
-{{ mojom_type_macros.writeMojomTypeDef(typepkg, interface, pkg, exported) }}
func (f *{{interface|name}}_Request) ServiceDescription() {{descpkg}}ServiceDescription {
return &{{interface|name}}_ServiceDescription{}
@@ -192,9 +191,11 @@ func (f *{{interface|name}}_Request) ServiceDescription() {{descpkg}}ServiceDesc
type {{interface|name}}_ServiceDescription struct{}
-{% if should_gen_mojom_types -%}
+{% if should_gen_mojom_types and interface.service_name-%}
func (sd *{{interface|name}}_ServiceDescription) GetTopLevelInterface() (outMojomInterface {{typepkg}}MojomInterface, err error) {
- return {{interface|mojom_type_identifier}}(), nil
+ interfaceTypeKey := runtimeTypeInfo__.ServicesByName["{{interface.service_name}}"].TopLevelInterface
+ userDefinedType := runtimeTypeInfo__.TypeMap[interfaceTypeKey].(*{{typepkg}}UserDefinedTypeInterfaceType)
+ return userDefinedType.Value, nil
}
func (sd *{{interface|name}}_ServiceDescription) GetTypeDefinition(inTypeKey string) (outType mojom_types.UserDefinedType, err error) {

Powered by Google App Engine
This is Rietveld 408576698