| OLD | NEW |
| 1 // WARNING: DO NOT EDIT. This file was generated by a program. | 1 // WARNING: DO NOT EDIT. This file was generated by a program. |
| 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. | 2 // See $MOJO_SDK/tools/bindings/mojom_bindings_generator.py. |
| 3 | 3 |
| 4 library tcp_bound_socket_mojom; | 4 library tcp_bound_socket_mojom; |
| 5 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'package:mojo/bindings.dart' as bindings; | 6 import 'package:mojo/bindings.dart' as bindings; |
| 7 import 'package:mojo/core.dart' as core; | 7 import 'package:mojo/core.dart' as core; |
| 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; | 8 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
| 9 import 'package:mojo/mojo/network_error.mojom.dart' as network_error_mojom; | 9 import 'package:mojo/mojo/network_error.mojom.dart' as network_error_mojom; |
| 10 import 'package:mojo_services/mojo/net_address.mojom.dart' as net_address_mojom; | 10 import 'package:mojo_services/mojo/net_address.mojom.dart' as net_address_mojom; |
| 11 import 'package:mojo_services/mojo/tcp_connected_socket.mojom.dart' as tcp_conne
cted_socket_mojom; | 11 import 'package:mojo_services/mojo/tcp_connected_socket.mojom.dart' as tcp_conne
cted_socket_mojom; |
| 12 import 'package:mojo_services/mojo/tcp_server_socket.mojom.dart' as tcp_server_s
ocket_mojom; | 12 import 'package:mojo_services/mojo/tcp_server_socket.mojom.dart' as tcp_server_s
ocket_mojom; |
| 13 | 13 |
| 14 | 14 |
| 15 | 15 |
| 16 class _TcpBoundSocketStartListeningParams extends bindings.Struct { | 16 class _TcpBoundSocketStartListeningParams extends bindings.Struct { |
| 17 static const List<bindings.StructDataHeader> kVersions = const [ | 17 static const List<bindings.StructDataHeader> kVersions = const [ |
| 18 const bindings.StructDataHeader(16, 0) | 18 const bindings.StructDataHeader(16, 0) |
| 19 ]; | 19 ]; |
| 20 tcp_server_socket_mojom.TcpServerSocketInterfaceRequest server = null; | 20 tcp_server_socket_mojom.TcpServerSocketInterfaceRequest server = null; |
| 21 | 21 |
| 22 _TcpBoundSocketStartListeningParams() : super(kVersions.last.size); | 22 _TcpBoundSocketStartListeningParams() : super(kVersions.last.size); |
| 23 | 23 |
| 24 _TcpBoundSocketStartListeningParams.init( |
| 25 tcp_server_socket_mojom.TcpServerSocketInterfaceRequest this.server |
| 26 ) : super(kVersions.last.size); |
| 27 |
| 24 static _TcpBoundSocketStartListeningParams deserialize(bindings.Message messag
e) { | 28 static _TcpBoundSocketStartListeningParams deserialize(bindings.Message messag
e) { |
| 25 var decoder = new bindings.Decoder(message); | 29 var decoder = new bindings.Decoder(message); |
| 26 var result = decode(decoder); | 30 var result = decode(decoder); |
| 27 if (decoder.excessHandles != null) { | 31 if (decoder.excessHandles != null) { |
| 28 decoder.excessHandles.forEach((h) => h.close()); | 32 decoder.excessHandles.forEach((h) => h.close()); |
| 29 } | 33 } |
| 30 return result; | 34 return result; |
| 31 } | 35 } |
| 32 | 36 |
| 33 static _TcpBoundSocketStartListeningParams decode(bindings.Decoder decoder0) { | 37 static _TcpBoundSocketStartListeningParams decode(bindings.Decoder decoder0) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 89 |
| 86 | 90 |
| 87 class TcpBoundSocketStartListeningResponseParams extends bindings.Struct { | 91 class TcpBoundSocketStartListeningResponseParams extends bindings.Struct { |
| 88 static const List<bindings.StructDataHeader> kVersions = const [ | 92 static const List<bindings.StructDataHeader> kVersions = const [ |
| 89 const bindings.StructDataHeader(16, 0) | 93 const bindings.StructDataHeader(16, 0) |
| 90 ]; | 94 ]; |
| 91 network_error_mojom.NetworkError result = null; | 95 network_error_mojom.NetworkError result = null; |
| 92 | 96 |
| 93 TcpBoundSocketStartListeningResponseParams() : super(kVersions.last.size); | 97 TcpBoundSocketStartListeningResponseParams() : super(kVersions.last.size); |
| 94 | 98 |
| 99 TcpBoundSocketStartListeningResponseParams.init( |
| 100 network_error_mojom.NetworkError this.result |
| 101 ) : super(kVersions.last.size); |
| 102 |
| 95 static TcpBoundSocketStartListeningResponseParams deserialize(bindings.Message
message) { | 103 static TcpBoundSocketStartListeningResponseParams deserialize(bindings.Message
message) { |
| 96 var decoder = new bindings.Decoder(message); | 104 var decoder = new bindings.Decoder(message); |
| 97 var result = decode(decoder); | 105 var result = decode(decoder); |
| 98 if (decoder.excessHandles != null) { | 106 if (decoder.excessHandles != null) { |
| 99 decoder.excessHandles.forEach((h) => h.close()); | 107 decoder.excessHandles.forEach((h) => h.close()); |
| 100 } | 108 } |
| 101 return result; | 109 return result; |
| 102 } | 110 } |
| 103 | 111 |
| 104 static TcpBoundSocketStartListeningResponseParams decode(bindings.Decoder deco
der0) { | 112 static TcpBoundSocketStartListeningResponseParams decode(bindings.Decoder deco
der0) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 static const List<bindings.StructDataHeader> kVersions = const [ | 169 static const List<bindings.StructDataHeader> kVersions = const [ |
| 162 const bindings.StructDataHeader(32, 0) | 170 const bindings.StructDataHeader(32, 0) |
| 163 ]; | 171 ]; |
| 164 net_address_mojom.NetAddress remoteAddress = null; | 172 net_address_mojom.NetAddress remoteAddress = null; |
| 165 core.MojoDataPipeConsumer sendStream = null; | 173 core.MojoDataPipeConsumer sendStream = null; |
| 166 core.MojoDataPipeProducer receiveStream = null; | 174 core.MojoDataPipeProducer receiveStream = null; |
| 167 tcp_connected_socket_mojom.TcpConnectedSocketInterfaceRequest clientSocket = n
ull; | 175 tcp_connected_socket_mojom.TcpConnectedSocketInterfaceRequest clientSocket = n
ull; |
| 168 | 176 |
| 169 _TcpBoundSocketConnectParams() : super(kVersions.last.size); | 177 _TcpBoundSocketConnectParams() : super(kVersions.last.size); |
| 170 | 178 |
| 179 _TcpBoundSocketConnectParams.init( |
| 180 net_address_mojom.NetAddress this.remoteAddress, |
| 181 core.MojoDataPipeConsumer this.sendStream, |
| 182 core.MojoDataPipeProducer this.receiveStream, |
| 183 tcp_connected_socket_mojom.TcpConnectedSocketInterfaceRequest this.clientSoc
ket |
| 184 ) : super(kVersions.last.size); |
| 185 |
| 171 static _TcpBoundSocketConnectParams deserialize(bindings.Message message) { | 186 static _TcpBoundSocketConnectParams deserialize(bindings.Message message) { |
| 172 var decoder = new bindings.Decoder(message); | 187 var decoder = new bindings.Decoder(message); |
| 173 var result = decode(decoder); | 188 var result = decode(decoder); |
| 174 if (decoder.excessHandles != null) { | 189 if (decoder.excessHandles != null) { |
| 175 decoder.excessHandles.forEach((h) => h.close()); | 190 decoder.excessHandles.forEach((h) => h.close()); |
| 176 } | 191 } |
| 177 return result; | 192 return result; |
| 178 } | 193 } |
| 179 | 194 |
| 180 static _TcpBoundSocketConnectParams decode(bindings.Decoder decoder0) { | 195 static _TcpBoundSocketConnectParams decode(bindings.Decoder decoder0) { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 284 |
| 270 | 285 |
| 271 class TcpBoundSocketConnectResponseParams extends bindings.Struct { | 286 class TcpBoundSocketConnectResponseParams extends bindings.Struct { |
| 272 static const List<bindings.StructDataHeader> kVersions = const [ | 287 static const List<bindings.StructDataHeader> kVersions = const [ |
| 273 const bindings.StructDataHeader(16, 0) | 288 const bindings.StructDataHeader(16, 0) |
| 274 ]; | 289 ]; |
| 275 network_error_mojom.NetworkError result = null; | 290 network_error_mojom.NetworkError result = null; |
| 276 | 291 |
| 277 TcpBoundSocketConnectResponseParams() : super(kVersions.last.size); | 292 TcpBoundSocketConnectResponseParams() : super(kVersions.last.size); |
| 278 | 293 |
| 294 TcpBoundSocketConnectResponseParams.init( |
| 295 network_error_mojom.NetworkError this.result |
| 296 ) : super(kVersions.last.size); |
| 297 |
| 279 static TcpBoundSocketConnectResponseParams deserialize(bindings.Message messag
e) { | 298 static TcpBoundSocketConnectResponseParams deserialize(bindings.Message messag
e) { |
| 280 var decoder = new bindings.Decoder(message); | 299 var decoder = new bindings.Decoder(message); |
| 281 var result = decode(decoder); | 300 var result = decode(decoder); |
| 282 if (decoder.excessHandles != null) { | 301 if (decoder.excessHandles != null) { |
| 283 decoder.excessHandles.forEach((h) => h.close()); | 302 decoder.excessHandles.forEach((h) => h.close()); |
| 284 } | 303 } |
| 285 return result; | 304 return result; |
| 286 } | 305 } |
| 287 | 306 |
| 288 static TcpBoundSocketConnectResponseParams decode(bindings.Decoder decoder0) { | 307 static TcpBoundSocketConnectResponseParams decode(bindings.Decoder decoder0) { |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 Map map = new Map(); | 356 Map map = new Map(); |
| 338 map["result"] = result; | 357 map["result"] = result; |
| 339 return map; | 358 return map; |
| 340 } | 359 } |
| 341 } | 360 } |
| 342 | 361 |
| 343 const int _tcpBoundSocketMethodStartListeningName = 0; | 362 const int _tcpBoundSocketMethodStartListeningName = 0; |
| 344 const int _tcpBoundSocketMethodConnectName = 1; | 363 const int _tcpBoundSocketMethodConnectName = 1; |
| 345 | 364 |
| 346 class _TcpBoundSocketServiceDescription implements service_describer.ServiceDesc
ription { | 365 class _TcpBoundSocketServiceDescription implements service_describer.ServiceDesc
ription { |
| 347 dynamic getTopLevelInterface([Function responseFactory]) => | 366 void getTopLevelInterface(Function responder) { |
| 348 responseFactory(null); | 367 responder(null); |
| 368 } |
| 349 | 369 |
| 350 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 370 void getTypeDefinition(String typeKey, Function responder) { |
| 351 responseFactory(null); | 371 responder(null); |
| 372 } |
| 352 | 373 |
| 353 dynamic getAllTypeDefinitions([Function responseFactory]) => | 374 void getAllTypeDefinitions(Function responder) { |
| 354 responseFactory(null); | 375 responder(null); |
| 376 } |
| 355 } | 377 } |
| 356 | 378 |
| 357 abstract class TcpBoundSocket { | 379 abstract class TcpBoundSocket { |
| 358 static const String serviceName = null; | 380 static const String serviceName = null; |
| 359 | 381 |
| 360 static service_describer.ServiceDescription _cachedServiceDescription; | 382 static service_describer.ServiceDescription _cachedServiceDescription; |
| 361 static service_describer.ServiceDescription get serviceDescription { | 383 static service_describer.ServiceDescription get serviceDescription { |
| 362 if (_cachedServiceDescription == null) { | 384 if (_cachedServiceDescription == null) { |
| 363 _cachedServiceDescription = new _TcpBoundSocketServiceDescription(); | 385 _cachedServiceDescription = new _TcpBoundSocketServiceDescription(); |
| 364 } | 386 } |
| 365 return _cachedServiceDescription; | 387 return _cachedServiceDescription; |
| 366 } | 388 } |
| 367 | 389 |
| 368 static TcpBoundSocketProxy connectToService( | 390 static TcpBoundSocketProxy connectToService( |
| 369 bindings.ServiceConnector s, String url, [String serviceName]) { | 391 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 370 TcpBoundSocketProxy p = new TcpBoundSocketProxy.unbound(); | 392 TcpBoundSocketProxy p = new TcpBoundSocketProxy.unbound(); |
| 371 String name = serviceName ?? TcpBoundSocket.serviceName; | 393 String name = serviceName ?? TcpBoundSocket.serviceName; |
| 372 if ((name == null) || name.isEmpty) { | 394 if ((name == null) || name.isEmpty) { |
| 373 throw new core.MojoApiError( | 395 throw new core.MojoApiError( |
| 374 "If an interface has no ServiceName, then one must be provided."); | 396 "If an interface has no ServiceName, then one must be provided."); |
| 375 } | 397 } |
| 376 s.connectToService(url, p, name); | 398 s.connectToService(url, p, name); |
| 377 return p; | 399 return p; |
| 378 } | 400 } |
| 379 dynamic startListening(tcp_server_socket_mojom.TcpServerSocketInterfaceRequest
server,[Function responseFactory = null]); | 401 void startListening(tcp_server_socket_mojom.TcpServerSocketInterfaceRequest se
rver,void callback(network_error_mojom.NetworkError result)); |
| 380 dynamic connect(net_address_mojom.NetAddress remoteAddress,core.MojoDataPipeCo
nsumer sendStream,core.MojoDataPipeProducer receiveStream,tcp_connected_socket_m
ojom.TcpConnectedSocketInterfaceRequest clientSocket,[Function responseFactory =
null]); | 402 void connect(net_address_mojom.NetAddress remoteAddress,core.MojoDataPipeConsu
mer sendStream,core.MojoDataPipeProducer receiveStream,tcp_connected_socket_mojo
m.TcpConnectedSocketInterfaceRequest clientSocket,void callback(network_error_mo
jom.NetworkError result)); |
| 381 } | 403 } |
| 382 | 404 |
| 383 abstract class TcpBoundSocketInterface | 405 abstract class TcpBoundSocketInterface |
| 384 implements bindings.MojoInterface<TcpBoundSocket>, | 406 implements bindings.MojoInterface<TcpBoundSocket>, |
| 385 TcpBoundSocket { | 407 TcpBoundSocket { |
| 386 factory TcpBoundSocketInterface([TcpBoundSocket impl]) => | 408 factory TcpBoundSocketInterface([TcpBoundSocket impl]) => |
| 387 new TcpBoundSocketStub.unbound(impl); | 409 new TcpBoundSocketStub.unbound(impl); |
| 388 | 410 |
| 389 factory TcpBoundSocketInterface.fromEndpoint( | 411 factory TcpBoundSocketInterface.fromEndpoint( |
| 390 core.MojoMessagePipeEndpoint endpoint, | 412 core.MojoMessagePipeEndpoint endpoint, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 420 | 442 |
| 421 void handleResponse(bindings.ServiceMessage message) { | 443 void handleResponse(bindings.ServiceMessage message) { |
| 422 switch (message.header.type) { | 444 switch (message.header.type) { |
| 423 case _tcpBoundSocketMethodStartListeningName: | 445 case _tcpBoundSocketMethodStartListeningName: |
| 424 var r = TcpBoundSocketStartListeningResponseParams.deserialize( | 446 var r = TcpBoundSocketStartListeningResponseParams.deserialize( |
| 425 message.payload); | 447 message.payload); |
| 426 if (!message.header.hasRequestId) { | 448 if (!message.header.hasRequestId) { |
| 427 proxyError("Expected a message with a valid request Id."); | 449 proxyError("Expected a message with a valid request Id."); |
| 428 return; | 450 return; |
| 429 } | 451 } |
| 430 Completer c = completerMap[message.header.requestId]; | 452 Function callback = callbackMap[message.header.requestId]; |
| 431 if (c == null) { | 453 if (callback == null) { |
| 432 proxyError( | 454 proxyError( |
| 433 "Message had unknown request Id: ${message.header.requestId}"); | 455 "Message had unknown request Id: ${message.header.requestId}"); |
| 434 return; | 456 return; |
| 435 } | 457 } |
| 436 completerMap.remove(message.header.requestId); | 458 callbackMap.remove(message.header.requestId); |
| 437 if (c.isCompleted) { | 459 callback(r.result ); |
| 438 proxyError("Response completer already completed"); | |
| 439 return; | |
| 440 } | |
| 441 c.complete(r); | |
| 442 break; | 460 break; |
| 443 case _tcpBoundSocketMethodConnectName: | 461 case _tcpBoundSocketMethodConnectName: |
| 444 var r = TcpBoundSocketConnectResponseParams.deserialize( | 462 var r = TcpBoundSocketConnectResponseParams.deserialize( |
| 445 message.payload); | 463 message.payload); |
| 446 if (!message.header.hasRequestId) { | 464 if (!message.header.hasRequestId) { |
| 447 proxyError("Expected a message with a valid request Id."); | 465 proxyError("Expected a message with a valid request Id."); |
| 448 return; | 466 return; |
| 449 } | 467 } |
| 450 Completer c = completerMap[message.header.requestId]; | 468 Function callback = callbackMap[message.header.requestId]; |
| 451 if (c == null) { | 469 if (callback == null) { |
| 452 proxyError( | 470 proxyError( |
| 453 "Message had unknown request Id: ${message.header.requestId}"); | 471 "Message had unknown request Id: ${message.header.requestId}"); |
| 454 return; | 472 return; |
| 455 } | 473 } |
| 456 completerMap.remove(message.header.requestId); | 474 callbackMap.remove(message.header.requestId); |
| 457 if (c.isCompleted) { | 475 callback(r.result ); |
| 458 proxyError("Response completer already completed"); | |
| 459 return; | |
| 460 } | |
| 461 c.complete(r); | |
| 462 break; | 476 break; |
| 463 default: | 477 default: |
| 464 proxyError("Unexpected message type: ${message.header.type}"); | 478 proxyError("Unexpected message type: ${message.header.type}"); |
| 465 close(immediate: true); | 479 close(immediate: true); |
| 466 break; | 480 break; |
| 467 } | 481 } |
| 468 } | 482 } |
| 469 | 483 |
| 470 @override | 484 @override |
| 471 String toString() { | 485 String toString() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 496 return newMockedProxy; | 510 return newMockedProxy; |
| 497 } | 511 } |
| 498 | 512 |
| 499 static TcpBoundSocketProxy newFromEndpoint( | 513 static TcpBoundSocketProxy newFromEndpoint( |
| 500 core.MojoMessagePipeEndpoint endpoint) { | 514 core.MojoMessagePipeEndpoint endpoint) { |
| 501 assert(endpoint.setDescription("For TcpBoundSocketProxy")); | 515 assert(endpoint.setDescription("For TcpBoundSocketProxy")); |
| 502 return new TcpBoundSocketProxy.fromEndpoint(endpoint); | 516 return new TcpBoundSocketProxy.fromEndpoint(endpoint); |
| 503 } | 517 } |
| 504 | 518 |
| 505 | 519 |
| 506 dynamic startListening(tcp_server_socket_mojom.TcpServerSocketInterfaceRequest
server,[Function responseFactory = null]) { | 520 void startListening(tcp_server_socket_mojom.TcpServerSocketInterfaceRequest se
rver,void callback(network_error_mojom.NetworkError result)) { |
| 507 if (impl != null) { | 521 if (impl != null) { |
| 508 return new Future(() => impl.startListening(server,_TcpBoundSocketStubCont
rol._tcpBoundSocketStartListeningResponseParamsFactory)); | 522 impl.startListening(server,callback); |
| 523 return; |
| 509 } | 524 } |
| 510 var params = new _TcpBoundSocketStartListeningParams(); | 525 var params = new _TcpBoundSocketStartListeningParams(); |
| 511 params.server = server; | 526 params.server = server; |
| 512 return ctrl.sendMessageWithRequestId( | 527 ctrl.sendMessageWithRequestId( |
| 513 params, | 528 params, |
| 514 _tcpBoundSocketMethodStartListeningName, | 529 _tcpBoundSocketMethodStartListeningName, |
| 515 -1, | 530 -1, |
| 516 bindings.MessageHeader.kMessageExpectsResponse); | 531 bindings.MessageHeader.kMessageExpectsResponse, |
| 532 callback); |
| 517 } | 533 } |
| 518 dynamic connect(net_address_mojom.NetAddress remoteAddress,core.MojoDataPipeCo
nsumer sendStream,core.MojoDataPipeProducer receiveStream,tcp_connected_socket_m
ojom.TcpConnectedSocketInterfaceRequest clientSocket,[Function responseFactory =
null]) { | 534 void connect(net_address_mojom.NetAddress remoteAddress,core.MojoDataPipeConsu
mer sendStream,core.MojoDataPipeProducer receiveStream,tcp_connected_socket_mojo
m.TcpConnectedSocketInterfaceRequest clientSocket,void callback(network_error_mo
jom.NetworkError result)) { |
| 519 if (impl != null) { | 535 if (impl != null) { |
| 520 return new Future(() => impl.connect(remoteAddress,sendStream,receiveStrea
m,clientSocket,_TcpBoundSocketStubControl._tcpBoundSocketConnectResponseParamsFa
ctory)); | 536 impl.connect(remoteAddress,sendStream,receiveStream,clientSocket,callback)
; |
| 537 return; |
| 521 } | 538 } |
| 522 var params = new _TcpBoundSocketConnectParams(); | 539 var params = new _TcpBoundSocketConnectParams(); |
| 523 params.remoteAddress = remoteAddress; | 540 params.remoteAddress = remoteAddress; |
| 524 params.sendStream = sendStream; | 541 params.sendStream = sendStream; |
| 525 params.receiveStream = receiveStream; | 542 params.receiveStream = receiveStream; |
| 526 params.clientSocket = clientSocket; | 543 params.clientSocket = clientSocket; |
| 527 return ctrl.sendMessageWithRequestId( | 544 ctrl.sendMessageWithRequestId( |
| 528 params, | 545 params, |
| 529 _tcpBoundSocketMethodConnectName, | 546 _tcpBoundSocketMethodConnectName, |
| 530 -1, | 547 -1, |
| 531 bindings.MessageHeader.kMessageExpectsResponse); | 548 bindings.MessageHeader.kMessageExpectsResponse, |
| 549 callback); |
| 532 } | 550 } |
| 533 } | 551 } |
| 534 | 552 |
| 535 class _TcpBoundSocketStubControl | 553 class _TcpBoundSocketStubControl |
| 536 extends bindings.StubMessageHandler | 554 extends bindings.StubMessageHandler |
| 537 implements bindings.StubControl<TcpBoundSocket> { | 555 implements bindings.StubControl<TcpBoundSocket> { |
| 538 TcpBoundSocket _impl; | 556 TcpBoundSocket _impl; |
| 539 | 557 |
| 540 _TcpBoundSocketStubControl.fromEndpoint( | 558 _TcpBoundSocketStubControl.fromEndpoint( |
| 541 core.MojoMessagePipeEndpoint endpoint, [TcpBoundSocket impl]) | 559 core.MojoMessagePipeEndpoint endpoint, [TcpBoundSocket impl]) |
| 542 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 560 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 543 _impl = impl; | 561 _impl = impl; |
| 544 } | 562 } |
| 545 | 563 |
| 546 _TcpBoundSocketStubControl.fromHandle( | 564 _TcpBoundSocketStubControl.fromHandle( |
| 547 core.MojoHandle handle, [TcpBoundSocket impl]) | 565 core.MojoHandle handle, [TcpBoundSocket impl]) |
| 548 : super.fromHandle(handle, autoBegin: impl != null) { | 566 : super.fromHandle(handle, autoBegin: impl != null) { |
| 549 _impl = impl; | 567 _impl = impl; |
| 550 } | 568 } |
| 551 | 569 |
| 552 _TcpBoundSocketStubControl.unbound([this._impl]) : super.unbound(); | 570 _TcpBoundSocketStubControl.unbound([this._impl]) : super.unbound(); |
| 553 | 571 |
| 554 String get serviceName => TcpBoundSocket.serviceName; | 572 String get serviceName => TcpBoundSocket.serviceName; |
| 555 | 573 |
| 556 | 574 |
| 557 static TcpBoundSocketStartListeningResponseParams _tcpBoundSocketStartListenin
gResponseParamsFactory(network_error_mojom.NetworkError result) { | 575 Function _tcpBoundSocketStartListeningResponseParamsResponder( |
| 558 var result = new TcpBoundSocketStartListeningResponseParams(); | 576 int requestId) { |
| 559 result.result = result; | 577 return (network_error_mojom.NetworkError result) { |
| 560 return result; | 578 var result = new TcpBoundSocketStartListeningResponseParams(); |
| 579 result.result = result; |
| 580 sendResponse(buildResponseWithId( |
| 581 result, |
| 582 _tcpBoundSocketMethodStartListeningName, |
| 583 requestId, |
| 584 bindings.MessageHeader.kMessageIsResponse)); |
| 585 }; |
| 561 } | 586 } |
| 562 static TcpBoundSocketConnectResponseParams _tcpBoundSocketConnectResponseParam
sFactory(network_error_mojom.NetworkError result) { | 587 Function _tcpBoundSocketConnectResponseParamsResponder( |
| 563 var result = new TcpBoundSocketConnectResponseParams(); | 588 int requestId) { |
| 564 result.result = result; | 589 return (network_error_mojom.NetworkError result) { |
| 565 return result; | 590 var result = new TcpBoundSocketConnectResponseParams(); |
| 591 result.result = result; |
| 592 sendResponse(buildResponseWithId( |
| 593 result, |
| 594 _tcpBoundSocketMethodConnectName, |
| 595 requestId, |
| 596 bindings.MessageHeader.kMessageIsResponse)); |
| 597 }; |
| 566 } | 598 } |
| 567 | 599 |
| 568 dynamic handleMessage(bindings.ServiceMessage message) { | 600 void handleMessage(bindings.ServiceMessage message) { |
| 569 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 601 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 570 return bindings.ControlMessageHandler.handleMessage(this, | 602 bindings.ControlMessageHandler.handleMessage( |
| 571 0, | 603 this, 0, message); |
| 572 message); | 604 return; |
| 573 } | 605 } |
| 574 if (_impl == null) { | 606 if (_impl == null) { |
| 575 throw new core.MojoApiError("$this has no implementation set"); | 607 throw new core.MojoApiError("$this has no implementation set"); |
| 576 } | 608 } |
| 577 switch (message.header.type) { | 609 switch (message.header.type) { |
| 578 case _tcpBoundSocketMethodStartListeningName: | 610 case _tcpBoundSocketMethodStartListeningName: |
| 579 var params = _TcpBoundSocketStartListeningParams.deserialize( | 611 var params = _TcpBoundSocketStartListeningParams.deserialize( |
| 580 message.payload); | 612 message.payload); |
| 581 var response = _impl.startListening(params.server,_tcpBoundSocketStartLi
steningResponseParamsFactory); | 613 _impl.startListening(params.server, _tcpBoundSocketStartListeningRespons
eParamsResponder(message.header.requestId)); |
| 582 if (response is Future) { | |
| 583 return response.then((response) { | |
| 584 if (response != null) { | |
| 585 return buildResponseWithId( | |
| 586 response, | |
| 587 _tcpBoundSocketMethodStartListeningName, | |
| 588 message.header.requestId, | |
| 589 bindings.MessageHeader.kMessageIsResponse); | |
| 590 } | |
| 591 }); | |
| 592 } else if (response != null) { | |
| 593 return buildResponseWithId( | |
| 594 response, | |
| 595 _tcpBoundSocketMethodStartListeningName, | |
| 596 message.header.requestId, | |
| 597 bindings.MessageHeader.kMessageIsResponse); | |
| 598 } | |
| 599 break; | 614 break; |
| 600 case _tcpBoundSocketMethodConnectName: | 615 case _tcpBoundSocketMethodConnectName: |
| 601 var params = _TcpBoundSocketConnectParams.deserialize( | 616 var params = _TcpBoundSocketConnectParams.deserialize( |
| 602 message.payload); | 617 message.payload); |
| 603 var response = _impl.connect(params.remoteAddress,params.sendStream,para
ms.receiveStream,params.clientSocket,_tcpBoundSocketConnectResponseParamsFactory
); | 618 _impl.connect(params.remoteAddress, params.sendStream, params.receiveStr
eam, params.clientSocket, _tcpBoundSocketConnectResponseParamsResponder(message.
header.requestId)); |
| 604 if (response is Future) { | |
| 605 return response.then((response) { | |
| 606 if (response != null) { | |
| 607 return buildResponseWithId( | |
| 608 response, | |
| 609 _tcpBoundSocketMethodConnectName, | |
| 610 message.header.requestId, | |
| 611 bindings.MessageHeader.kMessageIsResponse); | |
| 612 } | |
| 613 }); | |
| 614 } else if (response != null) { | |
| 615 return buildResponseWithId( | |
| 616 response, | |
| 617 _tcpBoundSocketMethodConnectName, | |
| 618 message.header.requestId, | |
| 619 bindings.MessageHeader.kMessageIsResponse); | |
| 620 } | |
| 621 break; | 619 break; |
| 622 default: | 620 default: |
| 623 throw new bindings.MojoCodecError("Unexpected message name"); | 621 throw new bindings.MojoCodecError("Unexpected message name"); |
| 624 break; | 622 break; |
| 625 } | 623 } |
| 626 return null; | |
| 627 } | 624 } |
| 628 | 625 |
| 629 TcpBoundSocket get impl => _impl; | 626 TcpBoundSocket get impl => _impl; |
| 630 set impl(TcpBoundSocket d) { | 627 set impl(TcpBoundSocket d) { |
| 631 if (d == null) { | 628 if (d == null) { |
| 632 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 629 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 633 } | 630 } |
| 634 if (isBound && (_impl == null)) { | 631 if (isBound && (_impl == null)) { |
| 635 beginHandlingEvents(); | 632 beginHandlingEvents(); |
| 636 } | 633 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 670 core.MojoHandle handle, [TcpBoundSocket impl]) | 667 core.MojoHandle handle, [TcpBoundSocket impl]) |
| 671 : super(new _TcpBoundSocketStubControl.fromHandle(handle, impl)); | 668 : super(new _TcpBoundSocketStubControl.fromHandle(handle, impl)); |
| 672 | 669 |
| 673 static TcpBoundSocketStub newFromEndpoint( | 670 static TcpBoundSocketStub newFromEndpoint( |
| 674 core.MojoMessagePipeEndpoint endpoint) { | 671 core.MojoMessagePipeEndpoint endpoint) { |
| 675 assert(endpoint.setDescription("For TcpBoundSocketStub")); | 672 assert(endpoint.setDescription("For TcpBoundSocketStub")); |
| 676 return new TcpBoundSocketStub.fromEndpoint(endpoint); | 673 return new TcpBoundSocketStub.fromEndpoint(endpoint); |
| 677 } | 674 } |
| 678 | 675 |
| 679 | 676 |
| 680 dynamic startListening(tcp_server_socket_mojom.TcpServerSocketInterfaceRequest
server,[Function responseFactory = null]) { | 677 void startListening(tcp_server_socket_mojom.TcpServerSocketInterfaceRequest se
rver,void callback(network_error_mojom.NetworkError result)) { |
| 681 return impl.startListening(server,responseFactory); | 678 return impl.startListening(server,callback); |
| 682 } | 679 } |
| 683 dynamic connect(net_address_mojom.NetAddress remoteAddress,core.MojoDataPipeCo
nsumer sendStream,core.MojoDataPipeProducer receiveStream,tcp_connected_socket_m
ojom.TcpConnectedSocketInterfaceRequest clientSocket,[Function responseFactory =
null]) { | 680 void connect(net_address_mojom.NetAddress remoteAddress,core.MojoDataPipeConsu
mer sendStream,core.MojoDataPipeProducer receiveStream,tcp_connected_socket_mojo
m.TcpConnectedSocketInterfaceRequest clientSocket,void callback(network_error_mo
jom.NetworkError result)) { |
| 684 return impl.connect(remoteAddress,sendStream,receiveStream,clientSocket,resp
onseFactory); | 681 return impl.connect(remoteAddress,sendStream,receiveStream,clientSocket,call
back); |
| 685 } | 682 } |
| 686 } | 683 } |
| 687 | 684 |
| 688 | 685 |
| 689 | 686 |
| OLD | NEW |