Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Unified Diff: mojo/public/interfaces/bindings/mojom_types.mojom

Issue 1717583003: Mojom compiler: Move RuntimeTypeInfo from mojom_files.mojom to mojom_types.mojom. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: New sha1s Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: mojo/public/interfaces/bindings/mojom_types.mojom
diff --git a/mojo/public/interfaces/bindings/mojom_types.mojom b/mojo/public/interfaces/bindings/mojom_types.mojom
index c0365597c69fce30a09c4c4e461909f9dca7a56a..bd29dbcabb81d763ea5633c0bff18b10e1f6b3e6 100644
--- a/mojo/public/interfaces/bindings/mojom_types.mojom
+++ b/mojo/public/interfaces/bindings/mojom_types.mojom
@@ -447,3 +447,58 @@ struct ContainedDeclarations {
// The the constant keys of constants declared in this namespace.
array<string>? constants;
};
+
+///////////////// Runtime Type Information //////////////////////
+
+// This structure is a component of RuntimeTypeInfo.
+// It contains the information necessary to extract the types corresponding
+// to a single service. See the comments on RuntimeTypeInfo for a fuller
+// explanation.
+struct ServiceTypeInfo {
+ // The type_key of the top-level interface for the service. This is the
+ // type_key of the interface that was annotated with the "ServiceName"
+ // annotation.
+ string top_level_interface;
+
+ // All of the type_keys of the types in the complete type set of the serive.
+ // Note that this set is not restricted to the types from a single .mojom
+ // file.
+ array<string> complete_type_set;
+};
+
+// This structure contains the information necessary for an implementation of
+// |ServiceDescription| (see service_describer.mojom), but restricted to a
+// single .mojom file and not restricted to a single service. At runtime an
+// implementation of |ServiceDescription| needs to merge the |RuntimeTypeInfo|
+// from all of the generated modules in the file graph and then filter on only
+// those types in the complete type set of a single service.
+//
+// Note that this structure is not literally a component of a MojomFileGraph.
+// Instead, at compile time an instance of this structure is created and
+// serialized to an array of bytes that is stored in the
+// |serialized_runtime_type_info| field of each |MojomFile|. Then at code
+// generation time this array of bytes is written into the generated source
+// code as a literal array of bytes. Then at runtime this array of bytes
+// is deserialized into an instance of RuntimeTypeInfo that may be used by
+// an implementation of |ServiceDescription|.
+struct RuntimeTypeInfo {
+ // All of the services contained in a single .mojom file. A "service" is an
+ // interface that has been annoted with the "ServiceName" annotation.
+ // This indicates that it can be returned from
+ // ServiceProvider.ProvideService() and its description can be returned
+ // from ServiceDescriber.DescribeService(). The keys are the service names
+ // (as specified in the "ServiceName" annotation) and the values are instances
+ // of |ServiceTypeInfo| for that service.
+ //
+ // Note that the |type_map| field below is scoped to a single .mojom file and
+ // so some of the keys in the |complete_type_set| field of each
+ // |ServiceTypeInfo| struct may not occur in |type_map|. At runtime the
+ // |type_map|s from multiple files may need to be combined in order to
+ // get all of the types listed in the |complete_type_set| of a single service.
+ map<string, ServiceTypeInfo> services_by_name;
+
+ // All of the resolved user-defined-types contained in a single .mojom File.
+ // The keys are the |type_key|s.
+ map<string, UserDefinedType> type_map;
+};
+

Powered by Google App Engine
This is Rietveld 408576698