OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 {% import "struct.tmpl" as struct_macros %} | 5 {% import "struct.tmpl" as struct_macros %} |
6 {% import "runtime_type_macros.tmpl" as runtime_type_macros %} | 6 {% import "runtime_type_macros.tmpl" as runtime_type_macros %} |
7 | 7 |
8 {%- macro declare_params(struct) %} | 8 {%- macro declare_params(struct) %} |
9 {%- for field in struct.fields -%} | 9 {%- for field in struct.fields -%} |
10 {{field|name(False)}} {{field.kind|go_type}}{% if not loop.last %}, {% e
ndif %} | 10 {{field|name(False)}} {{field.kind|go_type}}{% if not loop.last %}, {% e
ndif %} |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 | 192 |
193 func (f *{{interface|name}}_Request) ServiceDescription() {{descpkg}}ServiceDesc
ription { | 193 func (f *{{interface|name}}_Request) ServiceDescription() {{descpkg}}ServiceDesc
ription { |
194 return &{{interface|name}}_ServiceDescription{} | 194 return &{{interface|name}}_ServiceDescription{} |
195 } | 195 } |
196 | 196 |
197 | 197 |
198 type {{interface|name}}_ServiceDescription struct{} | 198 type {{interface|name}}_ServiceDescription struct{} |
199 | 199 |
200 {% if should_gen_mojom_types and interface.service_name-%} | 200 {% if should_gen_mojom_types and interface.service_name-%} |
201 func (sd *{{interface|name}}_ServiceDescription) GetTopLevelInterface() (outMojo
mInterface {{typepkg}}MojomInterface, err error) { | 201 func (sd *{{interface|name}}_ServiceDescription) GetTopLevelInterface() (outMojo
mInterface {{typepkg}}MojomInterface, err error) { |
202 » interfaceTypeKey := getRuntimeTypeInfo().ServicesByName["{{interface.ser
vice_name}}"].TopLevelInterface | 202 » interfaceTypeKey := getRuntimeTypeInfo().Services["{{interface.service_n
ame}}"] |
203 userDefinedType := getRuntimeTypeInfo().TypeMap[interfaceTypeKey].(*{{ty
pepkg}}UserDefinedTypeInterfaceType) | 203 userDefinedType := getRuntimeTypeInfo().TypeMap[interfaceTypeKey].(*{{ty
pepkg}}UserDefinedTypeInterfaceType) |
204 return userDefinedType.Value, nil | 204 return userDefinedType.Value, nil |
205 } | 205 } |
206 | 206 |
207 func (sd *{{interface|name}}_ServiceDescription) GetTypeDefinition(inTypeKey str
ing) (outType mojom_types.UserDefinedType, err error) { | 207 func (sd *{{interface|name}}_ServiceDescription) GetTypeDefinition(inTypeKey str
ing) (outType mojom_types.UserDefinedType, err error) { |
208 if udt, ok := GetAllMojomTypeDefinitions()[inTypeKey]; ok { | 208 if udt, ok := GetAllMojomTypeDefinitions()[inTypeKey]; ok { |
209 return udt, nil | 209 return udt, nil |
210 } | 210 } |
211 return nil, fmt.Errorf("%s_ServiceDescription does not recognize %s", "{
{interface|name}}", inTypeKey) | 211 return nil, fmt.Errorf("%s_ServiceDescription does not recognize %s", "{
{interface|name}}", inTypeKey) |
212 } | 212 } |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 default: | 285 default: |
286 return &bindings.ValidationError{ | 286 return &bindings.ValidationError{ |
287 bindings.MessageHeaderUnknownMethod, | 287 bindings.MessageHeaderUnknownMethod, |
288 fmt.Sprintf("unknown method %v", message.Header.Type), | 288 fmt.Sprintf("unknown method %v", message.Header.Type), |
289 } | 289 } |
290 } | 290 } |
291 return | 291 return |
292 } | 292 } |
293 | 293 |
294 {% endmacro %} | 294 {% endmacro %} |
OLD | NEW |