| 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 serialization_test_structs_mojom; | 4 library serialization_test_structs_mojom; |
| 5 import 'dart:collection'; | 5 import 'dart:collection'; |
| 6 import 'dart:convert'; | 6 import 'dart:convert'; |
| 7 import 'dart:io'; | 7 import 'dart:io'; |
| 8 import 'dart:typed_data'; | 8 import 'dart:typed_data'; |
| 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; | 11 import 'package:mojo/mojo/bindings/types/mojom_types.mojom.dart' as mojom_types; |
| 12 | 12 |
| 13 | 13 |
| 14 | 14 |
| 15 | 15 |
| 16 class Struct1 extends bindings.Struct { | 16 class Struct1 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 int i = 0; | 20 int i = 0; |
| 21 | 21 |
| 22 Struct1() : super(kVersions.last.size); | 22 Struct1() : super(kVersions.last.size); |
| 23 | 23 |
| 24 Struct1.init( |
| 25 int this.i |
| 26 ) : super(kVersions.last.size); |
| 27 |
| 24 static Struct1 deserialize(bindings.Message message) { | 28 static Struct1 deserialize(bindings.Message message) { |
| 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 Struct1 decode(bindings.Decoder decoder0) { | 37 static Struct1 decode(bindings.Decoder decoder0) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 90 |
| 87 | 91 |
| 88 class Struct2 extends bindings.Struct { | 92 class Struct2 extends bindings.Struct { |
| 89 static const List<bindings.StructDataHeader> kVersions = const [ | 93 static const List<bindings.StructDataHeader> kVersions = const [ |
| 90 const bindings.StructDataHeader(16, 0) | 94 const bindings.StructDataHeader(16, 0) |
| 91 ]; | 95 ]; |
| 92 core.MojoHandle hdl = null; | 96 core.MojoHandle hdl = null; |
| 93 | 97 |
| 94 Struct2() : super(kVersions.last.size); | 98 Struct2() : super(kVersions.last.size); |
| 95 | 99 |
| 100 Struct2.init( |
| 101 core.MojoHandle this.hdl |
| 102 ) : super(kVersions.last.size); |
| 103 |
| 96 static Struct2 deserialize(bindings.Message message) { | 104 static Struct2 deserialize(bindings.Message message) { |
| 97 var decoder = new bindings.Decoder(message); | 105 var decoder = new bindings.Decoder(message); |
| 98 var result = decode(decoder); | 106 var result = decode(decoder); |
| 99 if (decoder.excessHandles != null) { | 107 if (decoder.excessHandles != null) { |
| 100 decoder.excessHandles.forEach((h) => h.close()); | 108 decoder.excessHandles.forEach((h) => h.close()); |
| 101 } | 109 } |
| 102 return result; | 110 return result; |
| 103 } | 111 } |
| 104 | 112 |
| 105 static Struct2 decode(bindings.Decoder decoder0) { | 113 static Struct2 decode(bindings.Decoder decoder0) { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 | 165 |
| 158 | 166 |
| 159 class Struct3 extends bindings.Struct { | 167 class Struct3 extends bindings.Struct { |
| 160 static const List<bindings.StructDataHeader> kVersions = const [ | 168 static const List<bindings.StructDataHeader> kVersions = const [ |
| 161 const bindings.StructDataHeader(16, 0) | 169 const bindings.StructDataHeader(16, 0) |
| 162 ]; | 170 ]; |
| 163 Struct1 struct1 = null; | 171 Struct1 struct1 = null; |
| 164 | 172 |
| 165 Struct3() : super(kVersions.last.size); | 173 Struct3() : super(kVersions.last.size); |
| 166 | 174 |
| 175 Struct3.init( |
| 176 Struct1 this.struct1 |
| 177 ) : super(kVersions.last.size); |
| 178 |
| 167 static Struct3 deserialize(bindings.Message message) { | 179 static Struct3 deserialize(bindings.Message message) { |
| 168 var decoder = new bindings.Decoder(message); | 180 var decoder = new bindings.Decoder(message); |
| 169 var result = decode(decoder); | 181 var result = decode(decoder); |
| 170 if (decoder.excessHandles != null) { | 182 if (decoder.excessHandles != null) { |
| 171 decoder.excessHandles.forEach((h) => h.close()); | 183 decoder.excessHandles.forEach((h) => h.close()); |
| 172 } | 184 } |
| 173 return result; | 185 return result; |
| 174 } | 186 } |
| 175 | 187 |
| 176 static Struct3 decode(bindings.Decoder decoder0) { | 188 static Struct3 decode(bindings.Decoder decoder0) { |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 | 242 |
| 231 | 243 |
| 232 class Struct4 extends bindings.Struct { | 244 class Struct4 extends bindings.Struct { |
| 233 static const List<bindings.StructDataHeader> kVersions = const [ | 245 static const List<bindings.StructDataHeader> kVersions = const [ |
| 234 const bindings.StructDataHeader(16, 0) | 246 const bindings.StructDataHeader(16, 0) |
| 235 ]; | 247 ]; |
| 236 List<Struct1> data = null; | 248 List<Struct1> data = null; |
| 237 | 249 |
| 238 Struct4() : super(kVersions.last.size); | 250 Struct4() : super(kVersions.last.size); |
| 239 | 251 |
| 252 Struct4.init( |
| 253 List<Struct1> this.data |
| 254 ) : super(kVersions.last.size); |
| 255 |
| 240 static Struct4 deserialize(bindings.Message message) { | 256 static Struct4 deserialize(bindings.Message message) { |
| 241 var decoder = new bindings.Decoder(message); | 257 var decoder = new bindings.Decoder(message); |
| 242 var result = decode(decoder); | 258 var result = decode(decoder); |
| 243 if (decoder.excessHandles != null) { | 259 if (decoder.excessHandles != null) { |
| 244 decoder.excessHandles.forEach((h) => h.close()); | 260 decoder.excessHandles.forEach((h) => h.close()); |
| 245 } | 261 } |
| 246 return result; | 262 return result; |
| 247 } | 263 } |
| 248 | 264 |
| 249 static Struct4 decode(bindings.Decoder decoder0) { | 265 static Struct4 decode(bindings.Decoder decoder0) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 334 |
| 319 | 335 |
| 320 class Struct5 extends bindings.Struct { | 336 class Struct5 extends bindings.Struct { |
| 321 static const List<bindings.StructDataHeader> kVersions = const [ | 337 static const List<bindings.StructDataHeader> kVersions = const [ |
| 322 const bindings.StructDataHeader(16, 0) | 338 const bindings.StructDataHeader(16, 0) |
| 323 ]; | 339 ]; |
| 324 List<Struct1> pair = null; | 340 List<Struct1> pair = null; |
| 325 | 341 |
| 326 Struct5() : super(kVersions.last.size); | 342 Struct5() : super(kVersions.last.size); |
| 327 | 343 |
| 344 Struct5.init( |
| 345 List<Struct1> this.pair |
| 346 ) : super(kVersions.last.size); |
| 347 |
| 328 static Struct5 deserialize(bindings.Message message) { | 348 static Struct5 deserialize(bindings.Message message) { |
| 329 var decoder = new bindings.Decoder(message); | 349 var decoder = new bindings.Decoder(message); |
| 330 var result = decode(decoder); | 350 var result = decode(decoder); |
| 331 if (decoder.excessHandles != null) { | 351 if (decoder.excessHandles != null) { |
| 332 decoder.excessHandles.forEach((h) => h.close()); | 352 decoder.excessHandles.forEach((h) => h.close()); |
| 333 } | 353 } |
| 334 return result; | 354 return result; |
| 335 } | 355 } |
| 336 | 356 |
| 337 static Struct5 decode(bindings.Decoder decoder0) { | 357 static Struct5 decode(bindings.Decoder decoder0) { |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 | 426 |
| 407 | 427 |
| 408 class Struct6 extends bindings.Struct { | 428 class Struct6 extends bindings.Struct { |
| 409 static const List<bindings.StructDataHeader> kVersions = const [ | 429 static const List<bindings.StructDataHeader> kVersions = const [ |
| 410 const bindings.StructDataHeader(16, 0) | 430 const bindings.StructDataHeader(16, 0) |
| 411 ]; | 431 ]; |
| 412 String str = null; | 432 String str = null; |
| 413 | 433 |
| 414 Struct6() : super(kVersions.last.size); | 434 Struct6() : super(kVersions.last.size); |
| 415 | 435 |
| 436 Struct6.init( |
| 437 String this.str |
| 438 ) : super(kVersions.last.size); |
| 439 |
| 416 static Struct6 deserialize(bindings.Message message) { | 440 static Struct6 deserialize(bindings.Message message) { |
| 417 var decoder = new bindings.Decoder(message); | 441 var decoder = new bindings.Decoder(message); |
| 418 var result = decode(decoder); | 442 var result = decode(decoder); |
| 419 if (decoder.excessHandles != null) { | 443 if (decoder.excessHandles != null) { |
| 420 decoder.excessHandles.forEach((h) => h.close()); | 444 decoder.excessHandles.forEach((h) => h.close()); |
| 421 } | 445 } |
| 422 return result; | 446 return result; |
| 423 } | 447 } |
| 424 | 448 |
| 425 static Struct6 decode(bindings.Decoder decoder0) { | 449 static Struct6 decode(bindings.Decoder decoder0) { |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 class StructOfNullables extends bindings.Struct { | 504 class StructOfNullables extends bindings.Struct { |
| 481 static const List<bindings.StructDataHeader> kVersions = const [ | 505 static const List<bindings.StructDataHeader> kVersions = const [ |
| 482 const bindings.StructDataHeader(32, 0) | 506 const bindings.StructDataHeader(32, 0) |
| 483 ]; | 507 ]; |
| 484 core.MojoHandle hdl = null; | 508 core.MojoHandle hdl = null; |
| 485 Struct1 struct1 = null; | 509 Struct1 struct1 = null; |
| 486 String str = null; | 510 String str = null; |
| 487 | 511 |
| 488 StructOfNullables() : super(kVersions.last.size); | 512 StructOfNullables() : super(kVersions.last.size); |
| 489 | 513 |
| 514 StructOfNullables.init( |
| 515 core.MojoHandle this.hdl, |
| 516 Struct1 this.struct1, |
| 517 String this.str |
| 518 ) : super(kVersions.last.size); |
| 519 |
| 490 static StructOfNullables deserialize(bindings.Message message) { | 520 static StructOfNullables deserialize(bindings.Message message) { |
| 491 var decoder = new bindings.Decoder(message); | 521 var decoder = new bindings.Decoder(message); |
| 492 var result = decode(decoder); | 522 var result = decode(decoder); |
| 493 if (decoder.excessHandles != null) { | 523 if (decoder.excessHandles != null) { |
| 494 decoder.excessHandles.forEach((h) => h.close()); | 524 decoder.excessHandles.forEach((h) => h.close()); |
| 495 } | 525 } |
| 496 return result; | 526 return result; |
| 497 } | 527 } |
| 498 | 528 |
| 499 static StructOfNullables decode(bindings.Decoder decoder0) { | 529 static StructOfNullables decode(bindings.Decoder decoder0) { |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 580 | 610 |
| 581 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { | 611 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { |
| 582 return getRuntimeTypeInfo().typeMap; | 612 return getRuntimeTypeInfo().typeMap; |
| 583 } | 613 } |
| 584 | 614 |
| 585 var _runtimeTypeInfo; | 615 var _runtimeTypeInfo; |
| 586 mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() { | 616 mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() { |
| 587 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of | 617 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of |
| 588 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this | 618 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this |
| 589 // file. The string contains the base64 encoding of the gzip-compressed bytes. | 619 // file. The string contains the base64 encoding of the gzip-compressed bytes. |
| 590 var serializedRuntimeTypeInfo = "H4sIAAAJbogC/+yYzW7TQBDHbbdV3NKqQQLJ5UMKLYccU
NzmSxUnLpUqIQESHOjJOInbLHLsyOtIiBOPwJFH4MiRR+mjcIPdeqyuF0/kxvgDwUqj8Vpje/yfn2c3M
ZRoNMEfgpfPx16XvBw3VSP/jFmD2TGcfwv+A/gv4L+Dv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4OjdD+X/jz4HrhUhvuKEJCxD1XUzRw
PcH1ENDf+ShiwAjccsqYoE7PULnkx4lLiLj0AvOsOsx1CPjPhkPGBLfyxDzAoIpucAh8cddca7Lprmwi
rjBKK5vLq5HS8mzkEs2THrmJD2FPzJcvw35EINe25BrVvQqSblbUp4m7jor4a5q5K5q0HF3A7i7Ij631
sPdVW5boi/1qVavPWAvTb3ksSyH71bCYc3IYW3OOp11DvNr5LAY9bdppt1jVS+h7U6KepU1+cp1VdfDp
PuiZXn+sBKe60ae6waeb2wAz/Yaed6FPt7HIdbpdRP0zQLP4ll+/t4V3v4P3htG3hsG3kuXvGt5P8ck0
Om1Dz0iC7zb8vqWcd5Xs29uGnlvGni/swG8Wynsm3mmWr3u/iP75iPQs5Sfr1tH4fCVQbeIO+2fJXwcc
rut4VKNVPUup8xnGXiI8mob1qusvufdS3l/XZRYXOR9xFlAL2uJ95ED0DTt9cz6y+vVn/bV4gK620v01
cOMcTqvr25JdfoRAAD//xj2NYbAFwAA"; |
| 591 | 621 |
| 592 // Deserialize RuntimeTypeInfo | 622 // Deserialize RuntimeTypeInfo |
| 593 var bytes = BASE64.decode(serializedRuntimeTypeInfo); | 623 var bytes = BASE64.decode(serializedRuntimeTypeInfo); |
| 594 var unzippedBytes = new ZLibDecoder().convert(bytes); | 624 var unzippedBytes = new ZLibDecoder().convert(bytes); |
| 595 var bdata = new ByteData.view(unzippedBytes.buffer); | 625 var bdata = new ByteData.view(unzippedBytes.buffer); |
| 596 var message = new bindings.Message(bdata, null, unzippedBytes.length, 0); | 626 var message = new bindings.Message(bdata, null, unzippedBytes.length, 0); |
| 597 _runtimeTypeInfo = mojom_types.RuntimeTypeInfo.deserialize(message); | 627 _runtimeTypeInfo = mojom_types.RuntimeTypeInfo.deserialize(message); |
| 598 return _runtimeTypeInfo; | 628 return _runtimeTypeInfo; |
| 599 } | 629 } |
| OLD | NEW |