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

Side by Side Diff: mojo/dart/packages/mojo/lib/mojo/bindings/types/service_describer.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, 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 library service_describer_mojom; 5 library service_describer_mojom;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:mojo/bindings.dart' as bindings; 9 import 'package:mojo/bindings.dart' as bindings;
10 import 'package:mojo/core.dart' as core; 10 import 'package:mojo/core.dart' as core;
11 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types;
12
11 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types_ mojom; 13 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types_ mojom;
12 const String serviceDescriberInterfaceName = "_ServiceDescriber"; 14 const String serviceDescriberInterfaceName = "_ServiceDescriber";
13 15
14 16
15 17
16 class _ServiceDescriberDescribeServiceParams extends bindings.Struct { 18 class _ServiceDescriberDescribeServiceParams extends bindings.Struct {
17 static const List<bindings.StructDataHeader> kVersions = const [ 19 static const List<bindings.StructDataHeader> kVersions = const [
18 const bindings.StructDataHeader(24, 0) 20 const bindings.StructDataHeader(24, 0)
19 ]; 21 ];
20 String interfaceName = null; 22 String interfaceName = null;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 "descriptionRequest: $descriptionRequest" ")"; 82 "descriptionRequest: $descriptionRequest" ")";
81 } 83 }
82 84
83 Map toJson() { 85 Map toJson() {
84 throw new bindings.MojoCodecError( 86 throw new bindings.MojoCodecError(
85 'Object containing handles cannot be encoded to JSON.'); 87 'Object containing handles cannot be encoded to JSON.');
86 } 88 }
87 } 89 }
88 90
89 91
92
93
90 class _ServiceDescriptionGetTopLevelInterfaceParams extends bindings.Struct { 94 class _ServiceDescriptionGetTopLevelInterfaceParams extends bindings.Struct {
91 static const List<bindings.StructDataHeader> kVersions = const [ 95 static const List<bindings.StructDataHeader> kVersions = const [
92 const bindings.StructDataHeader(8, 0) 96 const bindings.StructDataHeader(8, 0)
93 ]; 97 ];
94 98
95 _ServiceDescriptionGetTopLevelInterfaceParams() : super(kVersions.last.size); 99 _ServiceDescriptionGetTopLevelInterfaceParams() : super(kVersions.last.size);
96 100
97 static _ServiceDescriptionGetTopLevelInterfaceParams deserialize(bindings.Mess age message) { 101 static _ServiceDescriptionGetTopLevelInterfaceParams deserialize(bindings.Mess age message) {
98 var decoder = new bindings.Decoder(message); 102 var decoder = new bindings.Decoder(message);
99 var result = decode(decoder); 103 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 return "_ServiceDescriptionGetTopLevelInterfaceParams("")"; 142 return "_ServiceDescriptionGetTopLevelInterfaceParams("")";
139 } 143 }
140 144
141 Map toJson() { 145 Map toJson() {
142 Map map = new Map(); 146 Map map = new Map();
143 return map; 147 return map;
144 } 148 }
145 } 149 }
146 150
147 151
152
153
148 class ServiceDescriptionGetTopLevelInterfaceResponseParams extends bindings.Stru ct { 154 class ServiceDescriptionGetTopLevelInterfaceResponseParams extends bindings.Stru ct {
149 static const List<bindings.StructDataHeader> kVersions = const [ 155 static const List<bindings.StructDataHeader> kVersions = const [
150 const bindings.StructDataHeader(16, 0) 156 const bindings.StructDataHeader(16, 0)
151 ]; 157 ];
152 mojom_types_mojom.MojomInterface mojomInterface = null; 158 mojom_types_mojom.MojomInterface mojomInterface = null;
153 159
154 ServiceDescriptionGetTopLevelInterfaceResponseParams() : super(kVersions.last. size); 160 ServiceDescriptionGetTopLevelInterfaceResponseParams() : super(kVersions.last. size);
155 161
156 static ServiceDescriptionGetTopLevelInterfaceResponseParams deserialize(bindin gs.Message message) { 162 static ServiceDescriptionGetTopLevelInterfaceResponseParams deserialize(bindin gs.Message message) {
157 var decoder = new bindings.Decoder(message); 163 var decoder = new bindings.Decoder(message);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 } 212 }
207 213
208 Map toJson() { 214 Map toJson() {
209 Map map = new Map(); 215 Map map = new Map();
210 map["mojomInterface"] = mojomInterface; 216 map["mojomInterface"] = mojomInterface;
211 return map; 217 return map;
212 } 218 }
213 } 219 }
214 220
215 221
222
223
216 class _ServiceDescriptionGetTypeDefinitionParams extends bindings.Struct { 224 class _ServiceDescriptionGetTypeDefinitionParams extends bindings.Struct {
217 static const List<bindings.StructDataHeader> kVersions = const [ 225 static const List<bindings.StructDataHeader> kVersions = const [
218 const bindings.StructDataHeader(16, 0) 226 const bindings.StructDataHeader(16, 0)
219 ]; 227 ];
220 String typeKey = null; 228 String typeKey = null;
221 229
222 _ServiceDescriptionGetTypeDefinitionParams() : super(kVersions.last.size); 230 _ServiceDescriptionGetTypeDefinitionParams() : super(kVersions.last.size);
223 231
224 static _ServiceDescriptionGetTypeDefinitionParams deserialize(bindings.Message message) { 232 static _ServiceDescriptionGetTypeDefinitionParams deserialize(bindings.Message message) {
225 var decoder = new bindings.Decoder(message); 233 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
273 } 281 }
274 282
275 Map toJson() { 283 Map toJson() {
276 Map map = new Map(); 284 Map map = new Map();
277 map["typeKey"] = typeKey; 285 map["typeKey"] = typeKey;
278 return map; 286 return map;
279 } 287 }
280 } 288 }
281 289
282 290
291
292
283 class ServiceDescriptionGetTypeDefinitionResponseParams extends bindings.Struct { 293 class ServiceDescriptionGetTypeDefinitionResponseParams extends bindings.Struct {
284 static const List<bindings.StructDataHeader> kVersions = const [ 294 static const List<bindings.StructDataHeader> kVersions = const [
285 const bindings.StructDataHeader(24, 0) 295 const bindings.StructDataHeader(24, 0)
286 ]; 296 ];
287 mojom_types_mojom.UserDefinedType type = null; 297 mojom_types_mojom.UserDefinedType type = null;
288 298
289 ServiceDescriptionGetTypeDefinitionResponseParams() : super(kVersions.last.siz e); 299 ServiceDescriptionGetTypeDefinitionResponseParams() : super(kVersions.last.siz e);
290 300
291 static ServiceDescriptionGetTypeDefinitionResponseParams deserialize(bindings. Message message) { 301 static ServiceDescriptionGetTypeDefinitionResponseParams deserialize(bindings. Message message) {
292 var decoder = new bindings.Decoder(message); 302 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 350 }
341 351
342 Map toJson() { 352 Map toJson() {
343 Map map = new Map(); 353 Map map = new Map();
344 map["type"] = type; 354 map["type"] = type;
345 return map; 355 return map;
346 } 356 }
347 } 357 }
348 358
349 359
360
361
350 class _ServiceDescriptionGetAllTypeDefinitionsParams extends bindings.Struct { 362 class _ServiceDescriptionGetAllTypeDefinitionsParams extends bindings.Struct {
351 static const List<bindings.StructDataHeader> kVersions = const [ 363 static const List<bindings.StructDataHeader> kVersions = const [
352 const bindings.StructDataHeader(8, 0) 364 const bindings.StructDataHeader(8, 0)
353 ]; 365 ];
354 366
355 _ServiceDescriptionGetAllTypeDefinitionsParams() : super(kVersions.last.size); 367 _ServiceDescriptionGetAllTypeDefinitionsParams() : super(kVersions.last.size);
356 368
357 static _ServiceDescriptionGetAllTypeDefinitionsParams deserialize(bindings.Mes sage message) { 369 static _ServiceDescriptionGetAllTypeDefinitionsParams deserialize(bindings.Mes sage message) {
358 var decoder = new bindings.Decoder(message); 370 var decoder = new bindings.Decoder(message);
359 var result = decode(decoder); 371 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 return "_ServiceDescriptionGetAllTypeDefinitionsParams("")"; 410 return "_ServiceDescriptionGetAllTypeDefinitionsParams("")";
399 } 411 }
400 412
401 Map toJson() { 413 Map toJson() {
402 Map map = new Map(); 414 Map map = new Map();
403 return map; 415 return map;
404 } 416 }
405 } 417 }
406 418
407 419
420
421
408 class ServiceDescriptionGetAllTypeDefinitionsResponseParams extends bindings.Str uct { 422 class ServiceDescriptionGetAllTypeDefinitionsResponseParams extends bindings.Str uct {
409 static const List<bindings.StructDataHeader> kVersions = const [ 423 static const List<bindings.StructDataHeader> kVersions = const [
410 const bindings.StructDataHeader(16, 0) 424 const bindings.StructDataHeader(16, 0)
411 ]; 425 ];
412 Map<String, mojom_types_mojom.UserDefinedType> definitions = null; 426 Map<String, mojom_types_mojom.UserDefinedType> definitions = null;
413 427
414 ServiceDescriptionGetAllTypeDefinitionsResponseParams() : super(kVersions.last .size); 428 ServiceDescriptionGetAllTypeDefinitionsResponseParams() : super(kVersions.last .size);
415 429
416 static ServiceDescriptionGetAllTypeDefinitionsResponseParams deserialize(bindi ngs.Message message) { 430 static ServiceDescriptionGetAllTypeDefinitionsResponseParams deserialize(bindi ngs.Message message) {
417 var decoder = new bindings.Decoder(message); 431 var decoder = new bindings.Decoder(message);
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 "definitions: $definitions" ")"; 538 "definitions: $definitions" ")";
525 } 539 }
526 540
527 Map toJson() { 541 Map toJson() {
528 Map map = new Map(); 542 Map map = new Map();
529 map["definitions"] = definitions; 543 map["definitions"] = definitions;
530 return map; 544 return map;
531 } 545 }
532 } 546 }
533 547
548
549
550
534 const int _ServiceDescriber_describeServiceName = 0; 551 const int _ServiceDescriber_describeServiceName = 0;
535 552
553
554
555 class _ServiceDescriberServiceDescription implements ServiceDescription {
556 dynamic getTopLevelInterface([Function responseFactory]) => null;
557
558 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
559
560 dynamic getAllTypeDefinitions([Function responseFactory]) => null;
561 }
562
536 abstract class ServiceDescriber { 563 abstract class ServiceDescriber {
537 static const String serviceName = "mojo::bindings::types::ServiceDescriber"; 564 static const String serviceName = "mojo::bindings::types::ServiceDescriber";
538 void describeService(String interfaceName, Object descriptionRequest); 565 void describeService(String interfaceName, Object descriptionRequest);
539 } 566 }
540 567
541 568
542 class _ServiceDescriberProxyImpl extends bindings.Proxy { 569 class _ServiceDescriberProxyImpl extends bindings.Proxy {
543 _ServiceDescriberProxyImpl.fromEndpoint( 570 _ServiceDescriberProxyImpl.fromEndpoint(
544 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 571 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
545 572
546 _ServiceDescriberProxyImpl.fromHandle(core.MojoHandle handle) : 573 _ServiceDescriberProxyImpl.fromHandle(core.MojoHandle handle) :
547 super.fromHandle(handle); 574 super.fromHandle(handle);
548 575
549 _ServiceDescriberProxyImpl.unbound() : super.unbound(); 576 _ServiceDescriberProxyImpl.unbound() : super.unbound();
550 577
551 static _ServiceDescriberProxyImpl newFromEndpoint( 578 static _ServiceDescriberProxyImpl newFromEndpoint(
552 core.MojoMessagePipeEndpoint endpoint) { 579 core.MojoMessagePipeEndpoint endpoint) {
553 assert(endpoint.setDescription("For _ServiceDescriberProxyImpl")); 580 assert(endpoint.setDescription("For _ServiceDescriberProxyImpl"));
554 return new _ServiceDescriberProxyImpl.fromEndpoint(endpoint); 581 return new _ServiceDescriberProxyImpl.fromEndpoint(endpoint);
555 } 582 }
556 583
584 ServiceDescription get serviceDescription =>
585 new _ServiceDescriberServiceDescription();
586
557 void handleResponse(bindings.ServiceMessage message) { 587 void handleResponse(bindings.ServiceMessage message) {
558 switch (message.header.type) { 588 switch (message.header.type) {
559 default: 589 default:
560 proxyError("Unexpected message type: ${message.header.type}"); 590 proxyError("Unexpected message type: ${message.header.type}");
561 close(immediate: true); 591 close(immediate: true);
562 break; 592 break;
563 } 593 }
564 } 594 }
565 595
566 String toString() { 596 String toString() {
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 assert(_impl == null); 721 assert(_impl == null);
692 _impl = d; 722 _impl = d;
693 } 723 }
694 724
695 String toString() { 725 String toString() {
696 var superString = super.toString(); 726 var superString = super.toString();
697 return "ServiceDescriberStub($superString)"; 727 return "ServiceDescriberStub($superString)";
698 } 728 }
699 729
700 int get version => 0; 730 int get version => 0;
731
732 ServiceDescription get serviceDescription =>
733 new _ServiceDescriberServiceDescription();
701 } 734 }
702 735
703 const int _ServiceDescription_getTopLevelInterfaceName = 0; 736 const int _ServiceDescription_getTopLevelInterfaceName = 0;
704 const int _ServiceDescription_getTypeDefinitionName = 1; 737 const int _ServiceDescription_getTypeDefinitionName = 1;
705 const int _ServiceDescription_getAllTypeDefinitionsName = 2; 738 const int _ServiceDescription_getAllTypeDefinitionsName = 2;
706 739
740
741
742 class _ServiceDescriptionServiceDescription implements ServiceDescription {
743 dynamic getTopLevelInterface([Function responseFactory]) => null;
744
745 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
746
747 dynamic getAllTypeDefinitions([Function responseFactory]) => null;
748 }
749
707 abstract class ServiceDescription { 750 abstract class ServiceDescription {
708 static const String serviceName = null; 751 static const String serviceName = null;
709 dynamic getTopLevelInterface([Function responseFactory = null]); 752 dynamic getTopLevelInterface([Function responseFactory = null]);
710 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]); 753 dynamic getTypeDefinition(String typeKey,[Function responseFactory = null]);
711 dynamic getAllTypeDefinitions([Function responseFactory = null]); 754 dynamic getAllTypeDefinitions([Function responseFactory = null]);
712 } 755 }
713 756
714 757
715 class _ServiceDescriptionProxyImpl extends bindings.Proxy { 758 class _ServiceDescriptionProxyImpl extends bindings.Proxy {
716 _ServiceDescriptionProxyImpl.fromEndpoint( 759 _ServiceDescriptionProxyImpl.fromEndpoint(
717 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 760 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
718 761
719 _ServiceDescriptionProxyImpl.fromHandle(core.MojoHandle handle) : 762 _ServiceDescriptionProxyImpl.fromHandle(core.MojoHandle handle) :
720 super.fromHandle(handle); 763 super.fromHandle(handle);
721 764
722 _ServiceDescriptionProxyImpl.unbound() : super.unbound(); 765 _ServiceDescriptionProxyImpl.unbound() : super.unbound();
723 766
724 static _ServiceDescriptionProxyImpl newFromEndpoint( 767 static _ServiceDescriptionProxyImpl newFromEndpoint(
725 core.MojoMessagePipeEndpoint endpoint) { 768 core.MojoMessagePipeEndpoint endpoint) {
726 assert(endpoint.setDescription("For _ServiceDescriptionProxyImpl")); 769 assert(endpoint.setDescription("For _ServiceDescriptionProxyImpl"));
727 return new _ServiceDescriptionProxyImpl.fromEndpoint(endpoint); 770 return new _ServiceDescriptionProxyImpl.fromEndpoint(endpoint);
728 } 771 }
729 772
773 ServiceDescription get serviceDescription =>
774 new _ServiceDescriptionServiceDescription();
775
730 void handleResponse(bindings.ServiceMessage message) { 776 void handleResponse(bindings.ServiceMessage message) {
731 switch (message.header.type) { 777 switch (message.header.type) {
732 case _ServiceDescription_getTopLevelInterfaceName: 778 case _ServiceDescription_getTopLevelInterfaceName:
733 var r = ServiceDescriptionGetTopLevelInterfaceResponseParams.deserialize ( 779 var r = ServiceDescriptionGetTopLevelInterfaceResponseParams.deserialize (
734 message.payload); 780 message.payload);
735 if (!message.header.hasRequestId) { 781 if (!message.header.hasRequestId) {
736 proxyError("Expected a message with a valid request Id."); 782 proxyError("Expected a message with a valid request Id.");
737 return; 783 return;
738 } 784 }
739 Completer c = completerMap[message.header.requestId]; 785 Completer c = completerMap[message.header.requestId];
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 assert(_impl == null); 1061 assert(_impl == null);
1016 _impl = d; 1062 _impl = d;
1017 } 1063 }
1018 1064
1019 String toString() { 1065 String toString() {
1020 var superString = super.toString(); 1066 var superString = super.toString();
1021 return "ServiceDescriptionStub($superString)"; 1067 return "ServiceDescriptionStub($superString)";
1022 } 1068 }
1023 1069
1024 int get version => 0; 1070 int get version => 0;
1071
1072 ServiceDescription get serviceDescription =>
1073 new _ServiceDescriptionServiceDescription();
1025 } 1074 }
1026 1075
1027 1076
1077
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698