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

Side by Side Diff: mojo/dart/packages/_mojo_for_test_only/lib/test/echo_service.mojom.dart

Issue 1983453002: Dart: Refactor Stubs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge Created 4 years, 7 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 echo_service_mojom; 5 library echo_service_mojom;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:typed_data'; 10 import 'dart:typed_data';
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after
452 } 452 }
453 453
454 abstract class EchoService { 454 abstract class EchoService {
455 static const String serviceName = "test::EchoService"; 455 static const String serviceName = "test::EchoService";
456 dynamic echoString(String value,[Function responseFactory = null]); 456 dynamic echoString(String value,[Function responseFactory = null]);
457 dynamic delayedEchoString(String value,int millis,[Function responseFactory = null]); 457 dynamic delayedEchoString(String value,int millis,[Function responseFactory = null]);
458 void swap(); 458 void swap();
459 void quit(); 459 void quit();
460 } 460 }
461 461
462 462 class _EchoServiceProxyControl
463 class _EchoServiceProxyControl extends bindings.ProxyMessageHandler 463 extends bindings.ProxyMessageHandler
464 implements bindings.ProxyControl { 464 implements bindings.ProxyControl {
465 _EchoServiceProxyControl.fromEndpoint( 465 _EchoServiceProxyControl.fromEndpoint(
466 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 466 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
467 467
468 _EchoServiceProxyControl.fromHandle( 468 _EchoServiceProxyControl.fromHandle(
469 core.MojoHandle handle) : super.fromHandle(handle); 469 core.MojoHandle handle) : super.fromHandle(handle);
470 470
471 _EchoServiceProxyControl.unbound() : super.unbound(); 471 _EchoServiceProxyControl.unbound() : super.unbound();
472 472
473 service_describer.ServiceDescription get serviceDescription => 473 service_describer.ServiceDescription get serviceDescription =>
474 new _EchoServiceServiceDescription(); 474 new _EchoServiceServiceDescription();
475 475
476 String get serviceName => EchoService.serviceName; 476 String get serviceName => EchoService.serviceName;
477 477
478 @override
479 void handleResponse(bindings.ServiceMessage message) { 478 void handleResponse(bindings.ServiceMessage message) {
480 switch (message.header.type) { 479 switch (message.header.type) {
481 case _echoServiceMethodEchoStringName: 480 case _echoServiceMethodEchoStringName:
482 var r = EchoServiceEchoStringResponseParams.deserialize( 481 var r = EchoServiceEchoStringResponseParams.deserialize(
483 message.payload); 482 message.payload);
484 if (!message.header.hasRequestId) { 483 if (!message.header.hasRequestId) {
485 proxyError("Expected a message with a valid request Id."); 484 proxyError("Expected a message with a valid request Id.");
486 return; 485 return;
487 } 486 }
488 Completer c = completerMap[message.header.requestId]; 487 Completer c = completerMap[message.header.requestId];
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 } 524 }
526 } 525 }
527 526
528 @override 527 @override
529 String toString() { 528 String toString() {
530 var superString = super.toString(); 529 var superString = super.toString();
531 return "_EchoServiceProxyControl($superString)"; 530 return "_EchoServiceProxyControl($superString)";
532 } 531 }
533 } 532 }
534 533
535 534 class EchoServiceProxy
536 class EchoServiceProxy extends bindings.Proxy 535 extends bindings.Proxy
537 implements EchoService { 536 implements EchoService {
538 EchoServiceProxy.fromEndpoint( 537 EchoServiceProxy.fromEndpoint(
539 core.MojoMessagePipeEndpoint endpoint) 538 core.MojoMessagePipeEndpoint endpoint)
540 : super(new _EchoServiceProxyControl.fromEndpoint(endpoint)); 539 : super(new _EchoServiceProxyControl.fromEndpoint(endpoint));
541 540
542 EchoServiceProxy.fromHandle(core.MojoHandle handle) 541 EchoServiceProxy.fromHandle(core.MojoHandle handle)
543 : super(new _EchoServiceProxyControl.fromHandle(handle)); 542 : super(new _EchoServiceProxyControl.fromHandle(handle));
544 543
545 EchoServiceProxy.unbound() 544 EchoServiceProxy.unbound()
546 : super(new _EchoServiceProxyControl.unbound()); 545 : super(new _EchoServiceProxyControl.unbound());
547 546
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
591 if (!ctrl.isBound) { 590 if (!ctrl.isBound) {
592 ctrl.proxyError("The Proxy is closed."); 591 ctrl.proxyError("The Proxy is closed.");
593 return; 592 return;
594 } 593 }
595 var params = new _EchoServiceQuitParams(); 594 var params = new _EchoServiceQuitParams();
596 ctrl.sendMessage(params, 595 ctrl.sendMessage(params,
597 _echoServiceMethodQuitName); 596 _echoServiceMethodQuitName);
598 } 597 }
599 } 598 }
600 599
601 600 class _EchoServiceStubControl
602 class EchoServiceStub extends bindings.Stub { 601 extends bindings.StubMessageHandler
602 implements bindings.StubControl<EchoService> {
603 EchoService _impl; 603 EchoService _impl;
604 604
605 EchoServiceStub.fromEndpoint( 605 _EchoServiceStubControl.fromEndpoint(
606 core.MojoMessagePipeEndpoint endpoint, [EchoService impl]) 606 core.MojoMessagePipeEndpoint endpoint, [EchoService impl])
607 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 607 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
608 _impl = impl; 608 _impl = impl;
609 } 609 }
610 610
611 EchoServiceStub.fromHandle( 611 _EchoServiceStubControl.fromHandle(
612 core.MojoHandle handle, [EchoService impl]) 612 core.MojoHandle handle, [EchoService impl])
613 : super.fromHandle(handle, autoBegin: impl != null) { 613 : super.fromHandle(handle, autoBegin: impl != null) {
614 _impl = impl; 614 _impl = impl;
615 } 615 }
616 616
617 EchoServiceStub.unbound([this._impl]) : super.unbound(); 617 _EchoServiceStubControl.unbound([this._impl]) : super.unbound();
618
619 static EchoServiceStub newFromEndpoint(
620 core.MojoMessagePipeEndpoint endpoint) {
621 assert(endpoint.setDescription("For EchoServiceStub"));
622 return new EchoServiceStub.fromEndpoint(endpoint);
623 }
624 618
625 619
626 EchoServiceEchoStringResponseParams _echoServiceEchoStringResponseParamsFactor y(String value) { 620 EchoServiceEchoStringResponseParams _echoServiceEchoStringResponseParamsFactor y(String value) {
627 var result = new EchoServiceEchoStringResponseParams(); 621 var result = new EchoServiceEchoStringResponseParams();
628 result.value = value; 622 result.value = value;
629 return result; 623 return result;
630 } 624 }
631 EchoServiceDelayedEchoStringResponseParams _echoServiceDelayedEchoStringRespon seParamsFactory(String value) { 625 EchoServiceDelayedEchoStringResponseParams _echoServiceDelayedEchoStringRespon seParamsFactory(String value) {
632 var result = new EchoServiceDelayedEchoStringResponseParams(); 626 var result = new EchoServiceDelayedEchoStringResponseParams();
633 result.value = value; 627 result.value = value;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
713 } 707 }
714 708
715 @override 709 @override
716 void bind(core.MojoMessagePipeEndpoint endpoint) { 710 void bind(core.MojoMessagePipeEndpoint endpoint) {
717 super.bind(endpoint); 711 super.bind(endpoint);
718 if (!isOpen && (_impl != null)) { 712 if (!isOpen && (_impl != null)) {
719 beginHandlingEvents(); 713 beginHandlingEvents();
720 } 714 }
721 } 715 }
722 716
717 @override
723 String toString() { 718 String toString() {
724 var superString = super.toString(); 719 var superString = super.toString();
725 return "EchoServiceStub($superString)"; 720 return "_EchoServiceStubControl($superString)";
726 } 721 }
727 722
728 int get version => 0; 723 int get version => 0;
729 724
730 static service_describer.ServiceDescription _cachedServiceDescription; 725 static service_describer.ServiceDescription _cachedServiceDescription;
731 static service_describer.ServiceDescription get serviceDescription { 726 static service_describer.ServiceDescription get serviceDescription {
732 if (_cachedServiceDescription == null) { 727 if (_cachedServiceDescription == null) {
733 _cachedServiceDescription = new _EchoServiceServiceDescription(); 728 _cachedServiceDescription = new _EchoServiceServiceDescription();
734 } 729 }
735 return _cachedServiceDescription; 730 return _cachedServiceDescription;
736 } 731 }
737 } 732 }
738 733
734 class EchoServiceStub
735 extends bindings.Stub<EchoService>
736 implements EchoService {
737 EchoServiceStub.fromEndpoint(
738 core.MojoMessagePipeEndpoint endpoint, [EchoService impl])
739 : super(new _EchoServiceStubControl.fromEndpoint(endpoint, impl));
740
741 EchoServiceStub.fromHandle(
742 core.MojoHandle handle, [EchoService impl])
743 : super(new _EchoServiceStubControl.fromHandle(handle, impl));
744
745 EchoServiceStub.unbound([EchoService impl])
746 : super(new _EchoServiceStubControl.unbound(impl));
747
748 static EchoServiceStub newFromEndpoint(
749 core.MojoMessagePipeEndpoint endpoint) {
750 assert(endpoint.setDescription("For EchoServiceStub"));
751 return new EchoServiceStub.fromEndpoint(endpoint);
752 }
753
754 static service_describer.ServiceDescription get serviceDescription =>
755 _EchoServiceStubControl.serviceDescription;
756
757
758 dynamic echoString(String value,[Function responseFactory = null]) {
759 return impl.echoString(value,responseFactory);
760 }
761 dynamic delayedEchoString(String value,int millis,[Function responseFactory = null]) {
762 return impl.delayedEchoString(value,millis,responseFactory);
763 }
764 void swap() {
765 return impl.swap();
766 }
767 void quit() {
768 return impl.quit();
769 }
770 }
771
739 772
740 mojom_types.RuntimeTypeInfo getRuntimeTypeInfo() => _runtimeTypeInfo ?? 773 mojom_types.RuntimeTypeInfo getRuntimeTypeInfo() => _runtimeTypeInfo ??
741 _initRuntimeTypeInfo(); 774 _initRuntimeTypeInfo();
742 775
743 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { 776 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() {
744 return getRuntimeTypeInfo().typeMap; 777 return getRuntimeTypeInfo().typeMap;
745 } 778 }
746 779
747 var _runtimeTypeInfo; 780 var _runtimeTypeInfo;
748 mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() { 781 mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() {
749 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of 782 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of
750 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this 783 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this
751 // file. The string contains the base64 encoding of the gzip-compressed bytes. 784 // file. The string contains the base64 encoding of the gzip-compressed bytes.
752 var serializedRuntimeTypeInfo = "H4sIAAAJbogC/+xYvY4TMRDenwPCXUD8SstPEahCwZkyi oSUglRICHQ01xBZe75k0W52WW8OwRPwCJSUlJQ8Ao9yJSUd2OwYnIkdNtGR1Z5upLmJfZnY3+dvxpsET mlXIH6AiOd72tgV3oLxLeFXhReMF/3+MJykeyw/ikJmef89yHm5/3w4ejrc78vE3cU8vP7gBD7PhXxfy +9C7EDMXOABooPWVzx8hPgZ4k+wL47Z8L47BpwXtPnrwneEA4pnNGGV+FZ5+D8BrIHpwTzL/W0LPxT+S jiZ8ZzEaUhjMk7TcczIJE0YeZ9TkqSvU8LzsHxxQPOC0CyTC3Ai/47EiJNoWrD8kIaMEyaWHfFy3V2Zl PwbD96fztsWvJa8enCuXZhX7/t2royf2mX8etl87t/VOfvmc1f2CI3lmZvmlV0DPn8jK/JoOjbjuggYN sU71p/CH3jVcUvrWXDfBux/cT/M2ZuZ2J4Zv7JN4cf1OLD0uR9ONauqk64l/5JwKdUjGs+YRR83N8yPq i1T/wq0vbuW+vwfuroDPW5OVzxLp5yd6WpNXXUboCvcrxV/k635z6vCl6udBzZ1Hz1hMX3HDnDbXuBvu +a+rXjo+avV18CCXz1PLeCfb9+111kAvP/Rh9uMepN6uVtjvZn4cWDPJmutwY+7hB/5+HVeeBLFccTN/ DyosV/r/cfTxra663gnU3f34ZnJVHfa9XZ2v61Rb48beL8dI5zeCnx5S/hqw/ejvbc0M+lpp+b77BjFq nVl+/51AzBLvPoVVncdtSrow1nyOwXWh78CX34FfbyYRUae2qdUHxJvk/XxKwAA///0GO/NyBMAAA==" ; 785 var serializedRuntimeTypeInfo = "H4sIAAAJbogC/+xYvY4TMRDenwPCXUD8SstPEahCwZkyi oSUglRICHQ01xBZe75k0W52WW8OwRPwCJSUlJQ8Ao9yJSUd2OwYnIkdNtGR1Z5upLmJfZnY3+dvxpsET mlXIH6AiOd72tgV3oLxLeFXhReMF/3+MJykeyw/ikJmef89yHm5/3w4ejrc78vE3cU8vP7gBD7PhXxfy +9C7EDMXOABooPWVzx8hPgZ4k+wL47Z8L47BpwXtPnrwneEA4pnNGGV+FZ5+D8BrIHpwTzL/W0LPxT+S jiZ8ZzEaUhjMk7TcczIJE0YeZ9TkqSvU8LzsHxxQPOC0CyTC3Ai/47EiJNoWrD8kIaMEyaWHfFy3V2Zl PwbD96fztsWvJa8enCuXZhX7/t2royf2mX8etl87t/VOfvmc1f2CI3lmZvmlV0DPn8jK/JoOjbjuggYN sU71p/CH3jVcUvrWXDfBux/cT/M2ZuZ2J4Zv7JN4cf1OLD0uR9ONauqk64l/5JwKdUjGs+YRR83N8yPq i1T/wq0vbuW+vwfuroDPW5OVzxLp5yd6WpNXXUboCvcrxV/k635z6vCl6udBzZ1Hz1hMX3HDnDbXuBvu +a+rXjo+avV18CCXz1PLeCfb9+111kAvP/Rh9uMepN6uVtjvZn4cWDPJmutwY+7hB/5+HVeeBLFccTN/ DyosV/r/cfTxra663gnU3f34ZnJVHfa9XZ2v61Rb48beL8dI5zeCnx5S/hqw/ejvbc0M+lpp+b77BjFq nVl+/51AzBLvPoVVncdtSrow1nyOwXWh78CX34FfbyYRUae2qdUHxJvk/XxKwAA///0GO/NyBMAAA==" ;
753 786
754 // Deserialize RuntimeTypeInfo 787 // Deserialize RuntimeTypeInfo
755 var bytes = BASE64.decode(serializedRuntimeTypeInfo); 788 var bytes = BASE64.decode(serializedRuntimeTypeInfo);
756 var unzippedBytes = new ZLibDecoder().convert(bytes); 789 var unzippedBytes = new ZLibDecoder().convert(bytes);
757 var bdata = new ByteData.view(unzippedBytes.buffer); 790 var bdata = new ByteData.view(unzippedBytes.buffer);
758 var message = new bindings.Message(bdata, null, unzippedBytes.length, 0); 791 var message = new bindings.Message(bdata, null, unzippedBytes.length, 0);
759 _runtimeTypeInfo = mojom_types.RuntimeTypeInfo.deserialize(message); 792 _runtimeTypeInfo = mojom_types.RuntimeTypeInfo.deserialize(message);
760 return _runtimeTypeInfo; 793 return _runtimeTypeInfo;
761 } 794 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698