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

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: Move code from mojo_patch to proxy.dart Created 4 years, 7 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 : super.fromHandle(handle, autoBegin: impl != null) { 540 : super.fromHandle(handle, autoBegin: impl != null) {
518 _impl = impl; 541 _impl = impl;
519 } 542 }
520 543
521 _TraceProviderStubControl.unbound([this._impl]) : super.unbound(); 544 _TraceProviderStubControl.unbound([this._impl]) : super.unbound();
522 545
523 String get serviceName => TraceProvider.serviceName; 546 String get serviceName => TraceProvider.serviceName;
524 547
525 548
526 549
527 dynamic handleMessage(bindings.ServiceMessage message) { 550 void handleMessage(bindings.ServiceMessage message) {
528 if (bindings.ControlMessageHandler.isControlMessage(message)) { 551 if (bindings.ControlMessageHandler.isControlMessage(message)) {
529 return bindings.ControlMessageHandler.handleMessage(this, 552 bindings.ControlMessageHandler.handleMessage(
530 0, 553 this, 0, message);
531 message); 554 return;
532 } 555 }
533 if (_impl == null) { 556 if (_impl == null) {
534 throw new core.MojoApiError("$this has no implementation set"); 557 throw new core.MojoApiError("$this has no implementation set");
535 } 558 }
536 switch (message.header.type) { 559 switch (message.header.type) {
537 case _traceProviderMethodStartTracingName: 560 case _traceProviderMethodStartTracingName:
538 var params = _TraceProviderStartTracingParams.deserialize( 561 var params = _TraceProviderStartTracingParams.deserialize(
539 message.payload); 562 message.payload);
540 _impl.startTracing(params.categories, params.recorder); 563 _impl.startTracing(params.categories, params.recorder);
541 break; 564 break;
542 case _traceProviderMethodStopTracingName: 565 case _traceProviderMethodStopTracingName:
543 _impl.stopTracing(); 566 _impl.stopTracing();
544 break; 567 break;
545 default: 568 default:
546 throw new bindings.MojoCodecError("Unexpected message name"); 569 throw new bindings.MojoCodecError("Unexpected message name");
547 break; 570 break;
548 } 571 }
549 return null;
550 } 572 }
551 573
552 TraceProvider get impl => _impl; 574 TraceProvider get impl => _impl;
553 set impl(TraceProvider d) { 575 set impl(TraceProvider d) {
554 if (d == null) { 576 if (d == null) {
555 throw new core.MojoApiError("$this: Cannot set a null implementation"); 577 throw new core.MojoApiError("$this: Cannot set a null implementation");
556 } 578 }
557 if (isBound && (_impl == null)) { 579 if (isBound && (_impl == null)) {
558 beginHandlingEvents(); 580 beginHandlingEvents();
559 } 581 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 return impl.startTracing(categories, recorder); 626 return impl.startTracing(categories, recorder);
605 } 627 }
606 void stopTracing() { 628 void stopTracing() {
607 return impl.stopTracing(); 629 return impl.stopTracing();
608 } 630 }
609 } 631 }
610 632
611 const int _traceRecorderMethodRecordName = 0; 633 const int _traceRecorderMethodRecordName = 0;
612 634
613 class _TraceRecorderServiceDescription implements service_describer.ServiceDescr iption { 635 class _TraceRecorderServiceDescription implements service_describer.ServiceDescr iption {
614 dynamic getTopLevelInterface([Function responseFactory]) => 636 void getTopLevelInterface(Function responder) {
615 responseFactory(null); 637 responder(null);
638 }
616 639
617 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 640 void getTypeDefinition(String typeKey, Function responder) {
618 responseFactory(null); 641 responder(null);
642 }
619 643
620 dynamic getAllTypeDefinitions([Function responseFactory]) => 644 void getAllTypeDefinitions(Function responder) {
621 responseFactory(null); 645 responder(null);
646 }
622 } 647 }
623 648
624 abstract class TraceRecorder { 649 abstract class TraceRecorder {
625 static const String serviceName = null; 650 static const String serviceName = null;
626 651
627 static service_describer.ServiceDescription _cachedServiceDescription; 652 static service_describer.ServiceDescription _cachedServiceDescription;
628 static service_describer.ServiceDescription get serviceDescription { 653 static service_describer.ServiceDescription get serviceDescription {
629 if (_cachedServiceDescription == null) { 654 if (_cachedServiceDescription == null) {
630 _cachedServiceDescription = new _TraceRecorderServiceDescription(); 655 _cachedServiceDescription = new _TraceRecorderServiceDescription();
631 } 656 }
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
748 : super.fromHandle(handle, autoBegin: impl != null) { 773 : super.fromHandle(handle, autoBegin: impl != null) {
749 _impl = impl; 774 _impl = impl;
750 } 775 }
751 776
752 _TraceRecorderStubControl.unbound([this._impl]) : super.unbound(); 777 _TraceRecorderStubControl.unbound([this._impl]) : super.unbound();
753 778
754 String get serviceName => TraceRecorder.serviceName; 779 String get serviceName => TraceRecorder.serviceName;
755 780
756 781
757 782
758 dynamic handleMessage(bindings.ServiceMessage message) { 783 void handleMessage(bindings.ServiceMessage message) {
759 if (bindings.ControlMessageHandler.isControlMessage(message)) { 784 if (bindings.ControlMessageHandler.isControlMessage(message)) {
760 return bindings.ControlMessageHandler.handleMessage(this, 785 bindings.ControlMessageHandler.handleMessage(
761 0, 786 this, 0, message);
762 message); 787 return;
763 } 788 }
764 if (_impl == null) { 789 if (_impl == null) {
765 throw new core.MojoApiError("$this has no implementation set"); 790 throw new core.MojoApiError("$this has no implementation set");
766 } 791 }
767 switch (message.header.type) { 792 switch (message.header.type) {
768 case _traceRecorderMethodRecordName: 793 case _traceRecorderMethodRecordName:
769 var params = _TraceRecorderRecordParams.deserialize( 794 var params = _TraceRecorderRecordParams.deserialize(
770 message.payload); 795 message.payload);
771 _impl.record(params.json); 796 _impl.record(params.json);
772 break; 797 break;
773 default: 798 default:
774 throw new bindings.MojoCodecError("Unexpected message name"); 799 throw new bindings.MojoCodecError("Unexpected message name");
775 break; 800 break;
776 } 801 }
777 return null;
778 } 802 }
779 803
780 TraceRecorder get impl => _impl; 804 TraceRecorder get impl => _impl;
781 set impl(TraceRecorder d) { 805 set impl(TraceRecorder d) {
782 if (d == null) { 806 if (d == null) {
783 throw new core.MojoApiError("$this: Cannot set a null implementation"); 807 throw new core.MojoApiError("$this: Cannot set a null implementation");
784 } 808 }
785 if (isBound && (_impl == null)) { 809 if (isBound && (_impl == null)) {
786 beginHandlingEvents(); 810 beginHandlingEvents();
787 } 811 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 854
831 void record(String json) { 855 void record(String json) {
832 return impl.record(json); 856 return impl.record(json);
833 } 857 }
834 } 858 }
835 859
836 const int _traceCollectorMethodStartName = 0; 860 const int _traceCollectorMethodStartName = 0;
837 const int _traceCollectorMethodStopAndFlushName = 1; 861 const int _traceCollectorMethodStopAndFlushName = 1;
838 862
839 class _TraceCollectorServiceDescription implements service_describer.ServiceDesc ription { 863 class _TraceCollectorServiceDescription implements service_describer.ServiceDesc ription {
840 dynamic getTopLevelInterface([Function responseFactory]) => 864 void getTopLevelInterface(Function responder) {
841 responseFactory(null); 865 responder(null);
866 }
842 867
843 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 868 void getTypeDefinition(String typeKey, Function responder) {
844 responseFactory(null); 869 responder(null);
870 }
845 871
846 dynamic getAllTypeDefinitions([Function responseFactory]) => 872 void getAllTypeDefinitions(Function responder) {
847 responseFactory(null); 873 responder(null);
874 }
848 } 875 }
849 876
850 abstract class TraceCollector { 877 abstract class TraceCollector {
851 static const String serviceName = "tracing::TraceCollector"; 878 static const String serviceName = "tracing::TraceCollector";
852 879
853 static service_describer.ServiceDescription _cachedServiceDescription; 880 static service_describer.ServiceDescription _cachedServiceDescription;
854 static service_describer.ServiceDescription get serviceDescription { 881 static service_describer.ServiceDescription get serviceDescription {
855 if (_cachedServiceDescription == null) { 882 if (_cachedServiceDescription == null) {
856 _cachedServiceDescription = new _TraceCollectorServiceDescription(); 883 _cachedServiceDescription = new _TraceCollectorServiceDescription();
857 } 884 }
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
985 : super.fromHandle(handle, autoBegin: impl != null) { 1012 : super.fromHandle(handle, autoBegin: impl != null) {
986 _impl = impl; 1013 _impl = impl;
987 } 1014 }
988 1015
989 _TraceCollectorStubControl.unbound([this._impl]) : super.unbound(); 1016 _TraceCollectorStubControl.unbound([this._impl]) : super.unbound();
990 1017
991 String get serviceName => TraceCollector.serviceName; 1018 String get serviceName => TraceCollector.serviceName;
992 1019
993 1020
994 1021
995 dynamic handleMessage(bindings.ServiceMessage message) { 1022 void handleMessage(bindings.ServiceMessage message) {
996 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1023 if (bindings.ControlMessageHandler.isControlMessage(message)) {
997 return bindings.ControlMessageHandler.handleMessage(this, 1024 bindings.ControlMessageHandler.handleMessage(
998 0, 1025 this, 0, message);
999 message); 1026 return;
1000 } 1027 }
1001 if (_impl == null) { 1028 if (_impl == null) {
1002 throw new core.MojoApiError("$this has no implementation set"); 1029 throw new core.MojoApiError("$this has no implementation set");
1003 } 1030 }
1004 switch (message.header.type) { 1031 switch (message.header.type) {
1005 case _traceCollectorMethodStartName: 1032 case _traceCollectorMethodStartName:
1006 var params = _TraceCollectorStartParams.deserialize( 1033 var params = _TraceCollectorStartParams.deserialize(
1007 message.payload); 1034 message.payload);
1008 _impl.start(params.stream, params.categories); 1035 _impl.start(params.stream, params.categories);
1009 break; 1036 break;
1010 case _traceCollectorMethodStopAndFlushName: 1037 case _traceCollectorMethodStopAndFlushName:
1011 _impl.stopAndFlush(); 1038 _impl.stopAndFlush();
1012 break; 1039 break;
1013 default: 1040 default:
1014 throw new bindings.MojoCodecError("Unexpected message name"); 1041 throw new bindings.MojoCodecError("Unexpected message name");
1015 break; 1042 break;
1016 } 1043 }
1017 return null;
1018 } 1044 }
1019 1045
1020 TraceCollector get impl => _impl; 1046 TraceCollector get impl => _impl;
1021 set impl(TraceCollector d) { 1047 set impl(TraceCollector d) {
1022 if (d == null) { 1048 if (d == null) {
1023 throw new core.MojoApiError("$this: Cannot set a null implementation"); 1049 throw new core.MojoApiError("$this: Cannot set a null implementation");
1024 } 1050 }
1025 if (isBound && (_impl == null)) { 1051 if (isBound && (_impl == null)) {
1026 beginHandlingEvents(); 1052 beginHandlingEvents();
1027 } 1053 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1071 void start(core.MojoDataPipeProducer stream, String categories) { 1097 void start(core.MojoDataPipeProducer stream, String categories) {
1072 return impl.start(stream, categories); 1098 return impl.start(stream, categories);
1073 } 1099 }
1074 void stopAndFlush() { 1100 void stopAndFlush() {
1075 return impl.stopAndFlush(); 1101 return impl.stopAndFlush();
1076 } 1102 }
1077 } 1103 }
1078 1104
1079 1105
1080 1106
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698