| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 [DartPackage="mojo", | |
| 6 JavaPackage="org.chromium.mojo.bindings.types"] | |
| 7 module mojo.bindings.types; | |
| 8 | |
| 9 import "mojom_types.mojom"; | |
| 10 | |
| 11 /* | |
| 12 * The structures in this file are intended to be used by the Mojom compiler | |
| 13 * and code generators. The front end of the compiler takes as input a | |
| 14 * .mojom file (or a list of .mojom files) and produces a MojomFileGraph struct. | |
| 15 * | |
| 16 * The backend of the compiler consumes a MojomFileGraph and invokes each of the | |
| 17 * code generators passing them data derived from the MojomFileGraph. | |
| 18 * | |
| 19 * A MojomFile represents the data parsed from a single .mojom file. Mojom | |
| 20 * files form a directed acyclic graph via the "imports" relation. | |
| 21 * That is, if file A imports file B then there is a directed edge in the | |
| 22 * graph from A to B. A MojomFileGraph represents the whole Graph. | |
| 23 | |
| 24 * The Mojom structures represented here have been fully resolved, meaning that | |
| 25 * the type references have been associated with their corresponding type | |
| 26 * definitions. This resolved type data is contained in the resolved_types data | |
| 27 * in MojomFileGraph. | |
| 28 */ | |
| 29 | |
| 30 // A MojomFile represents the data defined by a single .mojom file, when | |
| 31 // all of the type references to types declared in imported .mojom files | |
| 32 // have been resolved. | |
| 33 struct MojomFile { | |
| 34 // |file_name| is (derived from) the file name of the corresponding | |
| 35 // .mojom file. It is the unique identifier for this module within the | |
| 36 // MojomFileGraph | |
| 37 string file_name; | |
| 38 | |
| 39 // |specified_file_name| is used to record information about the request that | |
| 40 // triggered the construction of the |MojomFileGraph| of which this | |
| 41 // |MojomFile| is a part. This field is populated by some producers (such | |
| 42 // as the Mojom compiler) but not necessarily all producers of this structure. | |
| 43 // If this field is null it means it is not supported by the producer. | |
| 44 // | |
| 45 // If this field is non-null but empty it means that this |MojomFile| | |
| 46 // was not explicitly requested but rather is included in the |MojomFileGraph| | |
| 47 // because it is referenced in the |imports| field of another |MojomFile| | |
| 48 // in the graph. If this field is non-empty it means that the corresponding | |
| 49 // .mojom file was explicitly requested, using |specified_file_name|. Note | |
| 50 // that in this case it is still possible that this file is also referenced | |
| 51 // in the |imports| field of another |MojomFile|. | |
| 52 string? specified_file_name; | |
| 53 | |
| 54 // The namespace is the identifier declared via the "module" declaration | |
| 55 // in the .mojom file. | |
| 56 string? module_namespace; | |
| 57 | |
| 58 // Attributes declared in the Mojom file at the module level. | |
| 59 array<Attribute>? attributes; | |
| 60 | |
| 61 // The list of other MojomFiles imported by this one. The elements | |
| 62 // of the array are the |file_name|s and the associated module may | |
| 63 // be retrieved from the MojomFileGraph. | |
| 64 array<string>? imports; | |
| 65 | |
| 66 // resolved_types and resolved_values in MojomFileGraph contain | |
| 67 // respectively the types and constants declared in the union of all modules | |
| 68 // in the graph. This KeysByType selects the keys of the types and constants | |
| 69 // defined in this module | |
| 70 KeysByType declared_mojom_objects; | |
| 71 | |
| 72 // The bytes encoding a |RuntimeTypeInfo| struct for this Mojom file, | |
| 73 // using Mojo message serialization. Some implementations may not include | |
| 74 // this. This string contains the base64 encoding of the gzip-compressed | |
| 75 // bytes. | |
| 76 string? serialized_runtime_type_info; | |
| 77 }; | |
| 78 | |
| 79 // Represents a directed acyclic graph of MojomFiles. | |
| 80 struct MojomFileGraph { | |
| 81 // All the files in this graph. The keys are |file_name|s. | |
| 82 map<string, MojomFile> files; | |
| 83 | |
| 84 // All the resolved user-defined types in all the files in the graph. The keys
are | |
| 85 // the |type_key|s. | |
| 86 map<string, UserDefinedType> resolved_types; | |
| 87 | |
| 88 // All the resolved DeclaredConstants in all the files in the graph. The keys
are | |
| 89 // the |constant_key|s. | |
| 90 map<string, DeclaredConstant> resolved_constants; | |
| 91 }; | |
| 92 | |
| 93 // A KeysByType struct organizes by type the keys of all types and consants in | |
| 94 // a MojomFile | |
| 95 struct KeysByType { | |
| 96 // The type keys of the types in the MojomFile. | |
| 97 array<string>? interfaces; | |
| 98 array<string>? structs; | |
| 99 array<string>? unions; | |
| 100 array<string>? top_level_enums; | |
| 101 array<string>? embedded_enums; | |
| 102 | |
| 103 // The constant keys of the constants in the MojomFile. | |
| 104 array<string>? top_level_constants; | |
| 105 array<string>? embedded_constants; | |
| 106 }; | |
| OLD | NEW |