| // Copyright 2016 The Chromium Authors. All rights reserved. |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| |
| {% macro maybeWriteStaticMojomTypeAccessor(typepkg, type) %} |
| {% if should_gen_mojom_types and type|mojom_type_key != "" %} |
| |
| // {{type|name(true)}}MojomType returns the UserDefinedType that describes the Mojom |
| // type of {{type|name(true)}}. To obtain the UserDefinedType for Mojom types recursively |
| // contained in the returned UserDefinedType, look in the map returned |
| // by the function GetAllMojomTypeDefinitions(). |
| func {{type|name(true)}}MojomType() {{typepkg}}UserDefinedType { |
| return GetAllMojomTypeDefinitions()["{{type|mojom_type_key}}"] |
| } |
| |
| {% endif %} |
| {% endmacro %} |
| |
| |
| {% macro maybeWriteMojomTypeAccessor(typepkg, staticType, typeName) %} |
| {% if should_gen_mojom_types and staticType|mojom_type_key != "" %} |
| |
| // MojomType returns the UserDefinedType that describes the Mojom |
| // type of this object. To obtain the UserDefinedType for Mojom types recursively |
| // contained in the returned UserDefinedType, look in the map returned |
| // by the function AllMojomTypes(). |
| func (*{{typeName}}) MojomType() {{typepkg}}UserDefinedType { |
| return {{staticType|name(true)}}MojomType() |
| } |
| |
| // AllMojomTypes returns a map that contains the UserDefinedType for |
| // all Mojom types in the complete type graph of the Mojom type of this object. |
| func (*{{typeName}}) AllMojomTypes() map[string]{{typepkg}}UserDefinedType { |
| return GetAllMojomTypeDefinitions() |
| } |
| {% endif %} |
| {% endmacro %} |