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 [DartPackage="mojo", | 5 [DartPackage="mojo", |
6 JavaPackage="org.chromium.mojo.bindings.types"] | 6 JavaPackage="org.chromium.mojo.bindings.types"] |
7 module mojo.bindings.types; | 7 module mojo.bindings.types; |
8 | 8 |
9 import "mojom_types.mojom"; | 9 import "mojom_types.mojom"; |
10 | 10 |
11 /* | 11 /* |
12 * The structures in this file are intended to be used by the Mojom compiler | 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 | 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. | 14 * .mojom file (or a list of .mojom files) and produces a MojomFileGraph struct. |
15 * | 15 * |
16 * The backend of the compiler consumes a MojomFileGraph and invokes each of the | 16 * The backend of the compiler consumes a MojomFileGraph and invokes each of the |
17 * code generators passing them data derived from the MojomFileGraph. | 17 * code generators passing them data derived from the MojomFileGraph. |
18 * | 18 * |
19 * A MojomFile represents the data parsed from a single .mojom file. Mojom | 19 * A MojomFile represents the data parsed from a single .mojom file. Mojom |
20 * modules form a directed acyclic graph via the "imports" relation. | 20 * files form a directed acyclic graph via the "imports" relation. |
21 * That is, if Module A imports Module B then there is a directed edge in the | 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. | 22 * graph from A to B. A MojomFileGraph represents the whole Graph. |
23 | 23 |
24 * The Mojom structures represented here have been fully resolved, meaning that | 24 * The Mojom structures represented here have been fully resolved, meaning that |
25 * the type references have been associated with their corresponding type | 25 * the type references have been associated with their corresponding type |
26 * definitions. This resolved type data is contained in the resolved_types data | 26 * definitions. This resolved type data is contained in the resolved_types data |
27 * in MojomFileGraph. | 27 * in MojomFileGraph. |
28 */ | 28 */ |
29 | 29 |
30 // A MojomFile represents the data defined by a single .mojom file, when | 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 | 31 // all of the type references to types declared in imported .mojom files |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 // this. This string contains the base64 encoding of the gzip-compressed | 74 // this. This string contains the base64 encoding of the gzip-compressed |
75 // bytes. | 75 // bytes. |
76 string? serialized_runtime_type_info; | 76 string? serialized_runtime_type_info; |
77 }; | 77 }; |
78 | 78 |
79 // Represents a directed acyclic graph of MojomFiles. | 79 // Represents a directed acyclic graph of MojomFiles. |
80 struct MojomFileGraph { | 80 struct MojomFileGraph { |
81 // All the files in this graph. The keys are |file_name|s. | 81 // All the files in this graph. The keys are |file_name|s. |
82 map<string, MojomFile> files; | 82 map<string, MojomFile> files; |
83 | 83 |
84 // All the resolved user-defined types known to this structure. The keys are | 84 // All the resolved user-defined types in all the files in the graph. The keys
are |
85 // the |type_key|s. | 85 // the |type_key|s. |
86 map<string, UserDefinedType> resolved_types; | 86 map<string, UserDefinedType> resolved_types; |
87 | 87 |
88 // All the resolved user-defined values known to this structure. The keys are | 88 // All the resolved DeclaredConstants in all the files in the graph. The keys
are |
89 // the |value_key|s. | 89 // the |constant_key|s. |
90 map<string, UserDefinedValue> resolved_values; | 90 map<string, DeclaredConstant> resolved_constants; |
91 }; | 91 }; |
92 | 92 |
93 // A KeysByType struct organizes by type all of the type and constant keys known | 93 // A KeysByType struct organizes by type the keys of all types and consants in |
94 // to an associated MojomFileGraph. | 94 // a MojomFile |
95 struct KeysByType { | 95 struct KeysByType { |
96 // All the type_keys known to the owning MojomFileGraph, organized by | 96 // The type keys of the types in the MojomFile. |
97 // type; | |
98 array<string>? interfaces; | 97 array<string>? interfaces; |
99 array<string>? structs; | 98 array<string>? structs; |
100 array<string>? unions; | 99 array<string>? unions; |
101 array<string>? top_level_enums; | 100 array<string>? top_level_enums; |
102 array<string>? embedded_enums; | 101 array<string>? embedded_enums; |
103 | 102 |
104 // All the constant_keys known to the owning MojomFileGraph. | 103 // The constant keys of the constants in the MojomFile. |
105 array<string>? top_level_constants; | 104 array<string>? top_level_constants; |
106 array<string>? embedded_constants; | 105 array<string>? embedded_constants; |
107 }; | 106 }; |
OLD | NEW |