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

Unified Diff: mojo/dart/packages/_mojo_for_test_only/lib/dart_to_cpp/dart_to_cpp.mojom.dart

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Update to master and regenerate mojoms 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/dart_to_cpp/dart_to_cpp.mojom.dart
diff --git a/mojo/dart/packages/_mojo_for_test_only/lib/dart_to_cpp/dart_to_cpp.mojom.dart b/mojo/dart/packages/_mojo_for_test_only/lib/dart_to_cpp/dart_to_cpp.mojom.dart
index 5bd1cd49039f76771979969715f76d6e5a07cfc7..214bc0b11071c0380741059ea52e6eeff4af78c6 100644
--- a/mojo/dart/packages/_mojo_for_test_only/lib/dart_to_cpp/dart_to_cpp.mojom.dart
+++ b/mojo/dart/packages/_mojo_for_test_only/lib/dart_to_cpp/dart_to_cpp.mojom.dart
@@ -5,9 +5,12 @@
library dart_to_cpp_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;
@@ -229,6 +232,96 @@ class EchoArgs extends bindings.Struct {
'Object containing handles cannot be encoded to JSON.');
}
}
zra 2016/01/15 21:01:33 Missing whitespace.
alexfandrianto 2016/01/20 00:08:28 It's not easy to make this good, so while I will t
zra 2016/01/27 18:15:11 We may need to compare source files directly to ea
+mojom_types.MojomStruct _dart_to_cpp_EchoArgs__() {
zra 2016/01/15 21:01:33 Even though they're library-private, it would be n
alexfandrianto 2016/01/20 00:08:28 Done.
+ return new mojom_types.MojomStruct()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = 'EchoArgs'
+ ..fullIdentifier = 'dart_to_cpp.EchoArgs')
+ ..fields = <mojom_types.StructField>[
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Si64')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.int64),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Si32')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.int32),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Si16')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.int16),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Si8')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.int8),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Ui64')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.uint64),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Ui32')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.uint32),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Ui16')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.uint16),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Ui8')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.uint8),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FloatVal')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.float),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FloatInf')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.float),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'FloatNan')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.float),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'DoubleVal')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.double),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'DoubleInf')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.double),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'DoubleNan')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.double),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Name')
+ ..type = (new mojom_types.Type()
+..stringType = (new mojom_types.StringType()..nullable = true)),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'StringArray')
+ ..type = (new mojom_types.Type()..arrayType = (new mojom_types.ArrayType()
+ ..nullable = true
+
+ ..elementType = (new mojom_types.Type()
+..stringType = (new mojom_types.StringType()..nullable = false)))),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'MessageHandle')
+ ..type = (new mojom_types.Type()
+..handleType = (new mojom_types.HandleType()
+..kind = mojom_types.HandleTypeKind.messagePipe
+..nullable = true)),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'DataHandle')
+ ..type = (new mojom_types.Type()
+..handleType = (new mojom_types.HandleType()
+..kind = mojom_types.HandleTypeKind.dataPipeConsumer
+..nullable = true)),
+ ];
+}
class EchoArgsList extends bindings.Struct {
@@ -305,6 +398,35 @@ class EchoArgsList extends bindings.Struct {
'Object containing handles cannot be encoded to JSON.');
}
}
+mojom_types.MojomStruct _dart_to_cpp_EchoArgsList__() {
+ return new mojom_types.MojomStruct()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = 'EchoArgsList'
+ ..fullIdentifier = 'dart_to_cpp.EchoArgsList')
+ ..fields = <mojom_types.StructField>[
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Next')
+ ..type = (new mojom_types.Type()
+ ..typeReference = (new mojom_types.TypeReference()
+ ..nullable = true
+
+
+ ..identifier = '_dart_to_cpp_EchoArgsList__'
zra 2016/01/15 21:01:33 Is this string part of some publicly visible, lang
alexfandrianto 2016/01/20 00:08:28 Yes, it is public to all.
+ ..typeKey = '_dart_to_cpp_EchoArgsList__'
+ )),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Item')
+ ..type = (new mojom_types.Type()
+ ..typeReference = (new mojom_types.TypeReference()
+ ..nullable = true
+
+
+ ..identifier = '_dart_to_cpp_EchoArgs__'
+ ..typeKey = '_dart_to_cpp_EchoArgs__'
+ )),
+ ];
+}
class _CppSideStartTestParams extends bindings.Struct {
@@ -363,6 +485,13 @@ class _CppSideStartTestParams extends bindings.Struct {
return map;
}
}
+mojom_types.MojomStruct _dart_to_cpp_CppSide_StartTest_Params__() {
+ return new mojom_types.MojomStruct()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = '_CppSideStartTestParams'
zra 2016/01/15 21:01:33 In the generated Dart bindings, this symbol is pri
alexfandrianto 2016/01/20 00:08:28 Yes, in discussions, we decided that we would only
+ ..fullIdentifier = 'dart_to_cpp._CppSideStartTestParams')
+ ..fields = <mojom_types.StructField>[];
+}
class _CppSideTestFinishedParams extends bindings.Struct {
@@ -421,6 +550,13 @@ class _CppSideTestFinishedParams extends bindings.Struct {
return map;
}
}
+mojom_types.MojomStruct _dart_to_cpp_CppSide_TestFinished_Params__() {
+ return new mojom_types.MojomStruct()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = '_CppSideTestFinishedParams'
+ ..fullIdentifier = 'dart_to_cpp._CppSideTestFinishedParams')
+ ..fields = <mojom_types.StructField>[];
+}
class _CppSidePingResponseParams extends bindings.Struct {
@@ -479,6 +615,13 @@ class _CppSidePingResponseParams extends bindings.Struct {
return map;
}
}
+mojom_types.MojomStruct _dart_to_cpp_CppSide_PingResponse_Params__() {
+ return new mojom_types.MojomStruct()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = '_CppSidePingResponseParams'
+ ..fullIdentifier = 'dart_to_cpp._CppSidePingResponseParams')
+ ..fields = <mojom_types.StructField>[];
+}
class _CppSideEchoResponseParams extends bindings.Struct {
@@ -546,6 +689,22 @@ class _CppSideEchoResponseParams extends bindings.Struct {
'Object containing handles cannot be encoded to JSON.');
}
}
+mojom_types.MojomStruct _dart_to_cpp_CppSide_EchoResponse_Params__() {
+ return new mojom_types.MojomStruct()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = '_CppSideEchoResponseParams'
+ ..fullIdentifier = 'dart_to_cpp._CppSideEchoResponseParams')
+ ..fields = <mojom_types.StructField>[
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'List')
+ ..type = (new mojom_types.Type()
+ ..typeReference = (new mojom_types.TypeReference()
+
+ ..identifier = '_dart_to_cpp_EchoArgsList__'
+ ..typeKey = '_dart_to_cpp_EchoArgsList__'
+ )),
zra 2016/01/15 21:01:33 Indentation problem.
azani 2016/01/15 23:21:57 To clarify, this mojom struct is automatically gen
alexfandrianto 2016/01/20 00:08:28 It's hard to get nested macros right, but it looks
+ ];
+}
class _DartSideSetClientParams extends bindings.Struct {
@@ -612,6 +771,22 @@ class _DartSideSetClientParams extends bindings.Struct {
'Object containing handles cannot be encoded to JSON.');
}
}
+mojom_types.MojomStruct _dart_to_cpp_DartSide_SetClient_Params__() {
+ return new mojom_types.MojomStruct()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = '_DartSideSetClientParams'
+ ..fullIdentifier = 'dart_to_cpp._DartSideSetClientParams')
+ ..fields = <mojom_types.StructField>[
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'CppSide')
+ ..type = (new mojom_types.Type()
+ ..typeReference = (new mojom_types.TypeReference()
+
+ ..identifier = '_dart_to_cpp_CppSide__'
+ ..typeKey = '_dart_to_cpp_CppSide__'
+ )),
+ ];
+}
class _DartSidePingParams extends bindings.Struct {
@@ -670,6 +845,13 @@ class _DartSidePingParams extends bindings.Struct {
return map;
}
}
+mojom_types.MojomStruct _dart_to_cpp_DartSide_Ping_Params__() {
+ return new mojom_types.MojomStruct()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = '_DartSidePingParams'
+ ..fullIdentifier = 'dart_to_cpp._DartSidePingParams')
+ ..fields = <mojom_types.StructField>[];
+}
class _DartSideEchoParams extends bindings.Struct {
@@ -745,12 +927,64 @@ class _DartSideEchoParams extends bindings.Struct {
'Object containing handles cannot be encoded to JSON.');
}
}
+mojom_types.MojomStruct _dart_to_cpp_DartSide_Echo_Params__() {
+ return new mojom_types.MojomStruct()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = '_DartSideEchoParams'
+ ..fullIdentifier = 'dart_to_cpp._DartSideEchoParams')
+ ..fields = <mojom_types.StructField>[
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'NumIterations')
+ ..type = (new mojom_types.Type()..simpleType = mojom_types.SimpleType.int32),
+
+ new mojom_types.StructField()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Arg')
+ ..type = (new mojom_types.Type()
+ ..typeReference = (new mojom_types.TypeReference()
+
+ ..identifier = '_dart_to_cpp_EchoArgs__'
+ ..typeKey = '_dart_to_cpp_EchoArgs__'
+ )),
+ ];
+}
+
const int _CppSide_startTestName = 88888888;
const int _CppSide_testFinishedName = 99999999;
const int _CppSide_pingResponseName = 100000000;
const int _CppSide_echoResponseName = 100000001;
+mojom_types.MojomInterface _dart_to_cpp_CppSide__() {
+ return new mojom_types.MojomInterface()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = 'CppSide'
+ ..fullIdentifier = 'dart_to_cpp.CppSide')
+ ..interfaceName = 'CppSide'
+ ..methods = <int, mojom_types.MojomMethod>{
+_CppSide_startTestName: new mojom_types.MojomMethod()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'StartTest')
+ ..ordinal = _CppSide_startTestName..parameters = _dart_to_cpp_CppSide_StartTest_Params__(),_CppSide_testFinishedName: new mojom_types.MojomMethod()
zra 2016/01/15 21:01:33 This doesn't look right. Missing newline here: _
alexfandrianto 2016/01/20 00:08:28 Done.
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'TestFinished')
+ ..ordinal = _CppSide_testFinishedName..parameters = _dart_to_cpp_CppSide_TestFinished_Params__(),_CppSide_pingResponseName: new mojom_types.MojomMethod()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'PingResponse')
+ ..ordinal = _CppSide_pingResponseName..parameters = _dart_to_cpp_CppSide_PingResponse_Params__(),_CppSide_echoResponseName: new mojom_types.MojomMethod()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'EchoResponse')
+ ..ordinal = _CppSide_echoResponseName..parameters = _dart_to_cpp_CppSide_EchoResponse_Params__(),
+ };
+}
+
+class _CppSideServiceDescription implements service_describer.ServiceDescription {
+dynamic getTopLevelInterface([Function responseFactory = null]) {
+ return _dart_to_cpp_CppSide__();
+ }
+ dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) {
+ return getAllMojomTypeDefinitions()[typeKey];
+ }
+ dynamic getAllTypeDefinitions([Function responseFactory = null]) {
+ return getAllMojomTypeDefinitions();
+ }
+}
+
abstract class CppSide {
static const String serviceName = null;
void startTest();
@@ -775,6 +1009,9 @@ class _CppSideProxyImpl extends bindings.Proxy {
return new _CppSideProxyImpl.fromEndpoint(endpoint);
}
+ service_describer.ServiceDescription get serviceDescription =>
+ new _CppSideServiceDescription();
+
void handleResponse(bindings.ServiceMessage message) {
switch (message.header.type) {
default:
@@ -957,12 +1194,45 @@ class CppSideStub extends bindings.Stub {
}
int get version => 0;
+
zra 2016/01/15 21:01:33 Extra newline.
alexfandrianto 2016/01/20 00:08:28 Done.
+
+ service_describer.ServiceDescription get serviceDescription =>
+ new _CppSideServiceDescription();
}
const int _DartSide_setClientName = 0;
const int _DartSide_pingName = 1;
const int _DartSide_echoName = 2;
+mojom_types.MojomInterface _dart_to_cpp_DartSide__() {
+ return new mojom_types.MojomInterface()
+ ..declData = (new mojom_types.DeclarationData()
+ ..shortName = 'DartSide'
+ ..fullIdentifier = 'dart_to_cpp.DartSide')
+ ..interfaceName = 'DartSide'
+ ..methods = <int, mojom_types.MojomMethod>{
+_DartSide_setClientName: new mojom_types.MojomMethod()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'SetClient')
+ ..ordinal = _DartSide_setClientName..parameters = _dart_to_cpp_DartSide_SetClient_Params__(),_DartSide_pingName: new mojom_types.MojomMethod()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Ping')
+ ..ordinal = _DartSide_pingName..parameters = _dart_to_cpp_DartSide_Ping_Params__(),_DartSide_echoName: new mojom_types.MojomMethod()
+ ..declData = (new mojom_types.DeclarationData()..shortName = 'Echo')
+ ..ordinal = _DartSide_echoName..parameters = _dart_to_cpp_DartSide_Echo_Params__(),
+ };
+}
+
+class _DartSideServiceDescription implements service_describer.ServiceDescription {
+dynamic getTopLevelInterface([Function responseFactory = null]) {
zra 2016/01/15 21:01:33 Indentation. These functions can also be written
alexfandrianto 2016/01/20 00:08:28 Done.
+ return _dart_to_cpp_DartSide__();
+ }
zra 2016/01/15 21:01:33 Missing newline.
alexfandrianto 2016/01/20 00:08:28 Done.
+ dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]) {
zra 2016/01/15 21:01:33 Missing space after ,
alexfandrianto 2016/01/20 00:08:28 Done.
+ return getAllMojomTypeDefinitions()[typeKey];
+ }
+ dynamic getAllTypeDefinitions([Function responseFactory = null]) {
+ return getAllMojomTypeDefinitions();
+ }
+}
+
abstract class DartSide {
static const String serviceName = null;
void setClient(Object cppSide);
@@ -986,6 +1256,9 @@ class _DartSideProxyImpl extends bindings.Proxy {
return new _DartSideProxyImpl.fromEndpoint(endpoint);
}
+ service_describer.ServiceDescription get serviceDescription =>
+ new _DartSideServiceDescription();
+
void handleResponse(bindings.ServiceMessage message) {
switch (message.header.type) {
default:
@@ -1157,6 +1430,62 @@ class DartSideStub extends bindings.Stub {
}
int get version => 0;
+
+
+ service_describer.ServiceDescription get serviceDescription =>
+ new _DartSideServiceDescription();
}
+
zra 2016/01/15 21:01:33 Lots of extra newlines.
+
+
+
+
+Map<String, mojom_types.UserDefinedType> _initDescriptions() {
+ var map = new HashMap<String, mojom_types.UserDefinedType>();
+map["_dart_to_cpp_EchoArgs__"] =
zra 2016/01/15 21:01:33 Indentation.
+ new mojom_types.UserDefinedType()
+ ..structType = _dart_to_cpp_EchoArgs__();
+map["_dart_to_cpp_EchoArgsList__"] =
zra 2016/01/15 21:01:33 Can these keys be Dart-styled?
+ new mojom_types.UserDefinedType()
+ ..structType = _dart_to_cpp_EchoArgsList__();
+map["_dart_to_cpp_CppSide_StartTest_Params__"] =
+ new mojom_types.UserDefinedType()
+ ..structType = _dart_to_cpp_CppSide_StartTest_Params__();
+map["_dart_to_cpp_CppSide_TestFinished_Params__"] =
+ new mojom_types.UserDefinedType()
+ ..structType = _dart_to_cpp_CppSide_TestFinished_Params__();
+map["_dart_to_cpp_CppSide_PingResponse_Params__"] =
+ new mojom_types.UserDefinedType()
+ ..structType = _dart_to_cpp_CppSide_PingResponse_Params__();
+map["_dart_to_cpp_CppSide_EchoResponse_Params__"] =
+ new mojom_types.UserDefinedType()
+ ..structType = _dart_to_cpp_CppSide_EchoResponse_Params__();
+map["_dart_to_cpp_DartSide_SetClient_Params__"] =
+ new mojom_types.UserDefinedType()
+ ..structType = _dart_to_cpp_DartSide_SetClient_Params__();
+map["_dart_to_cpp_DartSide_Ping_Params__"] =
+ new mojom_types.UserDefinedType()
+ ..structType = _dart_to_cpp_DartSide_Ping_Params__();
+map["_dart_to_cpp_DartSide_Echo_Params__"] =
+ new mojom_types.UserDefinedType()
+ ..structType = _dart_to_cpp_DartSide_Echo_Params__();
+map["_dart_to_cpp_CppSide__"] =
+ new mojom_types.UserDefinedType()
+ ..interfaceType = _dart_to_cpp_CppSide__();
+map["_dart_to_cpp_DartSide__"] =
+ new mojom_types.UserDefinedType()
+ ..interfaceType = _dart_to_cpp_DartSide__();
+
+ return map;
+}
+
+var _MojomDesc;
zra 2016/01/15 21:01:33 Map<String, mojom_types.UserDefinedType> _mojomDes
+Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() {
+ if (_MojomDesc == null) {
+ _MojomDesc = _initDescriptions();
+ }
+ return _MojomDesc;
+}
+

Powered by Google App Engine
This is Rietveld 408576698