Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/media/media_pipe.mojom.dart

Issue 1539673003: Generate Mojom Types in Dart (Take 2) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Merge with master Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 media_pipe_mojom; 5 library media_pipe_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_services/mojo/media/media_common.mojom.dart' as media_commo n_mojom; 13 import 'package:mojo_services/mojo/media/media_common.mojom.dart' as media_commo n_mojom;
12 14
13 15
14 16
15 class MediaPacketRegion extends bindings.Struct { 17 class MediaPacketRegion extends bindings.Struct {
16 static const List<bindings.StructDataHeader> kVersions = const [ 18 static const List<bindings.StructDataHeader> kVersions = const [
17 const bindings.StructDataHeader(24, 0) 19 const bindings.StructDataHeader(24, 0)
18 ]; 20 ];
19 int offset = 0; 21 int offset = 0;
20 int length = 0; 22 int length = 0;
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 83
82 Map toJson() { 84 Map toJson() {
83 Map map = new Map(); 85 Map map = new Map();
84 map["offset"] = offset; 86 map["offset"] = offset;
85 map["length"] = length; 87 map["length"] = length;
86 return map; 88 return map;
87 } 89 }
88 } 90 }
89 91
90 92
93
94
91 class MediaPacket extends bindings.Struct { 95 class MediaPacket extends bindings.Struct {
92 static const List<bindings.StructDataHeader> kVersions = const [ 96 static const List<bindings.StructDataHeader> kVersions = const [
93 const bindings.StructDataHeader(48, 0) 97 const bindings.StructDataHeader(48, 0)
94 ]; 98 ];
95 static const int kNoTimestamp = 9223372036854775807; 99 static const int kNoTimestamp = 9223372036854775807;
96 int pts = 9223372036854775807; 100 int pts = 9223372036854775807;
97 int duration = 0; 101 int duration = 0;
98 bool endOfStream = false; 102 bool endOfStream = false;
99 MediaPacketRegion payload = null; 103 MediaPacketRegion payload = null;
100 List<MediaPacketRegion> extraPayload = null; 104 List<MediaPacketRegion> extraPayload = null;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 map["pts"] = pts; 209 map["pts"] = pts;
206 map["duration"] = duration; 210 map["duration"] = duration;
207 map["endOfStream"] = endOfStream; 211 map["endOfStream"] = endOfStream;
208 map["payload"] = payload; 212 map["payload"] = payload;
209 map["extraPayload"] = extraPayload; 213 map["extraPayload"] = extraPayload;
210 return map; 214 return map;
211 } 215 }
212 } 216 }
213 217
214 218
219
220
215 class MediaPipeState extends bindings.Struct { 221 class MediaPipeState extends bindings.Struct {
216 static const List<bindings.StructDataHeader> kVersions = const [ 222 static const List<bindings.StructDataHeader> kVersions = const [
217 const bindings.StructDataHeader(24, 0) 223 const bindings.StructDataHeader(24, 0)
218 ]; 224 ];
219 static const int kMaxPayloadLen = 4611686018427387903; 225 static const int kMaxPayloadLen = 4611686018427387903;
220 core.MojoSharedBuffer payloadBuffer = null; 226 core.MojoSharedBuffer payloadBuffer = null;
221 int payloadBufferLen = 0; 227 int payloadBufferLen = 0;
222 228
223 MediaPipeState() : super(kVersions.last.size); 229 MediaPipeState() : super(kVersions.last.size);
224 230
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 "payloadBufferLen: $payloadBufferLen" ")"; 286 "payloadBufferLen: $payloadBufferLen" ")";
281 } 287 }
282 288
283 Map toJson() { 289 Map toJson() {
284 throw new bindings.MojoCodecError( 290 throw new bindings.MojoCodecError(
285 'Object containing handles cannot be encoded to JSON.'); 291 'Object containing handles cannot be encoded to JSON.');
286 } 292 }
287 } 293 }
288 294
289 295
296
297
290 class _MediaPipeGetStateParams extends bindings.Struct { 298 class _MediaPipeGetStateParams extends bindings.Struct {
291 static const List<bindings.StructDataHeader> kVersions = const [ 299 static const List<bindings.StructDataHeader> kVersions = const [
292 const bindings.StructDataHeader(8, 0) 300 const bindings.StructDataHeader(8, 0)
293 ]; 301 ];
294 302
295 _MediaPipeGetStateParams() : super(kVersions.last.size); 303 _MediaPipeGetStateParams() : super(kVersions.last.size);
296 304
297 static _MediaPipeGetStateParams deserialize(bindings.Message message) { 305 static _MediaPipeGetStateParams deserialize(bindings.Message message) {
298 var decoder = new bindings.Decoder(message); 306 var decoder = new bindings.Decoder(message);
299 var result = decode(decoder); 307 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 return "_MediaPipeGetStateParams("")"; 346 return "_MediaPipeGetStateParams("")";
339 } 347 }
340 348
341 Map toJson() { 349 Map toJson() {
342 Map map = new Map(); 350 Map map = new Map();
343 return map; 351 return map;
344 } 352 }
345 } 353 }
346 354
347 355
356
357
348 class MediaPipeGetStateResponseParams extends bindings.Struct { 358 class MediaPipeGetStateResponseParams extends bindings.Struct {
349 static const List<bindings.StructDataHeader> kVersions = const [ 359 static const List<bindings.StructDataHeader> kVersions = const [
350 const bindings.StructDataHeader(16, 0) 360 const bindings.StructDataHeader(16, 0)
351 ]; 361 ];
352 MediaPipeState state = null; 362 MediaPipeState state = null;
353 363
354 MediaPipeGetStateResponseParams() : super(kVersions.last.size); 364 MediaPipeGetStateResponseParams() : super(kVersions.last.size);
355 365
356 static MediaPipeGetStateResponseParams deserialize(bindings.Message message) { 366 static MediaPipeGetStateResponseParams deserialize(bindings.Message message) {
357 var decoder = new bindings.Decoder(message); 367 var decoder = new bindings.Decoder(message);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 "state: $state" ")"; 415 "state: $state" ")";
406 } 416 }
407 417
408 Map toJson() { 418 Map toJson() {
409 throw new bindings.MojoCodecError( 419 throw new bindings.MojoCodecError(
410 'Object containing handles cannot be encoded to JSON.'); 420 'Object containing handles cannot be encoded to JSON.');
411 } 421 }
412 } 422 }
413 423
414 424
425
426
415 class _MediaPipeSendPacketParams extends bindings.Struct { 427 class _MediaPipeSendPacketParams extends bindings.Struct {
416 static const List<bindings.StructDataHeader> kVersions = const [ 428 static const List<bindings.StructDataHeader> kVersions = const [
417 const bindings.StructDataHeader(16, 0) 429 const bindings.StructDataHeader(16, 0)
418 ]; 430 ];
419 MediaPacket packet = null; 431 MediaPacket packet = null;
420 432
421 _MediaPipeSendPacketParams() : super(kVersions.last.size); 433 _MediaPipeSendPacketParams() : super(kVersions.last.size);
422 434
423 static _MediaPipeSendPacketParams deserialize(bindings.Message message) { 435 static _MediaPipeSendPacketParams deserialize(bindings.Message message) {
424 var decoder = new bindings.Decoder(message); 436 var decoder = new bindings.Decoder(message);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
473 } 485 }
474 486
475 Map toJson() { 487 Map toJson() {
476 Map map = new Map(); 488 Map map = new Map();
477 map["packet"] = packet; 489 map["packet"] = packet;
478 return map; 490 return map;
479 } 491 }
480 } 492 }
481 493
482 494
495
496
483 class MediaPipeSendPacketResponseParams extends bindings.Struct { 497 class MediaPipeSendPacketResponseParams extends bindings.Struct {
484 static const List<bindings.StructDataHeader> kVersions = const [ 498 static const List<bindings.StructDataHeader> kVersions = const [
485 const bindings.StructDataHeader(16, 0) 499 const bindings.StructDataHeader(16, 0)
486 ]; 500 ];
487 MediaPipeSendResult result = null; 501 MediaPipeSendResult result = null;
488 502
489 MediaPipeSendPacketResponseParams() : super(kVersions.last.size); 503 MediaPipeSendPacketResponseParams() : super(kVersions.last.size);
490 504
491 static MediaPipeSendPacketResponseParams deserialize(bindings.Message message) { 505 static MediaPipeSendPacketResponseParams deserialize(bindings.Message message) {
492 var decoder = new bindings.Decoder(message); 506 var decoder = new bindings.Decoder(message);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
544 } 558 }
545 559
546 Map toJson() { 560 Map toJson() {
547 Map map = new Map(); 561 Map map = new Map();
548 map["result"] = result; 562 map["result"] = result;
549 return map; 563 return map;
550 } 564 }
551 } 565 }
552 566
553 567
568
569
554 class _MediaPipeFlushParams extends bindings.Struct { 570 class _MediaPipeFlushParams extends bindings.Struct {
555 static const List<bindings.StructDataHeader> kVersions = const [ 571 static const List<bindings.StructDataHeader> kVersions = const [
556 const bindings.StructDataHeader(8, 0) 572 const bindings.StructDataHeader(8, 0)
557 ]; 573 ];
558 574
559 _MediaPipeFlushParams() : super(kVersions.last.size); 575 _MediaPipeFlushParams() : super(kVersions.last.size);
560 576
561 static _MediaPipeFlushParams deserialize(bindings.Message message) { 577 static _MediaPipeFlushParams deserialize(bindings.Message message) {
562 var decoder = new bindings.Decoder(message); 578 var decoder = new bindings.Decoder(message);
563 var result = decode(decoder); 579 var result = decode(decoder);
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
602 return "_MediaPipeFlushParams("")"; 618 return "_MediaPipeFlushParams("")";
603 } 619 }
604 620
605 Map toJson() { 621 Map toJson() {
606 Map map = new Map(); 622 Map map = new Map();
607 return map; 623 return map;
608 } 624 }
609 } 625 }
610 626
611 627
628
629
612 class MediaPipeFlushResponseParams extends bindings.Struct { 630 class MediaPipeFlushResponseParams extends bindings.Struct {
613 static const List<bindings.StructDataHeader> kVersions = const [ 631 static const List<bindings.StructDataHeader> kVersions = const [
614 const bindings.StructDataHeader(8, 0) 632 const bindings.StructDataHeader(8, 0)
615 ]; 633 ];
616 634
617 MediaPipeFlushResponseParams() : super(kVersions.last.size); 635 MediaPipeFlushResponseParams() : super(kVersions.last.size);
618 636
619 static MediaPipeFlushResponseParams deserialize(bindings.Message message) { 637 static MediaPipeFlushResponseParams deserialize(bindings.Message message) {
620 var decoder = new bindings.Decoder(message); 638 var decoder = new bindings.Decoder(message);
621 var result = decode(decoder); 639 var result = decode(decoder);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
659 String toString() { 677 String toString() {
660 return "MediaPipeFlushResponseParams("")"; 678 return "MediaPipeFlushResponseParams("")";
661 } 679 }
662 680
663 Map toJson() { 681 Map toJson() {
664 Map map = new Map(); 682 Map map = new Map();
665 return map; 683 return map;
666 } 684 }
667 } 685 }
668 686
687
688
689
669 const int _MediaPipe_getStateName = 0; 690 const int _MediaPipe_getStateName = 0;
670 const int _MediaPipe_sendPacketName = 1; 691 const int _MediaPipe_sendPacketName = 1;
671 const int _MediaPipe_flushName = 2; 692 const int _MediaPipe_flushName = 2;
672 693
673 class MediaPipeSendResult extends bindings.MojoEnum { 694 class MediaPipeSendResult extends bindings.MojoEnum {
674 static const MediaPipeSendResult consumed = const MediaPipeSendResult._(0); 695 static const MediaPipeSendResult consumed = const MediaPipeSendResult._(0);
675 static const MediaPipeSendResult flushed = const MediaPipeSendResult._(1); 696 static const MediaPipeSendResult flushed = const MediaPipeSendResult._(1);
676 697
677 const MediaPipeSendResult._(int v) : super(v); 698 const MediaPipeSendResult._(int v) : super(v);
678 699
(...skipping 28 matching lines...) Expand all
707 } 728 }
708 return result; 729 return result;
709 } 730 }
710 731
711 String toString() { 732 String toString() {
712 switch(this) { 733 switch(this) {
713 case consumed: 734 case consumed:
714 return 'MediaPipeSendResult.consumed'; 735 return 'MediaPipeSendResult.consumed';
715 case flushed: 736 case flushed:
716 return 'MediaPipeSendResult.flushed'; 737 return 'MediaPipeSendResult.flushed';
738 default:
739 return null;
717 } 740 }
718 } 741 }
719 742
720 int toJson() => mojoEnumValue; 743 int toJson() => mojoEnumValue;
721 } 744 }
722 745
746
747
748
749
750 class _MediaPipeServiceDescription implements service_describer.ServiceDescripti on {
751 dynamic getTopLevelInterface([Function responseFactory]) => null;
752
753 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => null;
754
755 dynamic getAllTypeDefinitions([Function responseFactory]) => null;
756 }
757
723 abstract class MediaPipe { 758 abstract class MediaPipe {
724 static const String serviceName = null; 759 static const String serviceName = null;
725 dynamic getState([Function responseFactory = null]); 760 dynamic getState([Function responseFactory = null]);
726 dynamic sendPacket(MediaPacket packet,[Function responseFactory = null]); 761 dynamic sendPacket(MediaPacket packet,[Function responseFactory = null]);
727 dynamic flush([Function responseFactory = null]); 762 dynamic flush([Function responseFactory = null]);
728 } 763 }
729 764
730 765
731 class _MediaPipeProxyImpl extends bindings.Proxy { 766 class _MediaPipeProxyImpl extends bindings.Proxy {
732 _MediaPipeProxyImpl.fromEndpoint( 767 _MediaPipeProxyImpl.fromEndpoint(
733 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 768 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
734 769
735 _MediaPipeProxyImpl.fromHandle(core.MojoHandle handle) : 770 _MediaPipeProxyImpl.fromHandle(core.MojoHandle handle) :
736 super.fromHandle(handle); 771 super.fromHandle(handle);
737 772
738 _MediaPipeProxyImpl.unbound() : super.unbound(); 773 _MediaPipeProxyImpl.unbound() : super.unbound();
739 774
740 static _MediaPipeProxyImpl newFromEndpoint( 775 static _MediaPipeProxyImpl newFromEndpoint(
741 core.MojoMessagePipeEndpoint endpoint) { 776 core.MojoMessagePipeEndpoint endpoint) {
742 assert(endpoint.setDescription("For _MediaPipeProxyImpl")); 777 assert(endpoint.setDescription("For _MediaPipeProxyImpl"));
743 return new _MediaPipeProxyImpl.fromEndpoint(endpoint); 778 return new _MediaPipeProxyImpl.fromEndpoint(endpoint);
744 } 779 }
745 780
781 service_describer.ServiceDescription get serviceDescription =>
782 new _MediaPipeServiceDescription();
783
746 void handleResponse(bindings.ServiceMessage message) { 784 void handleResponse(bindings.ServiceMessage message) {
747 switch (message.header.type) { 785 switch (message.header.type) {
748 case _MediaPipe_getStateName: 786 case _MediaPipe_getStateName:
749 var r = MediaPipeGetStateResponseParams.deserialize( 787 var r = MediaPipeGetStateResponseParams.deserialize(
750 message.payload); 788 message.payload);
751 if (!message.header.hasRequestId) { 789 if (!message.header.hasRequestId) {
752 proxyError("Expected a message with a valid request Id."); 790 proxyError("Expected a message with a valid request Id.");
753 return; 791 return;
754 } 792 }
755 Completer c = completerMap[message.header.requestId]; 793 Completer c = completerMap[message.header.requestId];
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 assert(_impl == null); 1068 assert(_impl == null);
1031 _impl = d; 1069 _impl = d;
1032 } 1070 }
1033 1071
1034 String toString() { 1072 String toString() {
1035 var superString = super.toString(); 1073 var superString = super.toString();
1036 return "MediaPipeStub($superString)"; 1074 return "MediaPipeStub($superString)";
1037 } 1075 }
1038 1076
1039 int get version => 0; 1077 int get version => 0;
1078
1079 service_describer.ServiceDescription get serviceDescription =>
1080 new _MediaPipeServiceDescription();
1040 } 1081 }
1041 1082
1042 1083
1084
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698