| OLD | NEW |
| 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 tcp_bound_socket_mojom; | 5 library tcp_bound_socket_mojom; |
| 6 import 'dart:async'; | 6 import 'dart:async'; |
| 7 import 'package:mojo/bindings.dart' as bindings; | 7 import 'package:mojo/bindings.dart' as bindings; |
| 8 import 'package:mojo/core.dart' as core; | 8 import 'package:mojo/core.dart' as core; |
| 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
| 10 import 'package:mojo/mojo/network_error.mojom.dart' as network_error_mojom; | 10 import 'package:mojo/mojo/network_error.mojom.dart' as network_error_mojom; |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 dynamic getAllTypeDefinitions([Function responseFactory]) => | 354 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 355 responseFactory(null); | 355 responseFactory(null); |
| 356 } | 356 } |
| 357 | 357 |
| 358 abstract class TcpBoundSocket { | 358 abstract class TcpBoundSocket { |
| 359 static const String serviceName = null; | 359 static const String serviceName = null; |
| 360 dynamic startListening(Object server,[Function responseFactory = null]); | 360 dynamic startListening(Object server,[Function responseFactory = null]); |
| 361 dynamic connect(net_address_mojom.NetAddress remoteAddress,core.MojoDataPipeCo
nsumer sendStream,core.MojoDataPipeProducer receiveStream,Object clientSocket,[F
unction responseFactory = null]); | 361 dynamic connect(net_address_mojom.NetAddress remoteAddress,core.MojoDataPipeCo
nsumer sendStream,core.MojoDataPipeProducer receiveStream,Object clientSocket,[F
unction responseFactory = null]); |
| 362 } | 362 } |
| 363 | 363 |
| 364 | 364 class _TcpBoundSocketProxyControl |
| 365 class _TcpBoundSocketProxyControl extends bindings.ProxyMessageHandler | 365 extends bindings.ProxyMessageHandler |
| 366 implements bindings.ProxyControl { | 366 implements bindings.ProxyControl { |
| 367 _TcpBoundSocketProxyControl.fromEndpoint( | 367 _TcpBoundSocketProxyControl.fromEndpoint( |
| 368 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 368 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 369 | 369 |
| 370 _TcpBoundSocketProxyControl.fromHandle( | 370 _TcpBoundSocketProxyControl.fromHandle( |
| 371 core.MojoHandle handle) : super.fromHandle(handle); | 371 core.MojoHandle handle) : super.fromHandle(handle); |
| 372 | 372 |
| 373 _TcpBoundSocketProxyControl.unbound() : super.unbound(); | 373 _TcpBoundSocketProxyControl.unbound() : super.unbound(); |
| 374 | 374 |
| 375 service_describer.ServiceDescription get serviceDescription => | 375 service_describer.ServiceDescription get serviceDescription => |
| 376 new _TcpBoundSocketServiceDescription(); | 376 new _TcpBoundSocketServiceDescription(); |
| 377 | 377 |
| 378 String get serviceName => TcpBoundSocket.serviceName; | 378 String get serviceName => TcpBoundSocket.serviceName; |
| 379 | 379 |
| 380 @override | |
| 381 void handleResponse(bindings.ServiceMessage message) { | 380 void handleResponse(bindings.ServiceMessage message) { |
| 382 switch (message.header.type) { | 381 switch (message.header.type) { |
| 383 case _tcpBoundSocketMethodStartListeningName: | 382 case _tcpBoundSocketMethodStartListeningName: |
| 384 var r = TcpBoundSocketStartListeningResponseParams.deserialize( | 383 var r = TcpBoundSocketStartListeningResponseParams.deserialize( |
| 385 message.payload); | 384 message.payload); |
| 386 if (!message.header.hasRequestId) { | 385 if (!message.header.hasRequestId) { |
| 387 proxyError("Expected a message with a valid request Id."); | 386 proxyError("Expected a message with a valid request Id."); |
| 388 return; | 387 return; |
| 389 } | 388 } |
| 390 Completer c = completerMap[message.header.requestId]; | 389 Completer c = completerMap[message.header.requestId]; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 } | 426 } |
| 428 } | 427 } |
| 429 | 428 |
| 430 @override | 429 @override |
| 431 String toString() { | 430 String toString() { |
| 432 var superString = super.toString(); | 431 var superString = super.toString(); |
| 433 return "_TcpBoundSocketProxyControl($superString)"; | 432 return "_TcpBoundSocketProxyControl($superString)"; |
| 434 } | 433 } |
| 435 } | 434 } |
| 436 | 435 |
| 437 | 436 class TcpBoundSocketProxy |
| 438 class TcpBoundSocketProxy extends bindings.Proxy | 437 extends bindings.Proxy |
| 439 implements TcpBoundSocket { | 438 implements TcpBoundSocket { |
| 440 TcpBoundSocketProxy.fromEndpoint( | 439 TcpBoundSocketProxy.fromEndpoint( |
| 441 core.MojoMessagePipeEndpoint endpoint) | 440 core.MojoMessagePipeEndpoint endpoint) |
| 442 : super(new _TcpBoundSocketProxyControl.fromEndpoint(endpoint)); | 441 : super(new _TcpBoundSocketProxyControl.fromEndpoint(endpoint)); |
| 443 | 442 |
| 444 TcpBoundSocketProxy.fromHandle(core.MojoHandle handle) | 443 TcpBoundSocketProxy.fromHandle(core.MojoHandle handle) |
| 445 : super(new _TcpBoundSocketProxyControl.fromHandle(handle)); | 444 : super(new _TcpBoundSocketProxyControl.fromHandle(handle)); |
| 446 | 445 |
| 447 TcpBoundSocketProxy.unbound() | 446 TcpBoundSocketProxy.unbound() |
| 448 : super(new _TcpBoundSocketProxyControl.unbound()); | 447 : super(new _TcpBoundSocketProxyControl.unbound()); |
| 449 | 448 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 477 params.receiveStream = receiveStream; | 476 params.receiveStream = receiveStream; |
| 478 params.clientSocket = clientSocket; | 477 params.clientSocket = clientSocket; |
| 479 return ctrl.sendMessageWithRequestId( | 478 return ctrl.sendMessageWithRequestId( |
| 480 params, | 479 params, |
| 481 _tcpBoundSocketMethodConnectName, | 480 _tcpBoundSocketMethodConnectName, |
| 482 -1, | 481 -1, |
| 483 bindings.MessageHeader.kMessageExpectsResponse); | 482 bindings.MessageHeader.kMessageExpectsResponse); |
| 484 } | 483 } |
| 485 } | 484 } |
| 486 | 485 |
| 487 | 486 class _TcpBoundSocketStubControl |
| 488 class TcpBoundSocketStub extends bindings.Stub { | 487 extends bindings.StubMessageHandler |
| 488 implements bindings.StubControl<TcpBoundSocket> { |
| 489 TcpBoundSocket _impl; | 489 TcpBoundSocket _impl; |
| 490 | 490 |
| 491 TcpBoundSocketStub.fromEndpoint( | 491 _TcpBoundSocketStubControl.fromEndpoint( |
| 492 core.MojoMessagePipeEndpoint endpoint, [TcpBoundSocket impl]) | 492 core.MojoMessagePipeEndpoint endpoint, [TcpBoundSocket impl]) |
| 493 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 493 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 494 _impl = impl; | 494 _impl = impl; |
| 495 } | 495 } |
| 496 | 496 |
| 497 TcpBoundSocketStub.fromHandle( | 497 _TcpBoundSocketStubControl.fromHandle( |
| 498 core.MojoHandle handle, [TcpBoundSocket impl]) | 498 core.MojoHandle handle, [TcpBoundSocket impl]) |
| 499 : super.fromHandle(handle, autoBegin: impl != null) { | 499 : super.fromHandle(handle, autoBegin: impl != null) { |
| 500 _impl = impl; | 500 _impl = impl; |
| 501 } | 501 } |
| 502 | 502 |
| 503 TcpBoundSocketStub.unbound([this._impl]) : super.unbound(); | 503 _TcpBoundSocketStubControl.unbound([this._impl]) : super.unbound(); |
| 504 | |
| 505 static TcpBoundSocketStub newFromEndpoint( | |
| 506 core.MojoMessagePipeEndpoint endpoint) { | |
| 507 assert(endpoint.setDescription("For TcpBoundSocketStub")); | |
| 508 return new TcpBoundSocketStub.fromEndpoint(endpoint); | |
| 509 } | |
| 510 | 504 |
| 511 | 505 |
| 512 TcpBoundSocketStartListeningResponseParams _tcpBoundSocketStartListeningRespon
seParamsFactory(network_error_mojom.NetworkError result) { | 506 TcpBoundSocketStartListeningResponseParams _tcpBoundSocketStartListeningRespon
seParamsFactory(network_error_mojom.NetworkError result) { |
| 513 var result = new TcpBoundSocketStartListeningResponseParams(); | 507 var result = new TcpBoundSocketStartListeningResponseParams(); |
| 514 result.result = result; | 508 result.result = result; |
| 515 return result; | 509 return result; |
| 516 } | 510 } |
| 517 TcpBoundSocketConnectResponseParams _tcpBoundSocketConnectResponseParamsFactor
y(network_error_mojom.NetworkError result) { | 511 TcpBoundSocketConnectResponseParams _tcpBoundSocketConnectResponseParamsFactor
y(network_error_mojom.NetworkError result) { |
| 518 var result = new TcpBoundSocketConnectResponseParams(); | 512 var result = new TcpBoundSocketConnectResponseParams(); |
| 519 result.result = result; | 513 result.result = result; |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 } | 587 } |
| 594 | 588 |
| 595 @override | 589 @override |
| 596 void bind(core.MojoMessagePipeEndpoint endpoint) { | 590 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 597 super.bind(endpoint); | 591 super.bind(endpoint); |
| 598 if (!isOpen && (_impl != null)) { | 592 if (!isOpen && (_impl != null)) { |
| 599 beginHandlingEvents(); | 593 beginHandlingEvents(); |
| 600 } | 594 } |
| 601 } | 595 } |
| 602 | 596 |
| 597 @override |
| 603 String toString() { | 598 String toString() { |
| 604 var superString = super.toString(); | 599 var superString = super.toString(); |
| 605 return "TcpBoundSocketStub($superString)"; | 600 return "_TcpBoundSocketStubControl($superString)"; |
| 606 } | 601 } |
| 607 | 602 |
| 608 int get version => 0; | 603 int get version => 0; |
| 609 | 604 |
| 610 static service_describer.ServiceDescription _cachedServiceDescription; | 605 static service_describer.ServiceDescription _cachedServiceDescription; |
| 611 static service_describer.ServiceDescription get serviceDescription { | 606 static service_describer.ServiceDescription get serviceDescription { |
| 612 if (_cachedServiceDescription == null) { | 607 if (_cachedServiceDescription == null) { |
| 613 _cachedServiceDescription = new _TcpBoundSocketServiceDescription(); | 608 _cachedServiceDescription = new _TcpBoundSocketServiceDescription(); |
| 614 } | 609 } |
| 615 return _cachedServiceDescription; | 610 return _cachedServiceDescription; |
| 616 } | 611 } |
| 617 } | 612 } |
| 618 | 613 |
| 614 class TcpBoundSocketStub |
| 615 extends bindings.Stub<TcpBoundSocket> |
| 616 implements TcpBoundSocket { |
| 617 TcpBoundSocketStub.fromEndpoint( |
| 618 core.MojoMessagePipeEndpoint endpoint, [TcpBoundSocket impl]) |
| 619 : super(new _TcpBoundSocketStubControl.fromEndpoint(endpoint, impl)); |
| 620 |
| 621 TcpBoundSocketStub.fromHandle( |
| 622 core.MojoHandle handle, [TcpBoundSocket impl]) |
| 623 : super(new _TcpBoundSocketStubControl.fromHandle(handle, impl)); |
| 624 |
| 625 TcpBoundSocketStub.unbound([TcpBoundSocket impl]) |
| 626 : super(new _TcpBoundSocketStubControl.unbound(impl)); |
| 627 |
| 628 static TcpBoundSocketStub newFromEndpoint( |
| 629 core.MojoMessagePipeEndpoint endpoint) { |
| 630 assert(endpoint.setDescription("For TcpBoundSocketStub")); |
| 631 return new TcpBoundSocketStub.fromEndpoint(endpoint); |
| 632 } |
| 633 |
| 634 static service_describer.ServiceDescription get serviceDescription => |
| 635 _TcpBoundSocketStubControl.serviceDescription; |
| 636 |
| 637 |
| 638 dynamic startListening(Object server,[Function responseFactory = null]) { |
| 639 return impl.startListening(server,responseFactory); |
| 640 } |
| 641 dynamic connect(net_address_mojom.NetAddress remoteAddress,core.MojoDataPipeCo
nsumer sendStream,core.MojoDataPipeProducer receiveStream,Object clientSocket,[F
unction responseFactory = null]) { |
| 642 return impl.connect(remoteAddress,sendStream,receiveStream,clientSocket,resp
onseFactory); |
| 643 } |
| 644 } |
| 645 |
| 619 | 646 |
| 620 | 647 |
| OLD | NEW |