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

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

Issue 2006093002: Dart: Futures -> Callbacks. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Cleanup Created 4 years, 6 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 tracing_mojom; 5 library tracing_mojom;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'package:mojo/bindings.dart' as bindings; 7 import 'package:mojo/bindings.dart' as bindings;
8 import 'package:mojo/core.dart' as core; 8 import 'package:mojo/core.dart' as core;
9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer; 9 import 'package:mojo/mojo/bindings/types/service_describer.mojom.dart' as servic e_describer;
10 10
11 11
12 12
13 class _TraceProviderStartTracingParams extends bindings.Struct { 13 class _TraceProviderStartTracingParams extends bindings.Struct {
14 static const List<bindings.StructDataHeader> kVersions = const [ 14 static const List<bindings.StructDataHeader> kVersions = const [
15 const bindings.StructDataHeader(24, 0) 15 const bindings.StructDataHeader(24, 0)
16 ]; 16 ];
17 String categories = null; 17 String categories = null;
18 TraceRecorderInterface recorder = null; 18 TraceRecorderInterface recorder = null;
19 19
20 _TraceProviderStartTracingParams() : super(kVersions.last.size); 20 _TraceProviderStartTracingParams() : super(kVersions.last.size);
21 21
22 _TraceProviderStartTracingParams.init(
23 String this.categories,
24 TraceRecorderInterface this.recorder
25 ) : super(kVersions.last.size);
26
22 static _TraceProviderStartTracingParams deserialize(bindings.Message message) { 27 static _TraceProviderStartTracingParams deserialize(bindings.Message message) {
23 var decoder = new bindings.Decoder(message); 28 var decoder = new bindings.Decoder(message);
24 var result = decode(decoder); 29 var result = decode(decoder);
25 if (decoder.excessHandles != null) { 30 if (decoder.excessHandles != null) {
26 decoder.excessHandles.forEach((h) => h.close()); 31 decoder.excessHandles.forEach((h) => h.close());
27 } 32 }
28 return result; 33 return result;
29 } 34 }
30 35
31 static _TraceProviderStartTracingParams decode(bindings.Decoder decoder0) { 36 static _TraceProviderStartTracingParams decode(bindings.Decoder decoder0) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 } 99 }
95 100
96 101
97 class _TraceProviderStopTracingParams extends bindings.Struct { 102 class _TraceProviderStopTracingParams extends bindings.Struct {
98 static const List<bindings.StructDataHeader> kVersions = const [ 103 static const List<bindings.StructDataHeader> kVersions = const [
99 const bindings.StructDataHeader(8, 0) 104 const bindings.StructDataHeader(8, 0)
100 ]; 105 ];
101 106
102 _TraceProviderStopTracingParams() : super(kVersions.last.size); 107 _TraceProviderStopTracingParams() : super(kVersions.last.size);
103 108
109 _TraceProviderStopTracingParams.init(
110 ) : super(kVersions.last.size);
111
104 static _TraceProviderStopTracingParams deserialize(bindings.Message message) { 112 static _TraceProviderStopTracingParams deserialize(bindings.Message message) {
105 var decoder = new bindings.Decoder(message); 113 var decoder = new bindings.Decoder(message);
106 var result = decode(decoder); 114 var result = decode(decoder);
107 if (decoder.excessHandles != null) { 115 if (decoder.excessHandles != null) {
108 decoder.excessHandles.forEach((h) => h.close()); 116 decoder.excessHandles.forEach((h) => h.close());
109 } 117 }
110 return result; 118 return result;
111 } 119 }
112 120
113 static _TraceProviderStopTracingParams decode(bindings.Decoder decoder0) { 121 static _TraceProviderStopTracingParams decode(bindings.Decoder decoder0) {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 161
154 162
155 class _TraceRecorderRecordParams extends bindings.Struct { 163 class _TraceRecorderRecordParams extends bindings.Struct {
156 static const List<bindings.StructDataHeader> kVersions = const [ 164 static const List<bindings.StructDataHeader> kVersions = const [
157 const bindings.StructDataHeader(16, 0) 165 const bindings.StructDataHeader(16, 0)
158 ]; 166 ];
159 String json = null; 167 String json = null;
160 168
161 _TraceRecorderRecordParams() : super(kVersions.last.size); 169 _TraceRecorderRecordParams() : super(kVersions.last.size);
162 170
171 _TraceRecorderRecordParams.init(
172 String this.json
173 ) : super(kVersions.last.size);
174
163 static _TraceRecorderRecordParams deserialize(bindings.Message message) { 175 static _TraceRecorderRecordParams deserialize(bindings.Message message) {
164 var decoder = new bindings.Decoder(message); 176 var decoder = new bindings.Decoder(message);
165 var result = decode(decoder); 177 var result = decode(decoder);
166 if (decoder.excessHandles != null) { 178 if (decoder.excessHandles != null) {
167 decoder.excessHandles.forEach((h) => h.close()); 179 decoder.excessHandles.forEach((h) => h.close());
168 } 180 }
169 return result; 181 return result;
170 } 182 }
171 183
172 static _TraceRecorderRecordParams decode(bindings.Decoder decoder0) { 184 static _TraceRecorderRecordParams decode(bindings.Decoder decoder0) {
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 238
227 class _TraceCollectorStartParams extends bindings.Struct { 239 class _TraceCollectorStartParams extends bindings.Struct {
228 static const List<bindings.StructDataHeader> kVersions = const [ 240 static const List<bindings.StructDataHeader> kVersions = const [
229 const bindings.StructDataHeader(24, 0) 241 const bindings.StructDataHeader(24, 0)
230 ]; 242 ];
231 core.MojoDataPipeProducer stream = null; 243 core.MojoDataPipeProducer stream = null;
232 String categories = null; 244 String categories = null;
233 245
234 _TraceCollectorStartParams() : super(kVersions.last.size); 246 _TraceCollectorStartParams() : super(kVersions.last.size);
235 247
248 _TraceCollectorStartParams.init(
249 core.MojoDataPipeProducer this.stream,
250 String this.categories
251 ) : super(kVersions.last.size);
252
236 static _TraceCollectorStartParams deserialize(bindings.Message message) { 253 static _TraceCollectorStartParams deserialize(bindings.Message message) {
237 var decoder = new bindings.Decoder(message); 254 var decoder = new bindings.Decoder(message);
238 var result = decode(decoder); 255 var result = decode(decoder);
239 if (decoder.excessHandles != null) { 256 if (decoder.excessHandles != null) {
240 decoder.excessHandles.forEach((h) => h.close()); 257 decoder.excessHandles.forEach((h) => h.close());
241 } 258 }
242 return result; 259 return result;
243 } 260 }
244 261
245 static _TraceCollectorStartParams decode(bindings.Decoder decoder0) { 262 static _TraceCollectorStartParams decode(bindings.Decoder decoder0) {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 } 325 }
309 326
310 327
311 class _TraceCollectorStopAndFlushParams extends bindings.Struct { 328 class _TraceCollectorStopAndFlushParams extends bindings.Struct {
312 static const List<bindings.StructDataHeader> kVersions = const [ 329 static const List<bindings.StructDataHeader> kVersions = const [
313 const bindings.StructDataHeader(8, 0) 330 const bindings.StructDataHeader(8, 0)
314 ]; 331 ];
315 332
316 _TraceCollectorStopAndFlushParams() : super(kVersions.last.size); 333 _TraceCollectorStopAndFlushParams() : super(kVersions.last.size);
317 334
335 _TraceCollectorStopAndFlushParams.init(
336 ) : super(kVersions.last.size);
337
318 static _TraceCollectorStopAndFlushParams deserialize(bindings.Message message) { 338 static _TraceCollectorStopAndFlushParams deserialize(bindings.Message message) {
319 var decoder = new bindings.Decoder(message); 339 var decoder = new bindings.Decoder(message);
320 var result = decode(decoder); 340 var result = decode(decoder);
321 if (decoder.excessHandles != null) { 341 if (decoder.excessHandles != null) {
322 decoder.excessHandles.forEach((h) => h.close()); 342 decoder.excessHandles.forEach((h) => h.close());
323 } 343 }
324 return result; 344 return result;
325 } 345 }
326 346
327 static _TraceCollectorStopAndFlushParams decode(bindings.Decoder decoder0) { 347 static _TraceCollectorStopAndFlushParams decode(bindings.Decoder decoder0) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
362 Map toJson() { 382 Map toJson() {
363 Map map = new Map(); 383 Map map = new Map();
364 return map; 384 return map;
365 } 385 }
366 } 386 }
367 387
368 const int _traceProviderMethodStartTracingName = 0; 388 const int _traceProviderMethodStartTracingName = 0;
369 const int _traceProviderMethodStopTracingName = 1; 389 const int _traceProviderMethodStopTracingName = 1;
370 390
371 class _TraceProviderServiceDescription implements service_describer.ServiceDescr iption { 391 class _TraceProviderServiceDescription implements service_describer.ServiceDescr iption {
372 dynamic getTopLevelInterface([Function responseFactory]) => 392 void getTopLevelInterface(Function responder) {
373 responseFactory(null); 393 responder(null);
394 }
374 395
375 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 396 void getTypeDefinition(String typeKey, Function responder) {
376 responseFactory(null); 397 responder(null);
398 }
377 399
378 dynamic getAllTypeDefinitions([Function responseFactory]) => 400 void getAllTypeDefinitions(Function responder) {
379 responseFactory(null); 401 responder(null);
402 }
380 } 403 }
381 404
382 abstract class TraceProvider { 405 abstract class TraceProvider {
383 static const String serviceName = "tracing::TraceProvider"; 406 static const String serviceName = "tracing::TraceProvider";
384 407
385 static service_describer.ServiceDescription _cachedServiceDescription; 408 static service_describer.ServiceDescription _cachedServiceDescription;
386 static service_describer.ServiceDescription get serviceDescription { 409 static service_describer.ServiceDescription get serviceDescription {
387 if (_cachedServiceDescription == null) { 410 if (_cachedServiceDescription == null) {
388 _cachedServiceDescription = new _TraceProviderServiceDescription(); 411 _cachedServiceDescription = new _TraceProviderServiceDescription();
389 } 412 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
534 : super.fromHandle(handle, autoBegin: impl != null) { 557 : super.fromHandle(handle, autoBegin: impl != null) {
535 _impl = impl; 558 _impl = impl;
536 } 559 }
537 560
538 _TraceProviderStubControl.unbound([this._impl]) : super.unbound(); 561 _TraceProviderStubControl.unbound([this._impl]) : super.unbound();
539 562
540 String get serviceName => TraceProvider.serviceName; 563 String get serviceName => TraceProvider.serviceName;
541 564
542 565
543 566
544 dynamic handleMessage(bindings.ServiceMessage message) { 567 void handleMessage(bindings.ServiceMessage message) {
545 if (bindings.ControlMessageHandler.isControlMessage(message)) { 568 if (bindings.ControlMessageHandler.isControlMessage(message)) {
546 return bindings.ControlMessageHandler.handleMessage(this, 569 bindings.ControlMessageHandler.handleMessage(
547 0, 570 this, 0, message);
548 message); 571 return;
549 } 572 }
550 if (_impl == null) { 573 if (_impl == null) {
551 throw new core.MojoApiError("$this has no implementation set"); 574 throw new core.MojoApiError("$this has no implementation set");
552 } 575 }
553 switch (message.header.type) { 576 switch (message.header.type) {
554 case _traceProviderMethodStartTracingName: 577 case _traceProviderMethodStartTracingName:
555 var params = _TraceProviderStartTracingParams.deserialize( 578 var params = _TraceProviderStartTracingParams.deserialize(
556 message.payload); 579 message.payload);
557 _impl.startTracing(params.categories, params.recorder); 580 _impl.startTracing(params.categories, params.recorder);
558 break; 581 break;
559 case _traceProviderMethodStopTracingName: 582 case _traceProviderMethodStopTracingName:
560 _impl.stopTracing(); 583 _impl.stopTracing();
561 break; 584 break;
562 default: 585 default:
563 throw new bindings.MojoCodecError("Unexpected message name"); 586 throw new bindings.MojoCodecError("Unexpected message name");
564 break; 587 break;
565 } 588 }
566 return null;
567 } 589 }
568 590
569 TraceProvider get impl => _impl; 591 TraceProvider get impl => _impl;
570 set impl(TraceProvider d) { 592 set impl(TraceProvider d) {
571 if (d == null) { 593 if (d == null) {
572 throw new core.MojoApiError("$this: Cannot set a null implementation"); 594 throw new core.MojoApiError("$this: Cannot set a null implementation");
573 } 595 }
574 if (isBound && (_impl == null)) { 596 if (isBound && (_impl == null)) {
575 beginHandlingEvents(); 597 beginHandlingEvents();
576 } 598 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
621 return impl.startTracing(categories, recorder); 643 return impl.startTracing(categories, recorder);
622 } 644 }
623 void stopTracing() { 645 void stopTracing() {
624 return impl.stopTracing(); 646 return impl.stopTracing();
625 } 647 }
626 } 648 }
627 649
628 const int _traceRecorderMethodRecordName = 0; 650 const int _traceRecorderMethodRecordName = 0;
629 651
630 class _TraceRecorderServiceDescription implements service_describer.ServiceDescr iption { 652 class _TraceRecorderServiceDescription implements service_describer.ServiceDescr iption {
631 dynamic getTopLevelInterface([Function responseFactory]) => 653 void getTopLevelInterface(Function responder) {
632 responseFactory(null); 654 responder(null);
655 }
633 656
634 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 657 void getTypeDefinition(String typeKey, Function responder) {
635 responseFactory(null); 658 responder(null);
659 }
636 660
637 dynamic getAllTypeDefinitions([Function responseFactory]) => 661 void getAllTypeDefinitions(Function responder) {
638 responseFactory(null); 662 responder(null);
663 }
639 } 664 }
640 665
641 abstract class TraceRecorder { 666 abstract class TraceRecorder {
642 static const String serviceName = null; 667 static const String serviceName = null;
643 668
644 static service_describer.ServiceDescription _cachedServiceDescription; 669 static service_describer.ServiceDescription _cachedServiceDescription;
645 static service_describer.ServiceDescription get serviceDescription { 670 static service_describer.ServiceDescription get serviceDescription {
646 if (_cachedServiceDescription == null) { 671 if (_cachedServiceDescription == null) {
647 _cachedServiceDescription = new _TraceRecorderServiceDescription(); 672 _cachedServiceDescription = new _TraceRecorderServiceDescription();
648 } 673 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 : super.fromHandle(handle, autoBegin: impl != null) { 803 : super.fromHandle(handle, autoBegin: impl != null) {
779 _impl = impl; 804 _impl = impl;
780 } 805 }
781 806
782 _TraceRecorderStubControl.unbound([this._impl]) : super.unbound(); 807 _TraceRecorderStubControl.unbound([this._impl]) : super.unbound();
783 808
784 String get serviceName => TraceRecorder.serviceName; 809 String get serviceName => TraceRecorder.serviceName;
785 810
786 811
787 812
788 dynamic handleMessage(bindings.ServiceMessage message) { 813 void handleMessage(bindings.ServiceMessage message) {
789 if (bindings.ControlMessageHandler.isControlMessage(message)) { 814 if (bindings.ControlMessageHandler.isControlMessage(message)) {
790 return bindings.ControlMessageHandler.handleMessage(this, 815 bindings.ControlMessageHandler.handleMessage(
791 0, 816 this, 0, message);
792 message); 817 return;
793 } 818 }
794 if (_impl == null) { 819 if (_impl == null) {
795 throw new core.MojoApiError("$this has no implementation set"); 820 throw new core.MojoApiError("$this has no implementation set");
796 } 821 }
797 switch (message.header.type) { 822 switch (message.header.type) {
798 case _traceRecorderMethodRecordName: 823 case _traceRecorderMethodRecordName:
799 var params = _TraceRecorderRecordParams.deserialize( 824 var params = _TraceRecorderRecordParams.deserialize(
800 message.payload); 825 message.payload);
801 _impl.record(params.json); 826 _impl.record(params.json);
802 break; 827 break;
803 default: 828 default:
804 throw new bindings.MojoCodecError("Unexpected message name"); 829 throw new bindings.MojoCodecError("Unexpected message name");
805 break; 830 break;
806 } 831 }
807 return null;
808 } 832 }
809 833
810 TraceRecorder get impl => _impl; 834 TraceRecorder get impl => _impl;
811 set impl(TraceRecorder d) { 835 set impl(TraceRecorder d) {
812 if (d == null) { 836 if (d == null) {
813 throw new core.MojoApiError("$this: Cannot set a null implementation"); 837 throw new core.MojoApiError("$this: Cannot set a null implementation");
814 } 838 }
815 if (isBound && (_impl == null)) { 839 if (isBound && (_impl == null)) {
816 beginHandlingEvents(); 840 beginHandlingEvents();
817 } 841 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 884
861 void record(String json) { 885 void record(String json) {
862 return impl.record(json); 886 return impl.record(json);
863 } 887 }
864 } 888 }
865 889
866 const int _traceCollectorMethodStartName = 0; 890 const int _traceCollectorMethodStartName = 0;
867 const int _traceCollectorMethodStopAndFlushName = 1; 891 const int _traceCollectorMethodStopAndFlushName = 1;
868 892
869 class _TraceCollectorServiceDescription implements service_describer.ServiceDesc ription { 893 class _TraceCollectorServiceDescription implements service_describer.ServiceDesc ription {
870 dynamic getTopLevelInterface([Function responseFactory]) => 894 void getTopLevelInterface(Function responder) {
871 responseFactory(null); 895 responder(null);
896 }
872 897
873 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 898 void getTypeDefinition(String typeKey, Function responder) {
874 responseFactory(null); 899 responder(null);
900 }
875 901
876 dynamic getAllTypeDefinitions([Function responseFactory]) => 902 void getAllTypeDefinitions(Function responder) {
877 responseFactory(null); 903 responder(null);
904 }
878 } 905 }
879 906
880 abstract class TraceCollector { 907 abstract class TraceCollector {
881 static const String serviceName = "tracing::TraceCollector"; 908 static const String serviceName = "tracing::TraceCollector";
882 909
883 static service_describer.ServiceDescription _cachedServiceDescription; 910 static service_describer.ServiceDescription _cachedServiceDescription;
884 static service_describer.ServiceDescription get serviceDescription { 911 static service_describer.ServiceDescription get serviceDescription {
885 if (_cachedServiceDescription == null) { 912 if (_cachedServiceDescription == null) {
886 _cachedServiceDescription = new _TraceCollectorServiceDescription(); 913 _cachedServiceDescription = new _TraceCollectorServiceDescription();
887 } 914 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
1032 : super.fromHandle(handle, autoBegin: impl != null) { 1059 : super.fromHandle(handle, autoBegin: impl != null) {
1033 _impl = impl; 1060 _impl = impl;
1034 } 1061 }
1035 1062
1036 _TraceCollectorStubControl.unbound([this._impl]) : super.unbound(); 1063 _TraceCollectorStubControl.unbound([this._impl]) : super.unbound();
1037 1064
1038 String get serviceName => TraceCollector.serviceName; 1065 String get serviceName => TraceCollector.serviceName;
1039 1066
1040 1067
1041 1068
1042 dynamic handleMessage(bindings.ServiceMessage message) { 1069 void handleMessage(bindings.ServiceMessage message) {
1043 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1070 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1044 return bindings.ControlMessageHandler.handleMessage(this, 1071 bindings.ControlMessageHandler.handleMessage(
1045 0, 1072 this, 0, message);
1046 message); 1073 return;
1047 } 1074 }
1048 if (_impl == null) { 1075 if (_impl == null) {
1049 throw new core.MojoApiError("$this has no implementation set"); 1076 throw new core.MojoApiError("$this has no implementation set");
1050 } 1077 }
1051 switch (message.header.type) { 1078 switch (message.header.type) {
1052 case _traceCollectorMethodStartName: 1079 case _traceCollectorMethodStartName:
1053 var params = _TraceCollectorStartParams.deserialize( 1080 var params = _TraceCollectorStartParams.deserialize(
1054 message.payload); 1081 message.payload);
1055 _impl.start(params.stream, params.categories); 1082 _impl.start(params.stream, params.categories);
1056 break; 1083 break;
1057 case _traceCollectorMethodStopAndFlushName: 1084 case _traceCollectorMethodStopAndFlushName:
1058 _impl.stopAndFlush(); 1085 _impl.stopAndFlush();
1059 break; 1086 break;
1060 default: 1087 default:
1061 throw new bindings.MojoCodecError("Unexpected message name"); 1088 throw new bindings.MojoCodecError("Unexpected message name");
1062 break; 1089 break;
1063 } 1090 }
1064 return null;
1065 } 1091 }
1066 1092
1067 TraceCollector get impl => _impl; 1093 TraceCollector get impl => _impl;
1068 set impl(TraceCollector d) { 1094 set impl(TraceCollector d) {
1069 if (d == null) { 1095 if (d == null) {
1070 throw new core.MojoApiError("$this: Cannot set a null implementation"); 1096 throw new core.MojoApiError("$this: Cannot set a null implementation");
1071 } 1097 }
1072 if (isBound && (_impl == null)) { 1098 if (isBound && (_impl == null)) {
1073 beginHandlingEvents(); 1099 beginHandlingEvents();
1074 } 1100 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1118 void start(core.MojoDataPipeProducer stream, String categories) { 1144 void start(core.MojoDataPipeProducer stream, String categories) {
1119 return impl.start(stream, categories); 1145 return impl.start(stream, categories);
1120 } 1146 }
1121 void stopAndFlush() { 1147 void stopAndFlush() {
1122 return impl.stopAndFlush(); 1148 return impl.stopAndFlush();
1123 } 1149 }
1124 } 1150 }
1125 1151
1126 1152
1127 1153
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698