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

Unified Diff: mojo/dart/packages/_mojo_for_test_only/lib/mojo/examples/echo.mojom.dart

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Merge with master Created 4 years, 11 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/dart/packages/_mojo_for_test_only/lib/mojo/examples/echo.mojom.dart
diff --git a/mojo/dart/packages/_mojo_for_test_only/lib/mojo/examples/echo.mojom.dart b/mojo/dart/packages/_mojo_for_test_only/lib/mojo/examples/echo.mojom.dart
index f456ad6b68b4e740b1e93bb57226df862d846fdb..ee99c52915254dd78d5887f6b11e2acb13444f65 100644
--- a/mojo/dart/packages/_mojo_for_test_only/lib/mojo/examples/echo.mojom.dart
+++ b/mojo/dart/packages/_mojo_for_test_only/lib/mojo/examples/echo.mojom.dart
@@ -5,9 +5,12 @@
library echo_mojom;
import 'dart:async';
+import 'dart:collection';
import 'package:mojo/bindings.dart' as bindings;
import 'package:mojo/core.dart' as core;
+import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types;
+import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as service_describer;
@@ -77,6 +80,21 @@ class _EchoEchoStringParams extends bindings.Struct {
}
}
+mojom_types.MojomStruct _echoEchoEchoStringParams() {
+ return new mojom_types.MojomStruct()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = 'EchoEchoStringParams'
+ ..fullIdentifier = 'mojo.examples.Echo_EchoString_Params')
+ ..fields = <mojom_types.StructField>[
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = 'Value')
+ ..type = (new mojom_types.Type()
+ ..stringType = (new mojom_types.StringType()
+ ..nullable = true
+ )),];
+}
+
class EchoEchoStringResponseParams extends bindings.Struct {
static const List<bindings.StructDataHeader> kVersions = const [
@@ -144,8 +162,51 @@ class EchoEchoStringResponseParams extends bindings.Struct {
}
}
+mojom_types.MojomStruct _echoEchoEchoStringResponseParams() {
+ return new mojom_types.MojomStruct()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = 'EchoEchoStringResponseParams'
+ ..fullIdentifier = 'mojo.examples.Echo_EchoString_ResponseParams')
+ ..fields = <mojom_types.StructField>[
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = 'Value')
+ ..type = (new mojom_types.Type()
+ ..stringType = (new mojom_types.StringType()
+ ..nullable = true
+ )),];
+}
+
+
const int _Echo_echoStringName = 0;
+mojom_types.MojomInterface _echoEcho() {
+ return new mojom_types.MojomInterface()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = 'Echo'
+ ..fullIdentifier = 'mojo.examples.Echo')
+ ..interfaceName = 'Echo'
+ ..methods = <int, mojom_types.MojomMethod>{
+ _Echo_echoStringName: new mojom_types.MojomMethod()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = 'EchoString')
+ ..ordinal = _Echo_echoStringName
+ ..responseParams = _echoEchoEchoStringResponseParams()
+ ..parameters = _echoEchoEchoStringParams(),
+ };
+}
+
+class _EchoServiceDescription implements service_describer.ServiceDescription {
+ dynamic getTopLevelInterface([Function responseFactory]) =>
+ _echoEcho();
+
+ dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
+ getAllMojomTypeDefinitions()[typeKey];
+
+ dynamic getAllTypeDefinitions([Function responseFactory]) =>
+ getAllMojomTypeDefinitions();
+}
+
abstract class Echo {
static const String serviceName = "mojo::examples::Echo";
dynamic echoString(String value,[Function responseFactory = null]);
@@ -167,6 +228,9 @@ class _EchoProxyImpl extends bindings.Proxy {
return new _EchoProxyImpl.fromEndpoint(endpoint);
}
+ service_describer.ServiceDescription get serviceDescription =>
+ new _EchoServiceDescription();
+
void handleResponse(bindings.ServiceMessage message) {
switch (message.header.type) {
case _Echo_echoStringName:
@@ -352,6 +416,31 @@ class EchoStub extends bindings.Stub {
}
int get version => 0;
+
+ service_describer.ServiceDescription get serviceDescription =>
+ new _EchoServiceDescription();
}
+Map<String, mojom_types.UserDefinedType> _initDescriptions() {
+ var map = new HashMap<String, mojom_types.UserDefinedType>();
+ map["echo_Echo_EchoString_Params__"] =
+ new mojom_types.UserDefinedType()
+ ..structType = _echoEchoEchoStringParams();
+ map["echo_Echo_EchoString_ResponseParams__"] =
+ new mojom_types.UserDefinedType()
+ ..structType = _echoEchoEchoStringResponseParams();
+ map["echo_Echo__"] =
+ new mojom_types.UserDefinedType()
+ ..interfaceType = _echoEcho();
+ return map;
+}
+
+var _mojomDesc;
+Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() {
+ if (_mojomDesc == null) {
+ _mojomDesc = _initDescriptions();
+ }
+ return _mojomDesc;
+}
+

Powered by Google App Engine
This is Rietveld 408576698