| 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", JavaPackage="org.chromium.mojo.bindings.types"] | 5 [DartPackage="mojo", JavaPackage="org.chromium.mojo.bindings.types"] |
| 6 module mojo.bindings.types; | 6 module mojo.bindings.types; |
| 7 | 7 |
| 8 import "mojom_types.mojom"; | 8 import "mojom_types.mojom"; |
| 9 | 9 |
| 10 /* | 10 /* |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 // type; | 95 // type; |
| 96 array<string>? interfaces; | 96 array<string>? interfaces; |
| 97 array<string>? structs; | 97 array<string>? structs; |
| 98 array<string>? unions; | 98 array<string>? unions; |
| 99 array<string>? top_level_enums; | 99 array<string>? top_level_enums; |
| 100 array<string>? embedded_enums; | 100 array<string>? embedded_enums; |
| 101 | 101 |
| 102 // All the constant_keys known to the owning MojomFileGraph. | 102 // All the constant_keys known to the owning MojomFileGraph. |
| 103 array<string>? top_level_constants; | 103 array<string>? top_level_constants; |
| 104 array<string>? embedded_constants; | 104 array<string>? embedded_constants; |
| 105 }; | 105 }; |
| 106 | |
| 107 // This structure is a component of RuntimeTypeInfo. | |
| 108 // It contains the information necessary to extract the types corresponding | |
| 109 // to a single service. See the comments on RuntimeTypeInfo for a fuller | |
| 110 // explanation. | |
| 111 struct ServiceTypeInfo { | |
| 112 // The type_key of the top-level interface for the service. This is the | |
| 113 // type_key of the interface that was annotated with the "ServiceName" | |
| 114 // annotation. | |
| 115 string top_level_interface; | |
| 116 | |
| 117 // All of the type_keys of the types in the complete type set of the serive. | |
| 118 // Note that this set is not restricted to the types from a single .mojom | |
| 119 // file. | |
| 120 array<string> complete_type_set; | |
| 121 }; | |
| 122 | |
| 123 // This structure contains the information necessary for an implementation of | |
| 124 // |ServiceDescription| (see service_describer.mojom), but restricted to a | |
| 125 // single .mojom file and not restricted to a single service. At runtime an | |
| 126 // implementation of |ServiceDescription| needs to merge the |RuntimeTypeInfo| | |
| 127 // from all of the generated modules in the file graph and then filter on only | |
| 128 // those types in the complete type set of a single service. | |
| 129 // | |
| 130 // Note that this structure is not literally a component of a MojomFileGraph. | |
| 131 // Instead, at compile time an instance of this structure is created and | |
| 132 // serialized to an array of bytes that is stored in the | |
| 133 // |serialized_runtime_type_info| field of each |MojomFile|. Then at code | |
| 134 // generation time this array of bytes is written into the generated source | |
| 135 // code as a literal array of bytes. Then at runtime this array of bytes | |
| 136 // is deserialized into an instance of RuntimeTypeInfo that may be used by | |
| 137 // an implementation of |ServiceDescription|. | |
| 138 struct RuntimeTypeInfo { | |
| 139 // All of the services contained in a single .mojom file. A "service" is an | |
| 140 // interface that has been annoted with the "ServiceName" annotation. | |
| 141 // This indicates that it can be returned from | |
| 142 // ServiceProvider.ProvideService() and its description can be returned | |
| 143 // from ServiceDescriber.DescribeService(). The keys are the service names | |
| 144 // (as specified in the "ServiceName" annotation) and the values are instances | |
| 145 // of |ServiceTypeInfo| for that service. | |
| 146 // | |
| 147 // Note that the |type_map| field below is scoped to a single .mojom file and | |
| 148 // so some of the keys in the |complete_type_set| field of each | |
| 149 // |ServiceTypeInfo| struct may not occur in |type_map|. At runtime the | |
| 150 // |type_map|s from multiple files may need to be combined in order to | |
| 151 // get all of the types listed in the |complete_type_set| of a single service. | |
| 152 map<string, ServiceTypeInfo> services_by_name; | |
| 153 | |
| 154 // All of the resolved user-defined-types contained in a single .mojom File. | |
| 155 // The keys are the |type_key|s. | |
| 156 map<string, UserDefinedType> type_map; | |
| 157 }; | |
| OLD | NEW |