| // Copyright 2015 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. | 
 |  | 
 | [JavaPackage="org.chromium.mojo.bindings.types"] | 
 | module mojo.bindings.types; | 
 |  | 
 | import "mojom_types.mojom"; | 
 |  | 
 | /* | 
 | * The structures in this file are intended to be used by the Mojom compiler | 
 | * and code generators. The front end of the compiler takes as input a | 
 | * .mojom file (or a list of .mojom files) and produces a MojomFileGraph struct. | 
 | * | 
 | * The backend of the compiler consumes a MojomFileGraph and invokes each of the | 
 | * code generators passing them data derived from the MojomFileGraph. | 
 | * | 
 | * A MojomFile represents the data parsed from a single .mojom file. Mojom | 
 | * modules form a directed acyclic graph via the "imports" relation. | 
 | * That is, if Module A imports Module B then there is a directed edge in the | 
 | * graph from A to B. A MojomFileGraph represents the whole Graph. | 
 |  | 
 | * The Mojom structures represented here have been fully resolved, meaning that | 
 | * the type references have been associated with their corresponding type | 
 | * definitions. This resolved type data is contained in the resolved_types data | 
 | * in MojomFileGraph. | 
 | */ | 
 |  | 
 | // A MojomFile represents the data defined by a single .mojom file, when | 
 | // all of the type references to types declared in imported .mojom files | 
 | // have been resolved. | 
 | struct MojomFile { | 
 |   // |file_name| is (derived from) the file name of the corresponding | 
 |   // .mojom file. It is the unique identifier for this module within the | 
 |   // MojomFileGraph | 
 |   string file_name; | 
 |  | 
 |    // The namespace is the identifier declared via the "module" declaration | 
 |    // in the .mojom file. | 
 |   string? module_namespace; | 
 |  | 
 |   // Attributes declared in the Mojom file at the module level. | 
 |   array<Attribute>? attributes; | 
 |  | 
 |   // The list of other MojomFiles imported by this one. The elements | 
 |   // of the array are the |file_name|s and the associated module may | 
 |   // be retrieved from the  MojomFileGraph. | 
 |   array<string>? imports; | 
 |  | 
 |   // resolved_types and resolved_values in MojomFileGraph contain | 
 |   // respectively the types and constants declared in the union of all modules | 
 |   // in the graph. This KeysByType selects the keys of the types and constants | 
 |   // defined in this module | 
 |   KeysByType declared_mojom_objects; | 
 | }; | 
 |  | 
 | // Represents a directed acyclic graph of MojomFiles. | 
 | struct MojomFileGraph { | 
 |   // All the files in this graph. The keys are file names | 
 |   map<string, MojomFile> files; | 
 |  | 
 |   // All the resolved user-defined types known to this structure. The keys are | 
 |   // the |type_key|s. | 
 |   map<string, UserDefinedType> resolved_types; | 
 |  | 
 |   // All the resolved user-defined values known to this structure. The keys are | 
 |   // the |value_key|s. | 
 |   map<string, UserDefinedValue> resolved_values; | 
 | }; | 
 |  | 
 | // A KeysByType struct organizes by type all of the type and constant keys known | 
 | // to an associated MojomFileGraph. | 
 | struct KeysByType { | 
 |   // All the type_keys known to the owning MojomFileGraph, organized by | 
 |   // type; | 
 |   array<string>? interfaces; | 
 |   array<string>? structs; | 
 |   array<string>? unions; | 
 |   array<string>? top_level_enums; | 
 |   array<string>? embedded_enums; | 
 |  | 
 |   // All the constant_keys known to the owning MojomFileGraph. | 
 |   array<string>? top_level_constants; | 
 |   array<string>? embedded_constants; | 
 | }; | 
 |  |