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_server_socket_mojom; | 5 library tcp_server_socket_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/mojo/network_error.mojom.dart' as network_error_mojom; | 13 import 'package:mojo/mojo/network_error.mojom.dart' as network_error_mojom; |
12 import 'package:mojo_services/mojo/net_address.mojom.dart' as net_address_mojom; | 14 import 'package:mojo_services/mojo/net_address.mojom.dart' as net_address_mojom; |
13 import 'package:mojo_services/mojo/tcp_connected_socket.mojom.dart' as tcp_conne
cted_socket_mojom; | 15 import 'package:mojo_services/mojo/tcp_connected_socket.mojom.dart' as tcp_conne
cted_socket_mojom; |
14 | 16 |
15 | 17 |
16 | 18 |
17 class _TcpServerSocketAcceptParams extends bindings.Struct { | 19 class _TcpServerSocketAcceptParams extends bindings.Struct { |
18 static const List<bindings.StructDataHeader> kVersions = const [ | 20 static const List<bindings.StructDataHeader> kVersions = const [ |
19 const bindings.StructDataHeader(24, 0) | 21 const bindings.StructDataHeader(24, 0) |
20 ]; | 22 ]; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 "clientSocket: $clientSocket" ")"; | 91 "clientSocket: $clientSocket" ")"; |
90 } | 92 } |
91 | 93 |
92 Map toJson() { | 94 Map toJson() { |
93 throw new bindings.MojoCodecError( | 95 throw new bindings.MojoCodecError( |
94 'Object containing handles cannot be encoded to JSON.'); | 96 'Object containing handles cannot be encoded to JSON.'); |
95 } | 97 } |
96 } | 98 } |
97 | 99 |
98 | 100 |
| 101 |
| 102 |
99 class TcpServerSocketAcceptResponseParams extends bindings.Struct { | 103 class TcpServerSocketAcceptResponseParams extends bindings.Struct { |
100 static const List<bindings.StructDataHeader> kVersions = const [ | 104 static const List<bindings.StructDataHeader> kVersions = const [ |
101 const bindings.StructDataHeader(24, 0) | 105 const bindings.StructDataHeader(24, 0) |
102 ]; | 106 ]; |
103 network_error_mojom.NetworkError result = null; | 107 network_error_mojom.NetworkError result = null; |
104 net_address_mojom.NetAddress remoteAddress = null; | 108 net_address_mojom.NetAddress remoteAddress = null; |
105 | 109 |
106 TcpServerSocketAcceptResponseParams() : super(kVersions.last.size); | 110 TcpServerSocketAcceptResponseParams() : super(kVersions.last.size); |
107 | 111 |
108 static TcpServerSocketAcceptResponseParams deserialize(bindings.Message messag
e) { | 112 static TcpServerSocketAcceptResponseParams deserialize(bindings.Message messag
e) { |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 } | 170 } |
167 | 171 |
168 Map toJson() { | 172 Map toJson() { |
169 Map map = new Map(); | 173 Map map = new Map(); |
170 map["result"] = result; | 174 map["result"] = result; |
171 map["remoteAddress"] = remoteAddress; | 175 map["remoteAddress"] = remoteAddress; |
172 return map; | 176 return map; |
173 } | 177 } |
174 } | 178 } |
175 | 179 |
| 180 |
| 181 |
| 182 |
176 const int _TcpServerSocket_acceptName = 0; | 183 const int _TcpServerSocket_acceptName = 0; |
177 | 184 |
| 185 |
| 186 |
| 187 class _TcpServerSocketServiceDescription implements service_describer.ServiceDes
cription { |
| 188 dynamic getTopLevelInterface([Function responseFactory]) => null; |
| 189 |
| 190 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null; |
| 191 |
| 192 dynamic getAllTypeDefinitions([Function responseFactory]) => null; |
| 193 } |
| 194 |
178 abstract class TcpServerSocket { | 195 abstract class TcpServerSocket { |
179 static const String serviceName = null; | 196 static const String serviceName = null; |
180 dynamic accept(core.MojoDataPipeConsumer sendStream,core.MojoDataPipeProducer
receiveStream,Object clientSocket,[Function responseFactory = null]); | 197 dynamic accept(core.MojoDataPipeConsumer sendStream,core.MojoDataPipeProducer
receiveStream,Object clientSocket,[Function responseFactory = null]); |
181 } | 198 } |
182 | 199 |
183 | 200 |
184 class _TcpServerSocketProxyImpl extends bindings.Proxy { | 201 class _TcpServerSocketProxyImpl extends bindings.Proxy { |
185 _TcpServerSocketProxyImpl.fromEndpoint( | 202 _TcpServerSocketProxyImpl.fromEndpoint( |
186 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 203 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
187 | 204 |
188 _TcpServerSocketProxyImpl.fromHandle(core.MojoHandle handle) : | 205 _TcpServerSocketProxyImpl.fromHandle(core.MojoHandle handle) : |
189 super.fromHandle(handle); | 206 super.fromHandle(handle); |
190 | 207 |
191 _TcpServerSocketProxyImpl.unbound() : super.unbound(); | 208 _TcpServerSocketProxyImpl.unbound() : super.unbound(); |
192 | 209 |
193 static _TcpServerSocketProxyImpl newFromEndpoint( | 210 static _TcpServerSocketProxyImpl newFromEndpoint( |
194 core.MojoMessagePipeEndpoint endpoint) { | 211 core.MojoMessagePipeEndpoint endpoint) { |
195 assert(endpoint.setDescription("For _TcpServerSocketProxyImpl")); | 212 assert(endpoint.setDescription("For _TcpServerSocketProxyImpl")); |
196 return new _TcpServerSocketProxyImpl.fromEndpoint(endpoint); | 213 return new _TcpServerSocketProxyImpl.fromEndpoint(endpoint); |
197 } | 214 } |
198 | 215 |
| 216 service_describer.ServiceDescription get serviceDescription => |
| 217 new _TcpServerSocketServiceDescription(); |
| 218 |
199 void handleResponse(bindings.ServiceMessage message) { | 219 void handleResponse(bindings.ServiceMessage message) { |
200 switch (message.header.type) { | 220 switch (message.header.type) { |
201 case _TcpServerSocket_acceptName: | 221 case _TcpServerSocket_acceptName: |
202 var r = TcpServerSocketAcceptResponseParams.deserialize( | 222 var r = TcpServerSocketAcceptResponseParams.deserialize( |
203 message.payload); | 223 message.payload); |
204 if (!message.header.hasRequestId) { | 224 if (!message.header.hasRequestId) { |
205 proxyError("Expected a message with a valid request Id."); | 225 proxyError("Expected a message with a valid request Id."); |
206 return; | 226 return; |
207 } | 227 } |
208 Completer c = completerMap[message.header.requestId]; | 228 Completer c = completerMap[message.header.requestId]; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 assert(_impl == null); | 397 assert(_impl == null); |
378 _impl = d; | 398 _impl = d; |
379 } | 399 } |
380 | 400 |
381 String toString() { | 401 String toString() { |
382 var superString = super.toString(); | 402 var superString = super.toString(); |
383 return "TcpServerSocketStub($superString)"; | 403 return "TcpServerSocketStub($superString)"; |
384 } | 404 } |
385 | 405 |
386 int get version => 0; | 406 int get version => 0; |
| 407 |
| 408 service_describer.ServiceDescription get serviceDescription => |
| 409 new _TcpServerSocketServiceDescription(); |
387 } | 410 } |
388 | 411 |
389 | 412 |
| 413 |
OLD | NEW |