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 math_calculator_mojom; | 5 library math_calculator_mojom; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; |
8 | 9 |
9 import 'package:mojo/bindings.dart' as bindings; | 10 import 'package:mojo/bindings.dart' as bindings; |
10 import 'package:mojo/core.dart' as core; | 11 import 'package:mojo/core.dart' as core; |
| 12 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; |
| 13 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic
e_describer; |
11 | 14 |
12 | 15 |
13 | 16 |
14 class _CalculatorClearParams extends bindings.Struct { | 17 class _CalculatorClearParams extends bindings.Struct { |
15 static const List<bindings.StructDataHeader> kVersions = const [ | 18 static const List<bindings.StructDataHeader> kVersions = const [ |
16 const bindings.StructDataHeader(8, 0) | 19 const bindings.StructDataHeader(8, 0) |
17 ]; | 20 ]; |
18 | 21 |
19 _CalculatorClearParams() : super(kVersions.last.size); | 22 _CalculatorClearParams() : super(kVersions.last.size); |
20 | 23 |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 String toString() { | 64 String toString() { |
62 return "_CalculatorClearParams("")"; | 65 return "_CalculatorClearParams("")"; |
63 } | 66 } |
64 | 67 |
65 Map toJson() { | 68 Map toJson() { |
66 Map map = new Map(); | 69 Map map = new Map(); |
67 return map; | 70 return map; |
68 } | 71 } |
69 } | 72 } |
70 | 73 |
| 74 mojom_types.MojomStruct _mathCalculatorCalculatorClearParams() { |
| 75 return new mojom_types.MojomStruct() |
| 76 ..declData = (new mojom_types.DeclarationData() |
| 77 ..shortName = 'CalculatorClearParams' |
| 78 ..fullIdentifier = 'math.Calculator_Clear_Params') |
| 79 ..fields = <mojom_types.StructField>[]; |
| 80 } |
| 81 |
71 | 82 |
72 class CalculatorClearResponseParams extends bindings.Struct { | 83 class CalculatorClearResponseParams extends bindings.Struct { |
73 static const List<bindings.StructDataHeader> kVersions = const [ | 84 static const List<bindings.StructDataHeader> kVersions = const [ |
74 const bindings.StructDataHeader(16, 0) | 85 const bindings.StructDataHeader(16, 0) |
75 ]; | 86 ]; |
76 double value = 0.0; | 87 double value = 0.0; |
77 | 88 |
78 CalculatorClearResponseParams() : super(kVersions.last.size); | 89 CalculatorClearResponseParams() : super(kVersions.last.size); |
79 | 90 |
80 static CalculatorClearResponseParams deserialize(bindings.Message message) { | 91 static CalculatorClearResponseParams deserialize(bindings.Message message) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 "value: $value" ")"; | 139 "value: $value" ")"; |
129 } | 140 } |
130 | 141 |
131 Map toJson() { | 142 Map toJson() { |
132 Map map = new Map(); | 143 Map map = new Map(); |
133 map["value"] = value; | 144 map["value"] = value; |
134 return map; | 145 return map; |
135 } | 146 } |
136 } | 147 } |
137 | 148 |
| 149 mojom_types.MojomStruct _mathCalculatorCalculatorClearResponseParams() { |
| 150 return new mojom_types.MojomStruct() |
| 151 ..declData = (new mojom_types.DeclarationData() |
| 152 ..shortName = 'CalculatorClearResponseParams' |
| 153 ..fullIdentifier = 'math.Calculator_Clear_ResponseParams') |
| 154 ..fields = <mojom_types.StructField>[ |
| 155 new mojom_types.StructField() |
| 156 ..declData = (new mojom_types.DeclarationData() |
| 157 ..shortName = 'Value') |
| 158 ..type = (new mojom_types.Type() |
| 159 ..simpleType = mojom_types.SimpleType.double),]; |
| 160 } |
| 161 |
138 | 162 |
139 class _CalculatorAddParams extends bindings.Struct { | 163 class _CalculatorAddParams extends bindings.Struct { |
140 static const List<bindings.StructDataHeader> kVersions = const [ | 164 static const List<bindings.StructDataHeader> kVersions = const [ |
141 const bindings.StructDataHeader(16, 0) | 165 const bindings.StructDataHeader(16, 0) |
142 ]; | 166 ]; |
143 double value = 0.0; | 167 double value = 0.0; |
144 | 168 |
145 _CalculatorAddParams() : super(kVersions.last.size); | 169 _CalculatorAddParams() : super(kVersions.last.size); |
146 | 170 |
147 static _CalculatorAddParams deserialize(bindings.Message message) { | 171 static _CalculatorAddParams deserialize(bindings.Message message) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 "value: $value" ")"; | 219 "value: $value" ")"; |
196 } | 220 } |
197 | 221 |
198 Map toJson() { | 222 Map toJson() { |
199 Map map = new Map(); | 223 Map map = new Map(); |
200 map["value"] = value; | 224 map["value"] = value; |
201 return map; | 225 return map; |
202 } | 226 } |
203 } | 227 } |
204 | 228 |
| 229 mojom_types.MojomStruct _mathCalculatorCalculatorAddParams() { |
| 230 return new mojom_types.MojomStruct() |
| 231 ..declData = (new mojom_types.DeclarationData() |
| 232 ..shortName = 'CalculatorAddParams' |
| 233 ..fullIdentifier = 'math.Calculator_Add_Params') |
| 234 ..fields = <mojom_types.StructField>[ |
| 235 new mojom_types.StructField() |
| 236 ..declData = (new mojom_types.DeclarationData() |
| 237 ..shortName = 'Value') |
| 238 ..type = (new mojom_types.Type() |
| 239 ..simpleType = mojom_types.SimpleType.double),]; |
| 240 } |
| 241 |
205 | 242 |
206 class CalculatorAddResponseParams extends bindings.Struct { | 243 class CalculatorAddResponseParams extends bindings.Struct { |
207 static const List<bindings.StructDataHeader> kVersions = const [ | 244 static const List<bindings.StructDataHeader> kVersions = const [ |
208 const bindings.StructDataHeader(16, 0) | 245 const bindings.StructDataHeader(16, 0) |
209 ]; | 246 ]; |
210 double value = 0.0; | 247 double value = 0.0; |
211 | 248 |
212 CalculatorAddResponseParams() : super(kVersions.last.size); | 249 CalculatorAddResponseParams() : super(kVersions.last.size); |
213 | 250 |
214 static CalculatorAddResponseParams deserialize(bindings.Message message) { | 251 static CalculatorAddResponseParams deserialize(bindings.Message message) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 "value: $value" ")"; | 299 "value: $value" ")"; |
263 } | 300 } |
264 | 301 |
265 Map toJson() { | 302 Map toJson() { |
266 Map map = new Map(); | 303 Map map = new Map(); |
267 map["value"] = value; | 304 map["value"] = value; |
268 return map; | 305 return map; |
269 } | 306 } |
270 } | 307 } |
271 | 308 |
| 309 mojom_types.MojomStruct _mathCalculatorCalculatorAddResponseParams() { |
| 310 return new mojom_types.MojomStruct() |
| 311 ..declData = (new mojom_types.DeclarationData() |
| 312 ..shortName = 'CalculatorAddResponseParams' |
| 313 ..fullIdentifier = 'math.Calculator_Add_ResponseParams') |
| 314 ..fields = <mojom_types.StructField>[ |
| 315 new mojom_types.StructField() |
| 316 ..declData = (new mojom_types.DeclarationData() |
| 317 ..shortName = 'Value') |
| 318 ..type = (new mojom_types.Type() |
| 319 ..simpleType = mojom_types.SimpleType.double),]; |
| 320 } |
| 321 |
272 | 322 |
273 class _CalculatorMultiplyParams extends bindings.Struct { | 323 class _CalculatorMultiplyParams extends bindings.Struct { |
274 static const List<bindings.StructDataHeader> kVersions = const [ | 324 static const List<bindings.StructDataHeader> kVersions = const [ |
275 const bindings.StructDataHeader(16, 0) | 325 const bindings.StructDataHeader(16, 0) |
276 ]; | 326 ]; |
277 double value = 0.0; | 327 double value = 0.0; |
278 | 328 |
279 _CalculatorMultiplyParams() : super(kVersions.last.size); | 329 _CalculatorMultiplyParams() : super(kVersions.last.size); |
280 | 330 |
281 static _CalculatorMultiplyParams deserialize(bindings.Message message) { | 331 static _CalculatorMultiplyParams deserialize(bindings.Message message) { |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 "value: $value" ")"; | 379 "value: $value" ")"; |
330 } | 380 } |
331 | 381 |
332 Map toJson() { | 382 Map toJson() { |
333 Map map = new Map(); | 383 Map map = new Map(); |
334 map["value"] = value; | 384 map["value"] = value; |
335 return map; | 385 return map; |
336 } | 386 } |
337 } | 387 } |
338 | 388 |
| 389 mojom_types.MojomStruct _mathCalculatorCalculatorMultiplyParams() { |
| 390 return new mojom_types.MojomStruct() |
| 391 ..declData = (new mojom_types.DeclarationData() |
| 392 ..shortName = 'CalculatorMultiplyParams' |
| 393 ..fullIdentifier = 'math.Calculator_Multiply_Params') |
| 394 ..fields = <mojom_types.StructField>[ |
| 395 new mojom_types.StructField() |
| 396 ..declData = (new mojom_types.DeclarationData() |
| 397 ..shortName = 'Value') |
| 398 ..type = (new mojom_types.Type() |
| 399 ..simpleType = mojom_types.SimpleType.double),]; |
| 400 } |
| 401 |
339 | 402 |
340 class CalculatorMultiplyResponseParams extends bindings.Struct { | 403 class CalculatorMultiplyResponseParams extends bindings.Struct { |
341 static const List<bindings.StructDataHeader> kVersions = const [ | 404 static const List<bindings.StructDataHeader> kVersions = const [ |
342 const bindings.StructDataHeader(16, 0) | 405 const bindings.StructDataHeader(16, 0) |
343 ]; | 406 ]; |
344 double value = 0.0; | 407 double value = 0.0; |
345 | 408 |
346 CalculatorMultiplyResponseParams() : super(kVersions.last.size); | 409 CalculatorMultiplyResponseParams() : super(kVersions.last.size); |
347 | 410 |
348 static CalculatorMultiplyResponseParams deserialize(bindings.Message message)
{ | 411 static CalculatorMultiplyResponseParams deserialize(bindings.Message message)
{ |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 "value: $value" ")"; | 459 "value: $value" ")"; |
397 } | 460 } |
398 | 461 |
399 Map toJson() { | 462 Map toJson() { |
400 Map map = new Map(); | 463 Map map = new Map(); |
401 map["value"] = value; | 464 map["value"] = value; |
402 return map; | 465 return map; |
403 } | 466 } |
404 } | 467 } |
405 | 468 |
| 469 mojom_types.MojomStruct _mathCalculatorCalculatorMultiplyResponseParams() { |
| 470 return new mojom_types.MojomStruct() |
| 471 ..declData = (new mojom_types.DeclarationData() |
| 472 ..shortName = 'CalculatorMultiplyResponseParams' |
| 473 ..fullIdentifier = 'math.Calculator_Multiply_ResponseParams') |
| 474 ..fields = <mojom_types.StructField>[ |
| 475 new mojom_types.StructField() |
| 476 ..declData = (new mojom_types.DeclarationData() |
| 477 ..shortName = 'Value') |
| 478 ..type = (new mojom_types.Type() |
| 479 ..simpleType = mojom_types.SimpleType.double),]; |
| 480 } |
| 481 |
| 482 |
406 const int _Calculator_clearName = 0; | 483 const int _Calculator_clearName = 0; |
407 const int _Calculator_addName = 1; | 484 const int _Calculator_addName = 1; |
408 const int _Calculator_multiplyName = 2; | 485 const int _Calculator_multiplyName = 2; |
409 | 486 |
| 487 mojom_types.MojomInterface _mathCalculatorCalculator() { |
| 488 return new mojom_types.MojomInterface() |
| 489 ..declData = (new mojom_types.DeclarationData() |
| 490 ..shortName = 'Calculator' |
| 491 ..fullIdentifier = 'math.Calculator') |
| 492 ..interfaceName = 'Calculator' |
| 493 ..methods = <int, mojom_types.MojomMethod>{ |
| 494 _Calculator_clearName: new mojom_types.MojomMethod() |
| 495 ..declData = (new mojom_types.DeclarationData() |
| 496 ..shortName = 'Clear') |
| 497 ..ordinal = _Calculator_clearName |
| 498 ..responseParams = _mathCalculatorCalculatorClearResponseParams() |
| 499 ..parameters = _mathCalculatorCalculatorClearParams(), |
| 500 _Calculator_addName: new mojom_types.MojomMethod() |
| 501 ..declData = (new mojom_types.DeclarationData() |
| 502 ..shortName = 'Add') |
| 503 ..ordinal = _Calculator_addName |
| 504 ..responseParams = _mathCalculatorCalculatorAddResponseParams() |
| 505 ..parameters = _mathCalculatorCalculatorAddParams(), |
| 506 _Calculator_multiplyName: new mojom_types.MojomMethod() |
| 507 ..declData = (new mojom_types.DeclarationData() |
| 508 ..shortName = 'Multiply') |
| 509 ..ordinal = _Calculator_multiplyName |
| 510 ..responseParams = _mathCalculatorCalculatorMultiplyResponseParams() |
| 511 ..parameters = _mathCalculatorCalculatorMultiplyParams(), |
| 512 }; |
| 513 } |
| 514 |
| 515 class _CalculatorServiceDescription implements service_describer.ServiceDescript
ion { |
| 516 dynamic getTopLevelInterface([Function responseFactory]) => |
| 517 _mathCalculatorCalculator(); |
| 518 |
| 519 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
| 520 getAllMojomTypeDefinitions()[typeKey]; |
| 521 |
| 522 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 523 getAllMojomTypeDefinitions(); |
| 524 } |
| 525 |
410 abstract class Calculator { | 526 abstract class Calculator { |
411 static const String serviceName = null; | 527 static const String serviceName = null; |
412 dynamic clear([Function responseFactory = null]); | 528 dynamic clear([Function responseFactory = null]); |
413 dynamic add(double value,[Function responseFactory = null]); | 529 dynamic add(double value,[Function responseFactory = null]); |
414 dynamic multiply(double value,[Function responseFactory = null]); | 530 dynamic multiply(double value,[Function responseFactory = null]); |
415 } | 531 } |
416 | 532 |
417 | 533 |
418 class _CalculatorProxyImpl extends bindings.Proxy { | 534 class _CalculatorProxyImpl extends bindings.Proxy { |
419 _CalculatorProxyImpl.fromEndpoint( | 535 _CalculatorProxyImpl.fromEndpoint( |
420 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 536 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
421 | 537 |
422 _CalculatorProxyImpl.fromHandle(core.MojoHandle handle) : | 538 _CalculatorProxyImpl.fromHandle(core.MojoHandle handle) : |
423 super.fromHandle(handle); | 539 super.fromHandle(handle); |
424 | 540 |
425 _CalculatorProxyImpl.unbound() : super.unbound(); | 541 _CalculatorProxyImpl.unbound() : super.unbound(); |
426 | 542 |
427 static _CalculatorProxyImpl newFromEndpoint( | 543 static _CalculatorProxyImpl newFromEndpoint( |
428 core.MojoMessagePipeEndpoint endpoint) { | 544 core.MojoMessagePipeEndpoint endpoint) { |
429 assert(endpoint.setDescription("For _CalculatorProxyImpl")); | 545 assert(endpoint.setDescription("For _CalculatorProxyImpl")); |
430 return new _CalculatorProxyImpl.fromEndpoint(endpoint); | 546 return new _CalculatorProxyImpl.fromEndpoint(endpoint); |
431 } | 547 } |
432 | 548 |
| 549 service_describer.ServiceDescription get serviceDescription => |
| 550 new _CalculatorServiceDescription(); |
| 551 |
433 void handleResponse(bindings.ServiceMessage message) { | 552 void handleResponse(bindings.ServiceMessage message) { |
434 switch (message.header.type) { | 553 switch (message.header.type) { |
435 case _Calculator_clearName: | 554 case _Calculator_clearName: |
436 var r = CalculatorClearResponseParams.deserialize( | 555 var r = CalculatorClearResponseParams.deserialize( |
437 message.payload); | 556 message.payload); |
438 if (!message.header.hasRequestId) { | 557 if (!message.header.hasRequestId) { |
439 proxyError("Expected a message with a valid request Id."); | 558 proxyError("Expected a message with a valid request Id."); |
440 return; | 559 return; |
441 } | 560 } |
442 Completer c = completerMap[message.header.requestId]; | 561 Completer c = completerMap[message.header.requestId]; |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
719 assert(_impl == null); | 838 assert(_impl == null); |
720 _impl = d; | 839 _impl = d; |
721 } | 840 } |
722 | 841 |
723 String toString() { | 842 String toString() { |
724 var superString = super.toString(); | 843 var superString = super.toString(); |
725 return "CalculatorStub($superString)"; | 844 return "CalculatorStub($superString)"; |
726 } | 845 } |
727 | 846 |
728 int get version => 0; | 847 int get version => 0; |
| 848 |
| 849 service_describer.ServiceDescription get serviceDescription => |
| 850 new _CalculatorServiceDescription(); |
729 } | 851 } |
730 | 852 |
731 | 853 |
| 854 Map<String, mojom_types.UserDefinedType> _initDescriptions() { |
| 855 var map = new HashMap<String, mojom_types.UserDefinedType>(); |
| 856 map["math_calculator_Calculator_Clear_Params__"] = |
| 857 new mojom_types.UserDefinedType() |
| 858 ..structType = _mathCalculatorCalculatorClearParams(); |
| 859 map["math_calculator_Calculator_Clear_ResponseParams__"] = |
| 860 new mojom_types.UserDefinedType() |
| 861 ..structType = _mathCalculatorCalculatorClearResponseParams(); |
| 862 map["math_calculator_Calculator_Add_Params__"] = |
| 863 new mojom_types.UserDefinedType() |
| 864 ..structType = _mathCalculatorCalculatorAddParams(); |
| 865 map["math_calculator_Calculator_Add_ResponseParams__"] = |
| 866 new mojom_types.UserDefinedType() |
| 867 ..structType = _mathCalculatorCalculatorAddResponseParams(); |
| 868 map["math_calculator_Calculator_Multiply_Params__"] = |
| 869 new mojom_types.UserDefinedType() |
| 870 ..structType = _mathCalculatorCalculatorMultiplyParams(); |
| 871 map["math_calculator_Calculator_Multiply_ResponseParams__"] = |
| 872 new mojom_types.UserDefinedType() |
| 873 ..structType = _mathCalculatorCalculatorMultiplyResponseParams(); |
| 874 map["math_calculator_Calculator__"] = |
| 875 new mojom_types.UserDefinedType() |
| 876 ..interfaceType = _mathCalculatorCalculator(); |
| 877 return map; |
| 878 } |
| 879 |
| 880 var _mojomDesc; |
| 881 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
| 882 if (_mojomDesc == null) { |
| 883 _mojomDesc = _initDescriptions(); |
| 884 } |
| 885 return _mojomDesc; |
| 886 } |
| 887 |
OLD | NEW |