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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/http_server/http_server.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 http_server_mojom; 5 library http_server_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 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
11 import 'package:mojo_services/http_server/http_request.mojom.dart' as http_reque st_mojom; 13 import 'package:mojo_services/http_server/http_request.mojom.dart' as http_reque st_mojom;
12 import 'package:mojo_services/http_server/http_response.mojom.dart' as http_resp onse_mojom; 14 import 'package:mojo_services/http_server/http_response.mojom.dart' as http_resp onse_mojom;
13 15
14 16
15 17
16 class _HttpServerSetHandlerParams extends bindings.Struct { 18 class _HttpServerSetHandlerParams 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 pattern = null; 22 String pattern = null;
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 "handler: $handler" ")"; 82 "handler: $handler" ")";
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 HttpServerSetHandlerResponseParams extends bindings.Struct { 94 class HttpServerSetHandlerResponseParams extends bindings.Struct {
91 static const List<bindings.StructDataHeader> kVersions = const [ 95 static const List<bindings.StructDataHeader> kVersions = const [
92 const bindings.StructDataHeader(16, 0) 96 const bindings.StructDataHeader(16, 0)
93 ]; 97 ];
94 bool success = false; 98 bool success = false;
95 99
96 HttpServerSetHandlerResponseParams() : super(kVersions.last.size); 100 HttpServerSetHandlerResponseParams() : super(kVersions.last.size);
97 101
98 static HttpServerSetHandlerResponseParams deserialize(bindings.Message message ) { 102 static HttpServerSetHandlerResponseParams deserialize(bindings.Message message ) {
99 var decoder = new bindings.Decoder(message); 103 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 } 151 }
148 152
149 Map toJson() { 153 Map toJson() {
150 Map map = new Map(); 154 Map map = new Map();
151 map["success"] = success; 155 map["success"] = success;
152 return map; 156 return map;
153 } 157 }
154 } 158 }
155 159
156 160
161
162
157 class _HttpServerGetPortParams extends bindings.Struct { 163 class _HttpServerGetPortParams extends bindings.Struct {
158 static const List<bindings.StructDataHeader> kVersions = const [ 164 static const List<bindings.StructDataHeader> kVersions = const [
159 const bindings.StructDataHeader(8, 0) 165 const bindings.StructDataHeader(8, 0)
160 ]; 166 ];
161 167
162 _HttpServerGetPortParams() : super(kVersions.last.size); 168 _HttpServerGetPortParams() : super(kVersions.last.size);
163 169
164 static _HttpServerGetPortParams deserialize(bindings.Message message) { 170 static _HttpServerGetPortParams deserialize(bindings.Message message) {
165 var decoder = new bindings.Decoder(message); 171 var decoder = new bindings.Decoder(message);
166 var result = decode(decoder); 172 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 return "_HttpServerGetPortParams("")"; 211 return "_HttpServerGetPortParams("")";
206 } 212 }
207 213
208 Map toJson() { 214 Map toJson() {
209 Map map = new Map(); 215 Map map = new Map();
210 return map; 216 return map;
211 } 217 }
212 } 218 }
213 219
214 220
221
222
215 class HttpServerGetPortResponseParams extends bindings.Struct { 223 class HttpServerGetPortResponseParams extends bindings.Struct {
216 static const List<bindings.StructDataHeader> kVersions = const [ 224 static const List<bindings.StructDataHeader> kVersions = const [
217 const bindings.StructDataHeader(16, 0) 225 const bindings.StructDataHeader(16, 0)
218 ]; 226 ];
219 int port = 0; 227 int port = 0;
220 228
221 HttpServerGetPortResponseParams() : super(kVersions.last.size); 229 HttpServerGetPortResponseParams() : super(kVersions.last.size);
222 230
223 static HttpServerGetPortResponseParams deserialize(bindings.Message message) { 231 static HttpServerGetPortResponseParams deserialize(bindings.Message message) {
224 var decoder = new bindings.Decoder(message); 232 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 } 280 }
273 281
274 Map toJson() { 282 Map toJson() {
275 Map map = new Map(); 283 Map map = new Map();
276 map["port"] = port; 284 map["port"] = port;
277 return map; 285 return map;
278 } 286 }
279 } 287 }
280 288
281 289
290
291
282 class _HttpHandlerHandleRequestParams extends bindings.Struct { 292 class _HttpHandlerHandleRequestParams extends bindings.Struct {
283 static const List<bindings.StructDataHeader> kVersions = const [ 293 static const List<bindings.StructDataHeader> kVersions = const [
284 const bindings.StructDataHeader(16, 0) 294 const bindings.StructDataHeader(16, 0)
285 ]; 295 ];
286 http_request_mojom.HttpRequest request = null; 296 http_request_mojom.HttpRequest request = null;
287 297
288 _HttpHandlerHandleRequestParams() : super(kVersions.last.size); 298 _HttpHandlerHandleRequestParams() : super(kVersions.last.size);
289 299
290 static _HttpHandlerHandleRequestParams deserialize(bindings.Message message) { 300 static _HttpHandlerHandleRequestParams deserialize(bindings.Message message) {
291 var decoder = new bindings.Decoder(message); 301 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 "request: $request" ")"; 349 "request: $request" ")";
340 } 350 }
341 351
342 Map toJson() { 352 Map toJson() {
343 throw new bindings.MojoCodecError( 353 throw new bindings.MojoCodecError(
344 'Object containing handles cannot be encoded to JSON.'); 354 'Object containing handles cannot be encoded to JSON.');
345 } 355 }
346 } 356 }
347 357
348 358
359
360
349 class HttpHandlerHandleRequestResponseParams extends bindings.Struct { 361 class HttpHandlerHandleRequestResponseParams extends bindings.Struct {
350 static const List<bindings.StructDataHeader> kVersions = const [ 362 static const List<bindings.StructDataHeader> kVersions = const [
351 const bindings.StructDataHeader(16, 0) 363 const bindings.StructDataHeader(16, 0)
352 ]; 364 ];
353 http_response_mojom.HttpResponse response = null; 365 http_response_mojom.HttpResponse response = null;
354 366
355 HttpHandlerHandleRequestResponseParams() : super(kVersions.last.size); 367 HttpHandlerHandleRequestResponseParams() : super(kVersions.last.size);
356 368
357 static HttpHandlerHandleRequestResponseParams deserialize(bindings.Message mes sage) { 369 static HttpHandlerHandleRequestResponseParams deserialize(bindings.Message mes sage) {
358 var decoder = new bindings.Decoder(message); 370 var decoder = new bindings.Decoder(message);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 return "HttpHandlerHandleRequestResponseParams(" 417 return "HttpHandlerHandleRequestResponseParams("
406 "response: $response" ")"; 418 "response: $response" ")";
407 } 419 }
408 420
409 Map toJson() { 421 Map toJson() {
410 throw new bindings.MojoCodecError( 422 throw new bindings.MojoCodecError(
411 'Object containing handles cannot be encoded to JSON.'); 423 'Object containing handles cannot be encoded to JSON.');
412 } 424 }
413 } 425 }
414 426
427
428
429
415 const int _HttpServer_setHandlerName = 0; 430 const int _HttpServer_setHandlerName = 0;
416 const int _HttpServer_getPortName = 1; 431 const int _HttpServer_getPortName = 1;
417 432
433
434
435 class _HttpServerServiceDescription implements service_describer.ServiceDescript ion {
436 dynamic getTopLevelInterface([Function responseFactory]) => null;
437
438 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
439
440 dynamic getAllTypeDefinitions([Function responseFactory]) => null;
441 }
442
418 abstract class HttpServer { 443 abstract class HttpServer {
419 static const String serviceName = null; 444 static const String serviceName = null;
420 dynamic setHandler(String pattern,Object handler,[Function responseFactory = n ull]); 445 dynamic setHandler(String pattern,Object handler,[Function responseFactory = n ull]);
421 dynamic getPort([Function responseFactory = null]); 446 dynamic getPort([Function responseFactory = null]);
422 } 447 }
423 448
424 449
425 class _HttpServerProxyImpl extends bindings.Proxy { 450 class _HttpServerProxyImpl extends bindings.Proxy {
426 _HttpServerProxyImpl.fromEndpoint( 451 _HttpServerProxyImpl.fromEndpoint(
427 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 452 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
428 453
429 _HttpServerProxyImpl.fromHandle(core.MojoHandle handle) : 454 _HttpServerProxyImpl.fromHandle(core.MojoHandle handle) :
430 super.fromHandle(handle); 455 super.fromHandle(handle);
431 456
432 _HttpServerProxyImpl.unbound() : super.unbound(); 457 _HttpServerProxyImpl.unbound() : super.unbound();
433 458
434 static _HttpServerProxyImpl newFromEndpoint( 459 static _HttpServerProxyImpl newFromEndpoint(
435 core.MojoMessagePipeEndpoint endpoint) { 460 core.MojoMessagePipeEndpoint endpoint) {
436 assert(endpoint.setDescription("For _HttpServerProxyImpl")); 461 assert(endpoint.setDescription("For _HttpServerProxyImpl"));
437 return new _HttpServerProxyImpl.fromEndpoint(endpoint); 462 return new _HttpServerProxyImpl.fromEndpoint(endpoint);
438 } 463 }
439 464
465 service_describer.ServiceDescription get serviceDescription =>
466 new _HttpServerServiceDescription();
467
440 void handleResponse(bindings.ServiceMessage message) { 468 void handleResponse(bindings.ServiceMessage message) {
441 switch (message.header.type) { 469 switch (message.header.type) {
442 case _HttpServer_setHandlerName: 470 case _HttpServer_setHandlerName:
443 var r = HttpServerSetHandlerResponseParams.deserialize( 471 var r = HttpServerSetHandlerResponseParams.deserialize(
444 message.payload); 472 message.payload);
445 if (!message.header.hasRequestId) { 473 if (!message.header.hasRequestId) {
446 proxyError("Expected a message with a valid request Id."); 474 proxyError("Expected a message with a valid request Id.");
447 return; 475 return;
448 } 476 }
449 Completer c = completerMap[message.header.requestId]; 477 Completer c = completerMap[message.header.requestId];
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 assert(_impl == null); 699 assert(_impl == null);
672 _impl = d; 700 _impl = d;
673 } 701 }
674 702
675 String toString() { 703 String toString() {
676 var superString = super.toString(); 704 var superString = super.toString();
677 return "HttpServerStub($superString)"; 705 return "HttpServerStub($superString)";
678 } 706 }
679 707
680 int get version => 0; 708 int get version => 0;
709
710 service_describer.ServiceDescription get serviceDescription =>
711 new _HttpServerServiceDescription();
681 } 712 }
682 713
683 const int _HttpHandler_handleRequestName = 0; 714 const int _HttpHandler_handleRequestName = 0;
684 715
716
717
718 class _HttpHandlerServiceDescription implements service_describer.ServiceDescrip tion {
719 dynamic getTopLevelInterface([Function responseFactory]) => null;
720
721 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
722
723 dynamic getAllTypeDefinitions([Function responseFactory]) => null;
724 }
725
685 abstract class HttpHandler { 726 abstract class HttpHandler {
686 static const String serviceName = null; 727 static const String serviceName = null;
687 dynamic handleRequest(http_request_mojom.HttpRequest request,[Function respons eFactory = null]); 728 dynamic handleRequest(http_request_mojom.HttpRequest request,[Function respons eFactory = null]);
688 } 729 }
689 730
690 731
691 class _HttpHandlerProxyImpl extends bindings.Proxy { 732 class _HttpHandlerProxyImpl extends bindings.Proxy {
692 _HttpHandlerProxyImpl.fromEndpoint( 733 _HttpHandlerProxyImpl.fromEndpoint(
693 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 734 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
694 735
695 _HttpHandlerProxyImpl.fromHandle(core.MojoHandle handle) : 736 _HttpHandlerProxyImpl.fromHandle(core.MojoHandle handle) :
696 super.fromHandle(handle); 737 super.fromHandle(handle);
697 738
698 _HttpHandlerProxyImpl.unbound() : super.unbound(); 739 _HttpHandlerProxyImpl.unbound() : super.unbound();
699 740
700 static _HttpHandlerProxyImpl newFromEndpoint( 741 static _HttpHandlerProxyImpl newFromEndpoint(
701 core.MojoMessagePipeEndpoint endpoint) { 742 core.MojoMessagePipeEndpoint endpoint) {
702 assert(endpoint.setDescription("For _HttpHandlerProxyImpl")); 743 assert(endpoint.setDescription("For _HttpHandlerProxyImpl"));
703 return new _HttpHandlerProxyImpl.fromEndpoint(endpoint); 744 return new _HttpHandlerProxyImpl.fromEndpoint(endpoint);
704 } 745 }
705 746
747 service_describer.ServiceDescription get serviceDescription =>
748 new _HttpHandlerServiceDescription();
749
706 void handleResponse(bindings.ServiceMessage message) { 750 void handleResponse(bindings.ServiceMessage message) {
707 switch (message.header.type) { 751 switch (message.header.type) {
708 case _HttpHandler_handleRequestName: 752 case _HttpHandler_handleRequestName:
709 var r = HttpHandlerHandleRequestResponseParams.deserialize( 753 var r = HttpHandlerHandleRequestResponseParams.deserialize(
710 message.payload); 754 message.payload);
711 if (!message.header.hasRequestId) { 755 if (!message.header.hasRequestId) {
712 proxyError("Expected a message with a valid request Id."); 756 proxyError("Expected a message with a valid request Id.");
713 return; 757 return;
714 } 758 }
715 Completer c = completerMap[message.header.requestId]; 759 Completer c = completerMap[message.header.requestId];
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
881 assert(_impl == null); 925 assert(_impl == null);
882 _impl = d; 926 _impl = d;
883 } 927 }
884 928
885 String toString() { 929 String toString() {
886 var superString = super.toString(); 930 var superString = super.toString();
887 return "HttpHandlerStub($superString)"; 931 return "HttpHandlerStub($superString)";
888 } 932 }
889 933
890 int get version => 0; 934 int get version => 0;
935
936 service_describer.ServiceDescription get serviceDescription =>
937 new _HttpHandlerServiceDescription();
891 } 938 }
892 939
893 940
941
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698