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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/tracing/trace_provider_registry.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 trace_provider_registry_mojom; 5 library trace_provider_registry_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 import 'package:mojo_services/tracing/tracing.mojom.dart' as tracing_mojom; 10 import 'package:mojo_services/tracing/tracing.mojom.dart' as tracing_mojom;
11 11
12 12
13 13
14 class _TraceProviderRegistryRegisterTraceProviderParams extends bindings.Struct { 14 class _TraceProviderRegistryRegisterTraceProviderParams extends bindings.Struct {
15 static const List<bindings.StructDataHeader> kVersions = const [ 15 static const List<bindings.StructDataHeader> kVersions = const [
16 const bindings.StructDataHeader(16, 0) 16 const bindings.StructDataHeader(16, 0)
17 ]; 17 ];
18 tracing_mojom.TraceProviderInterface traceProvider = null; 18 tracing_mojom.TraceProviderInterface traceProvider = null;
19 19
20 _TraceProviderRegistryRegisterTraceProviderParams() : super(kVersions.last.siz e); 20 _TraceProviderRegistryRegisterTraceProviderParams() : super(kVersions.last.siz e);
21 21
22 _TraceProviderRegistryRegisterTraceProviderParams.init(
23 tracing_mojom.TraceProviderInterface this.traceProvider
24 ) : super(kVersions.last.size);
25
22 static _TraceProviderRegistryRegisterTraceProviderParams deserialize(bindings. Message message) { 26 static _TraceProviderRegistryRegisterTraceProviderParams deserialize(bindings. Message message) {
23 var decoder = new bindings.Decoder(message); 27 var decoder = new bindings.Decoder(message);
24 var result = decode(decoder); 28 var result = decode(decoder);
25 if (decoder.excessHandles != null) { 29 if (decoder.excessHandles != null) {
26 decoder.excessHandles.forEach((h) => h.close()); 30 decoder.excessHandles.forEach((h) => h.close());
27 } 31 }
28 return result; 32 return result;
29 } 33 }
30 34
31 static _TraceProviderRegistryRegisterTraceProviderParams decode(bindings.Decod er decoder0) { 35 static _TraceProviderRegistryRegisterTraceProviderParams decode(bindings.Decod er decoder0) {
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 81
78 Map toJson() { 82 Map toJson() {
79 throw new bindings.MojoCodecError( 83 throw new bindings.MojoCodecError(
80 'Object containing handles cannot be encoded to JSON.'); 84 'Object containing handles cannot be encoded to JSON.');
81 } 85 }
82 } 86 }
83 87
84 const int _traceProviderRegistryMethodRegisterTraceProviderName = 0; 88 const int _traceProviderRegistryMethodRegisterTraceProviderName = 0;
85 89
86 class _TraceProviderRegistryServiceDescription implements service_describer.Serv iceDescription { 90 class _TraceProviderRegistryServiceDescription implements service_describer.Serv iceDescription {
87 dynamic getTopLevelInterface([Function responseFactory]) => 91 void getTopLevelInterface(Function responder) {
88 responseFactory(null); 92 responder(null);
93 }
89 94
90 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 95 void getTypeDefinition(String typeKey, Function responder) {
91 responseFactory(null); 96 responder(null);
97 }
92 98
93 dynamic getAllTypeDefinitions([Function responseFactory]) => 99 void getAllTypeDefinitions(Function responder) {
94 responseFactory(null); 100 responder(null);
101 }
95 } 102 }
96 103
97 abstract class TraceProviderRegistry { 104 abstract class TraceProviderRegistry {
98 static const String serviceName = "tracing.TraceProviderRegistry"; 105 static const String serviceName = "tracing.TraceProviderRegistry";
99 106
100 static service_describer.ServiceDescription _cachedServiceDescription; 107 static service_describer.ServiceDescription _cachedServiceDescription;
101 static service_describer.ServiceDescription get serviceDescription { 108 static service_describer.ServiceDescription get serviceDescription {
102 if (_cachedServiceDescription == null) { 109 if (_cachedServiceDescription == null) {
103 _cachedServiceDescription = new _TraceProviderRegistryServiceDescription() ; 110 _cachedServiceDescription = new _TraceProviderRegistryServiceDescription() ;
104 } 111 }
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 : super.fromHandle(handle, autoBegin: impl != null) { 241 : super.fromHandle(handle, autoBegin: impl != null) {
235 _impl = impl; 242 _impl = impl;
236 } 243 }
237 244
238 _TraceProviderRegistryStubControl.unbound([this._impl]) : super.unbound(); 245 _TraceProviderRegistryStubControl.unbound([this._impl]) : super.unbound();
239 246
240 String get serviceName => TraceProviderRegistry.serviceName; 247 String get serviceName => TraceProviderRegistry.serviceName;
241 248
242 249
243 250
244 dynamic handleMessage(bindings.ServiceMessage message) { 251 void handleMessage(bindings.ServiceMessage message) {
245 if (bindings.ControlMessageHandler.isControlMessage(message)) { 252 if (bindings.ControlMessageHandler.isControlMessage(message)) {
246 return bindings.ControlMessageHandler.handleMessage(this, 253 bindings.ControlMessageHandler.handleMessage(
247 0, 254 this, 0, message);
248 message); 255 return;
249 } 256 }
250 if (_impl == null) { 257 if (_impl == null) {
251 throw new core.MojoApiError("$this has no implementation set"); 258 throw new core.MojoApiError("$this has no implementation set");
252 } 259 }
253 switch (message.header.type) { 260 switch (message.header.type) {
254 case _traceProviderRegistryMethodRegisterTraceProviderName: 261 case _traceProviderRegistryMethodRegisterTraceProviderName:
255 var params = _TraceProviderRegistryRegisterTraceProviderParams.deseriali ze( 262 var params = _TraceProviderRegistryRegisterTraceProviderParams.deseriali ze(
256 message.payload); 263 message.payload);
257 _impl.registerTraceProvider(params.traceProvider); 264 _impl.registerTraceProvider(params.traceProvider);
258 break; 265 break;
259 default: 266 default:
260 throw new bindings.MojoCodecError("Unexpected message name"); 267 throw new bindings.MojoCodecError("Unexpected message name");
261 break; 268 break;
262 } 269 }
263 return null;
264 } 270 }
265 271
266 TraceProviderRegistry get impl => _impl; 272 TraceProviderRegistry get impl => _impl;
267 set impl(TraceProviderRegistry d) { 273 set impl(TraceProviderRegistry d) {
268 if (d == null) { 274 if (d == null) {
269 throw new core.MojoApiError("$this: Cannot set a null implementation"); 275 throw new core.MojoApiError("$this: Cannot set a null implementation");
270 } 276 }
271 if (isBound && (_impl == null)) { 277 if (isBound && (_impl == null)) {
272 beginHandlingEvents(); 278 beginHandlingEvents();
273 } 279 }
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 320 }
315 321
316 322
317 void registerTraceProvider(tracing_mojom.TraceProviderInterface traceProvider) { 323 void registerTraceProvider(tracing_mojom.TraceProviderInterface traceProvider) {
318 return impl.registerTraceProvider(traceProvider); 324 return impl.registerTraceProvider(traceProvider);
319 } 325 }
320 } 326 }
321 327
322 328
323 329
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698