| 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 view_token_mojom; | 4 library view_token_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 | 9 |
| 10 | 10 |
| 11 | 11 |
| 12 class ViewToken extends bindings.Struct { | 12 class ViewToken extends bindings.Struct { |
| 13 static const List<bindings.StructDataHeader> kVersions = const [ | 13 static const List<bindings.StructDataHeader> kVersions = const [ |
| 14 const bindings.StructDataHeader(16, 0) | 14 const bindings.StructDataHeader(16, 0) |
| 15 ]; | 15 ]; |
| 16 int value = 0; | 16 int value = 0; |
| 17 | 17 |
| 18 ViewToken() : super(kVersions.last.size); | 18 ViewToken() : super(kVersions.last.size); |
| 19 | 19 |
| 20 ViewToken.init( |
| 21 int this.value |
| 22 ) : super(kVersions.last.size); |
| 23 |
| 20 static ViewToken deserialize(bindings.Message message) { | 24 static ViewToken deserialize(bindings.Message message) { |
| 21 var decoder = new bindings.Decoder(message); | 25 var decoder = new bindings.Decoder(message); |
| 22 var result = decode(decoder); | 26 var result = decode(decoder); |
| 23 if (decoder.excessHandles != null) { | 27 if (decoder.excessHandles != null) { |
| 24 decoder.excessHandles.forEach((h) => h.close()); | 28 decoder.excessHandles.forEach((h) => h.close()); |
| 25 } | 29 } |
| 26 return result; | 30 return result; |
| 27 } | 31 } |
| 28 | 32 |
| 29 static ViewToken decode(bindings.Decoder decoder0) { | 33 static ViewToken decode(bindings.Decoder decoder0) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 } | 85 } |
| 82 | 86 |
| 83 | 87 |
| 84 class _ViewOwnerGetTokenParams extends bindings.Struct { | 88 class _ViewOwnerGetTokenParams extends bindings.Struct { |
| 85 static const List<bindings.StructDataHeader> kVersions = const [ | 89 static const List<bindings.StructDataHeader> kVersions = const [ |
| 86 const bindings.StructDataHeader(8, 0) | 90 const bindings.StructDataHeader(8, 0) |
| 87 ]; | 91 ]; |
| 88 | 92 |
| 89 _ViewOwnerGetTokenParams() : super(kVersions.last.size); | 93 _ViewOwnerGetTokenParams() : super(kVersions.last.size); |
| 90 | 94 |
| 95 _ViewOwnerGetTokenParams.init( |
| 96 ) : super(kVersions.last.size); |
| 97 |
| 91 static _ViewOwnerGetTokenParams deserialize(bindings.Message message) { | 98 static _ViewOwnerGetTokenParams deserialize(bindings.Message message) { |
| 92 var decoder = new bindings.Decoder(message); | 99 var decoder = new bindings.Decoder(message); |
| 93 var result = decode(decoder); | 100 var result = decode(decoder); |
| 94 if (decoder.excessHandles != null) { | 101 if (decoder.excessHandles != null) { |
| 95 decoder.excessHandles.forEach((h) => h.close()); | 102 decoder.excessHandles.forEach((h) => h.close()); |
| 96 } | 103 } |
| 97 return result; | 104 return result; |
| 98 } | 105 } |
| 99 | 106 |
| 100 static _ViewOwnerGetTokenParams decode(bindings.Decoder decoder0) { | 107 static _ViewOwnerGetTokenParams decode(bindings.Decoder decoder0) { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 | 147 |
| 141 | 148 |
| 142 class ViewOwnerGetTokenResponseParams extends bindings.Struct { | 149 class ViewOwnerGetTokenResponseParams extends bindings.Struct { |
| 143 static const List<bindings.StructDataHeader> kVersions = const [ | 150 static const List<bindings.StructDataHeader> kVersions = const [ |
| 144 const bindings.StructDataHeader(16, 0) | 151 const bindings.StructDataHeader(16, 0) |
| 145 ]; | 152 ]; |
| 146 ViewToken token = null; | 153 ViewToken token = null; |
| 147 | 154 |
| 148 ViewOwnerGetTokenResponseParams() : super(kVersions.last.size); | 155 ViewOwnerGetTokenResponseParams() : super(kVersions.last.size); |
| 149 | 156 |
| 157 ViewOwnerGetTokenResponseParams.init( |
| 158 ViewToken this.token |
| 159 ) : super(kVersions.last.size); |
| 160 |
| 150 static ViewOwnerGetTokenResponseParams deserialize(bindings.Message message) { | 161 static ViewOwnerGetTokenResponseParams deserialize(bindings.Message message) { |
| 151 var decoder = new bindings.Decoder(message); | 162 var decoder = new bindings.Decoder(message); |
| 152 var result = decode(decoder); | 163 var result = decode(decoder); |
| 153 if (decoder.excessHandles != null) { | 164 if (decoder.excessHandles != null) { |
| 154 decoder.excessHandles.forEach((h) => h.close()); | 165 decoder.excessHandles.forEach((h) => h.close()); |
| 155 } | 166 } |
| 156 return result; | 167 return result; |
| 157 } | 168 } |
| 158 | 169 |
| 159 static ViewOwnerGetTokenResponseParams decode(bindings.Decoder decoder0) { | 170 static ViewOwnerGetTokenResponseParams decode(bindings.Decoder decoder0) { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 207 Map toJson() { | 218 Map toJson() { |
| 208 Map map = new Map(); | 219 Map map = new Map(); |
| 209 map["token"] = token; | 220 map["token"] = token; |
| 210 return map; | 221 return map; |
| 211 } | 222 } |
| 212 } | 223 } |
| 213 | 224 |
| 214 const int _viewOwnerMethodGetTokenName = 0; | 225 const int _viewOwnerMethodGetTokenName = 0; |
| 215 | 226 |
| 216 class _ViewOwnerServiceDescription implements service_describer.ServiceDescripti
on { | 227 class _ViewOwnerServiceDescription implements service_describer.ServiceDescripti
on { |
| 217 dynamic getTopLevelInterface([Function responseFactory]) => | 228 void getTopLevelInterface(Function responder) { |
| 218 responseFactory(null); | 229 responder(null); |
| 230 } |
| 219 | 231 |
| 220 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 232 void getTypeDefinition(String typeKey, Function responder) { |
| 221 responseFactory(null); | 233 responder(null); |
| 234 } |
| 222 | 235 |
| 223 dynamic getAllTypeDefinitions([Function responseFactory]) => | 236 void getAllTypeDefinitions(Function responder) { |
| 224 responseFactory(null); | 237 responder(null); |
| 238 } |
| 225 } | 239 } |
| 226 | 240 |
| 227 abstract class ViewOwner { | 241 abstract class ViewOwner { |
| 228 static const String serviceName = null; | 242 static const String serviceName = null; |
| 229 | 243 |
| 230 static service_describer.ServiceDescription _cachedServiceDescription; | 244 static service_describer.ServiceDescription _cachedServiceDescription; |
| 231 static service_describer.ServiceDescription get serviceDescription { | 245 static service_describer.ServiceDescription get serviceDescription { |
| 232 if (_cachedServiceDescription == null) { | 246 if (_cachedServiceDescription == null) { |
| 233 _cachedServiceDescription = new _ViewOwnerServiceDescription(); | 247 _cachedServiceDescription = new _ViewOwnerServiceDescription(); |
| 234 } | 248 } |
| 235 return _cachedServiceDescription; | 249 return _cachedServiceDescription; |
| 236 } | 250 } |
| 237 | 251 |
| 238 static ViewOwnerProxy connectToService( | 252 static ViewOwnerProxy connectToService( |
| 239 bindings.ServiceConnector s, String url, [String serviceName]) { | 253 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 240 ViewOwnerProxy p = new ViewOwnerProxy.unbound(); | 254 ViewOwnerProxy p = new ViewOwnerProxy.unbound(); |
| 241 String name = serviceName ?? ViewOwner.serviceName; | 255 String name = serviceName ?? ViewOwner.serviceName; |
| 242 if ((name == null) || name.isEmpty) { | 256 if ((name == null) || name.isEmpty) { |
| 243 throw new core.MojoApiError( | 257 throw new core.MojoApiError( |
| 244 "If an interface has no ServiceName, then one must be provided."); | 258 "If an interface has no ServiceName, then one must be provided."); |
| 245 } | 259 } |
| 246 s.connectToService(url, p, name); | 260 s.connectToService(url, p, name); |
| 247 return p; | 261 return p; |
| 248 } | 262 } |
| 249 dynamic getToken([Function responseFactory = null]); | 263 void getToken(void callback(ViewToken token)); |
| 250 } | 264 } |
| 251 | 265 |
| 252 abstract class ViewOwnerInterface | 266 abstract class ViewOwnerInterface |
| 253 implements bindings.MojoInterface<ViewOwner>, | 267 implements bindings.MojoInterface<ViewOwner>, |
| 254 ViewOwner { | 268 ViewOwner { |
| 255 factory ViewOwnerInterface([ViewOwner impl]) => | 269 factory ViewOwnerInterface([ViewOwner impl]) => |
| 256 new ViewOwnerStub.unbound(impl); | 270 new ViewOwnerStub.unbound(impl); |
| 257 | 271 |
| 258 factory ViewOwnerInterface.fromEndpoint( | 272 factory ViewOwnerInterface.fromEndpoint( |
| 259 core.MojoMessagePipeEndpoint endpoint, | 273 core.MojoMessagePipeEndpoint endpoint, |
| (...skipping 29 matching lines...) Expand all Loading... |
| 289 | 303 |
| 290 void handleResponse(bindings.ServiceMessage message) { | 304 void handleResponse(bindings.ServiceMessage message) { |
| 291 switch (message.header.type) { | 305 switch (message.header.type) { |
| 292 case _viewOwnerMethodGetTokenName: | 306 case _viewOwnerMethodGetTokenName: |
| 293 var r = ViewOwnerGetTokenResponseParams.deserialize( | 307 var r = ViewOwnerGetTokenResponseParams.deserialize( |
| 294 message.payload); | 308 message.payload); |
| 295 if (!message.header.hasRequestId) { | 309 if (!message.header.hasRequestId) { |
| 296 proxyError("Expected a message with a valid request Id."); | 310 proxyError("Expected a message with a valid request Id."); |
| 297 return; | 311 return; |
| 298 } | 312 } |
| 299 Completer c = completerMap[message.header.requestId]; | 313 Function callback = callbackMap[message.header.requestId]; |
| 300 if (c == null) { | 314 if (callback == null) { |
| 301 proxyError( | 315 proxyError( |
| 302 "Message had unknown request Id: ${message.header.requestId}"); | 316 "Message had unknown request Id: ${message.header.requestId}"); |
| 303 return; | 317 return; |
| 304 } | 318 } |
| 305 completerMap.remove(message.header.requestId); | 319 callbackMap.remove(message.header.requestId); |
| 306 if (c.isCompleted) { | 320 callback(r.token ); |
| 307 proxyError("Response completer already completed"); | |
| 308 return; | |
| 309 } | |
| 310 c.complete(r); | |
| 311 break; | 321 break; |
| 312 default: | 322 default: |
| 313 proxyError("Unexpected message type: ${message.header.type}"); | 323 proxyError("Unexpected message type: ${message.header.type}"); |
| 314 close(immediate: true); | 324 close(immediate: true); |
| 315 break; | 325 break; |
| 316 } | 326 } |
| 317 } | 327 } |
| 318 | 328 |
| 319 @override | 329 @override |
| 320 String toString() { | 330 String toString() { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 345 return newMockedProxy; | 355 return newMockedProxy; |
| 346 } | 356 } |
| 347 | 357 |
| 348 static ViewOwnerProxy newFromEndpoint( | 358 static ViewOwnerProxy newFromEndpoint( |
| 349 core.MojoMessagePipeEndpoint endpoint) { | 359 core.MojoMessagePipeEndpoint endpoint) { |
| 350 assert(endpoint.setDescription("For ViewOwnerProxy")); | 360 assert(endpoint.setDescription("For ViewOwnerProxy")); |
| 351 return new ViewOwnerProxy.fromEndpoint(endpoint); | 361 return new ViewOwnerProxy.fromEndpoint(endpoint); |
| 352 } | 362 } |
| 353 | 363 |
| 354 | 364 |
| 355 dynamic getToken([Function responseFactory = null]) { | 365 void getToken(void callback(ViewToken token)) { |
| 356 if (impl != null) { | 366 if (impl != null) { |
| 357 return new Future(() => impl.getToken(_ViewOwnerStubControl._viewOwnerGetT
okenResponseParamsFactory)); | 367 impl.getToken(callback); |
| 368 return; |
| 358 } | 369 } |
| 359 var params = new _ViewOwnerGetTokenParams(); | 370 var params = new _ViewOwnerGetTokenParams(); |
| 360 return ctrl.sendMessageWithRequestId( | 371 ctrl.sendMessageWithRequestId( |
| 361 params, | 372 params, |
| 362 _viewOwnerMethodGetTokenName, | 373 _viewOwnerMethodGetTokenName, |
| 363 -1, | 374 -1, |
| 364 bindings.MessageHeader.kMessageExpectsResponse); | 375 bindings.MessageHeader.kMessageExpectsResponse, |
| 376 callback); |
| 365 } | 377 } |
| 366 } | 378 } |
| 367 | 379 |
| 368 class _ViewOwnerStubControl | 380 class _ViewOwnerStubControl |
| 369 extends bindings.StubMessageHandler | 381 extends bindings.StubMessageHandler |
| 370 implements bindings.StubControl<ViewOwner> { | 382 implements bindings.StubControl<ViewOwner> { |
| 371 ViewOwner _impl; | 383 ViewOwner _impl; |
| 372 | 384 |
| 373 _ViewOwnerStubControl.fromEndpoint( | 385 _ViewOwnerStubControl.fromEndpoint( |
| 374 core.MojoMessagePipeEndpoint endpoint, [ViewOwner impl]) | 386 core.MojoMessagePipeEndpoint endpoint, [ViewOwner impl]) |
| 375 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 387 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 376 _impl = impl; | 388 _impl = impl; |
| 377 } | 389 } |
| 378 | 390 |
| 379 _ViewOwnerStubControl.fromHandle( | 391 _ViewOwnerStubControl.fromHandle( |
| 380 core.MojoHandle handle, [ViewOwner impl]) | 392 core.MojoHandle handle, [ViewOwner impl]) |
| 381 : super.fromHandle(handle, autoBegin: impl != null) { | 393 : super.fromHandle(handle, autoBegin: impl != null) { |
| 382 _impl = impl; | 394 _impl = impl; |
| 383 } | 395 } |
| 384 | 396 |
| 385 _ViewOwnerStubControl.unbound([this._impl]) : super.unbound(); | 397 _ViewOwnerStubControl.unbound([this._impl]) : super.unbound(); |
| 386 | 398 |
| 387 String get serviceName => ViewOwner.serviceName; | 399 String get serviceName => ViewOwner.serviceName; |
| 388 | 400 |
| 389 | 401 |
| 390 static ViewOwnerGetTokenResponseParams _viewOwnerGetTokenResponseParamsFactory
(ViewToken token) { | 402 Function _viewOwnerGetTokenResponseParamsResponder( |
| 391 var result = new ViewOwnerGetTokenResponseParams(); | 403 int requestId) { |
| 392 result.token = token; | 404 return (ViewToken token) { |
| 393 return result; | 405 var result = new ViewOwnerGetTokenResponseParams(); |
| 406 result.token = token; |
| 407 sendResponse(buildResponseWithId( |
| 408 result, |
| 409 _viewOwnerMethodGetTokenName, |
| 410 requestId, |
| 411 bindings.MessageHeader.kMessageIsResponse)); |
| 412 }; |
| 394 } | 413 } |
| 395 | 414 |
| 396 dynamic handleMessage(bindings.ServiceMessage message) { | 415 void handleMessage(bindings.ServiceMessage message) { |
| 397 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 416 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 398 return bindings.ControlMessageHandler.handleMessage(this, | 417 bindings.ControlMessageHandler.handleMessage( |
| 399 0, | 418 this, 0, message); |
| 400 message); | 419 return; |
| 401 } | 420 } |
| 402 if (_impl == null) { | 421 if (_impl == null) { |
| 403 throw new core.MojoApiError("$this has no implementation set"); | 422 throw new core.MojoApiError("$this has no implementation set"); |
| 404 } | 423 } |
| 405 switch (message.header.type) { | 424 switch (message.header.type) { |
| 406 case _viewOwnerMethodGetTokenName: | 425 case _viewOwnerMethodGetTokenName: |
| 407 var response = _impl.getToken(_viewOwnerGetTokenResponseParamsFactory); | 426 _impl.getToken(_viewOwnerGetTokenResponseParamsResponder(message.header.
requestId)); |
| 408 if (response is Future) { | |
| 409 return response.then((response) { | |
| 410 if (response != null) { | |
| 411 return buildResponseWithId( | |
| 412 response, | |
| 413 _viewOwnerMethodGetTokenName, | |
| 414 message.header.requestId, | |
| 415 bindings.MessageHeader.kMessageIsResponse); | |
| 416 } | |
| 417 }); | |
| 418 } else if (response != null) { | |
| 419 return buildResponseWithId( | |
| 420 response, | |
| 421 _viewOwnerMethodGetTokenName, | |
| 422 message.header.requestId, | |
| 423 bindings.MessageHeader.kMessageIsResponse); | |
| 424 } | |
| 425 break; | 427 break; |
| 426 default: | 428 default: |
| 427 throw new bindings.MojoCodecError("Unexpected message name"); | 429 throw new bindings.MojoCodecError("Unexpected message name"); |
| 428 break; | 430 break; |
| 429 } | 431 } |
| 430 return null; | |
| 431 } | 432 } |
| 432 | 433 |
| 433 ViewOwner get impl => _impl; | 434 ViewOwner get impl => _impl; |
| 434 set impl(ViewOwner d) { | 435 set impl(ViewOwner d) { |
| 435 if (d == null) { | 436 if (d == null) { |
| 436 throw new core.MojoApiError("$this: Cannot set a null implementation"); | 437 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 437 } | 438 } |
| 438 if (isBound && (_impl == null)) { | 439 if (isBound && (_impl == null)) { |
| 439 beginHandlingEvents(); | 440 beginHandlingEvents(); |
| 440 } | 441 } |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 core.MojoHandle handle, [ViewOwner impl]) | 475 core.MojoHandle handle, [ViewOwner impl]) |
| 475 : super(new _ViewOwnerStubControl.fromHandle(handle, impl)); | 476 : super(new _ViewOwnerStubControl.fromHandle(handle, impl)); |
| 476 | 477 |
| 477 static ViewOwnerStub newFromEndpoint( | 478 static ViewOwnerStub newFromEndpoint( |
| 478 core.MojoMessagePipeEndpoint endpoint) { | 479 core.MojoMessagePipeEndpoint endpoint) { |
| 479 assert(endpoint.setDescription("For ViewOwnerStub")); | 480 assert(endpoint.setDescription("For ViewOwnerStub")); |
| 480 return new ViewOwnerStub.fromEndpoint(endpoint); | 481 return new ViewOwnerStub.fromEndpoint(endpoint); |
| 481 } | 482 } |
| 482 | 483 |
| 483 | 484 |
| 484 dynamic getToken([Function responseFactory = null]) { | 485 void getToken(void callback(ViewToken token)) { |
| 485 return impl.getToken(responseFactory); | 486 return impl.getToken(callback); |
| 486 } | 487 } |
| 487 } | 488 } |
| 488 | 489 |
| 489 | 490 |
| 490 | 491 |
| OLD | NEW |