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

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

Issue 1983453002: Dart: Refactor Stubs (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Merge 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 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;
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 92
93 dynamic getAllTypeDefinitions([Function responseFactory]) => 93 dynamic getAllTypeDefinitions([Function responseFactory]) =>
94 responseFactory(null); 94 responseFactory(null);
95 } 95 }
96 96
97 abstract class TraceProviderRegistry { 97 abstract class TraceProviderRegistry {
98 static const String serviceName = "tracing.TraceProviderRegistry"; 98 static const String serviceName = "tracing.TraceProviderRegistry";
99 void registerTraceProvider(Object traceProvider); 99 void registerTraceProvider(Object traceProvider);
100 } 100 }
101 101
102 102 class _TraceProviderRegistryProxyControl
103 class _TraceProviderRegistryProxyControl extends bindings.ProxyMessageHandler 103 extends bindings.ProxyMessageHandler
104 implements bindings.ProxyControl { 104 implements bindings.ProxyControl {
105 _TraceProviderRegistryProxyControl.fromEndpoint( 105 _TraceProviderRegistryProxyControl.fromEndpoint(
106 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 106 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
107 107
108 _TraceProviderRegistryProxyControl.fromHandle( 108 _TraceProviderRegistryProxyControl.fromHandle(
109 core.MojoHandle handle) : super.fromHandle(handle); 109 core.MojoHandle handle) : super.fromHandle(handle);
110 110
111 _TraceProviderRegistryProxyControl.unbound() : super.unbound(); 111 _TraceProviderRegistryProxyControl.unbound() : super.unbound();
112 112
113 service_describer.ServiceDescription get serviceDescription => 113 service_describer.ServiceDescription get serviceDescription =>
114 new _TraceProviderRegistryServiceDescription(); 114 new _TraceProviderRegistryServiceDescription();
115 115
116 String get serviceName => TraceProviderRegistry.serviceName; 116 String get serviceName => TraceProviderRegistry.serviceName;
117 117
118 @override
119 void handleResponse(bindings.ServiceMessage message) { 118 void handleResponse(bindings.ServiceMessage message) {
120 switch (message.header.type) { 119 switch (message.header.type) {
121 default: 120 default:
122 proxyError("Unexpected message type: ${message.header.type}"); 121 proxyError("Unexpected message type: ${message.header.type}");
123 close(immediate: true); 122 close(immediate: true);
124 break; 123 break;
125 } 124 }
126 } 125 }
127 126
128 @override 127 @override
129 String toString() { 128 String toString() {
130 var superString = super.toString(); 129 var superString = super.toString();
131 return "_TraceProviderRegistryProxyControl($superString)"; 130 return "_TraceProviderRegistryProxyControl($superString)";
132 } 131 }
133 } 132 }
134 133
135 134 class TraceProviderRegistryProxy
136 class TraceProviderRegistryProxy extends bindings.Proxy 135 extends bindings.Proxy
137 implements TraceProviderRegistry { 136 implements TraceProviderRegistry {
138 TraceProviderRegistryProxy.fromEndpoint( 137 TraceProviderRegistryProxy.fromEndpoint(
139 core.MojoMessagePipeEndpoint endpoint) 138 core.MojoMessagePipeEndpoint endpoint)
140 : super(new _TraceProviderRegistryProxyControl.fromEndpoint(endpoint)); 139 : super(new _TraceProviderRegistryProxyControl.fromEndpoint(endpoint));
141 140
142 TraceProviderRegistryProxy.fromHandle(core.MojoHandle handle) 141 TraceProviderRegistryProxy.fromHandle(core.MojoHandle handle)
143 : super(new _TraceProviderRegistryProxyControl.fromHandle(handle)); 142 : super(new _TraceProviderRegistryProxyControl.fromHandle(handle));
144 143
145 TraceProviderRegistryProxy.unbound() 144 TraceProviderRegistryProxy.unbound()
146 : super(new _TraceProviderRegistryProxyControl.unbound()); 145 : super(new _TraceProviderRegistryProxyControl.unbound());
147 146
(...skipping 16 matching lines...) Expand all
164 ctrl.proxyError("The Proxy is closed."); 163 ctrl.proxyError("The Proxy is closed.");
165 return; 164 return;
166 } 165 }
167 var params = new _TraceProviderRegistryRegisterTraceProviderParams(); 166 var params = new _TraceProviderRegistryRegisterTraceProviderParams();
168 params.traceProvider = traceProvider; 167 params.traceProvider = traceProvider;
169 ctrl.sendMessage(params, 168 ctrl.sendMessage(params,
170 _traceProviderRegistryMethodRegisterTraceProviderName); 169 _traceProviderRegistryMethodRegisterTraceProviderName);
171 } 170 }
172 } 171 }
173 172
174 173 class _TraceProviderRegistryStubControl
175 class TraceProviderRegistryStub extends bindings.Stub { 174 extends bindings.StubMessageHandler
175 implements bindings.StubControl<TraceProviderRegistry> {
176 TraceProviderRegistry _impl; 176 TraceProviderRegistry _impl;
177 177
178 TraceProviderRegistryStub.fromEndpoint( 178 _TraceProviderRegistryStubControl.fromEndpoint(
179 core.MojoMessagePipeEndpoint endpoint, [TraceProviderRegistry impl]) 179 core.MojoMessagePipeEndpoint endpoint, [TraceProviderRegistry impl])
180 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 180 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
181 _impl = impl; 181 _impl = impl;
182 } 182 }
183 183
184 TraceProviderRegistryStub.fromHandle( 184 _TraceProviderRegistryStubControl.fromHandle(
185 core.MojoHandle handle, [TraceProviderRegistry impl]) 185 core.MojoHandle handle, [TraceProviderRegistry impl])
186 : super.fromHandle(handle, autoBegin: impl != null) { 186 : super.fromHandle(handle, autoBegin: impl != null) {
187 _impl = impl; 187 _impl = impl;
188 } 188 }
189 189
190 TraceProviderRegistryStub.unbound([this._impl]) : super.unbound(); 190 _TraceProviderRegistryStubControl.unbound([this._impl]) : super.unbound();
191
192 static TraceProviderRegistryStub newFromEndpoint(
193 core.MojoMessagePipeEndpoint endpoint) {
194 assert(endpoint.setDescription("For TraceProviderRegistryStub"));
195 return new TraceProviderRegistryStub.fromEndpoint(endpoint);
196 }
197 191
198 192
199 193
200 dynamic handleMessage(bindings.ServiceMessage message) { 194 dynamic handleMessage(bindings.ServiceMessage message) {
201 if (bindings.ControlMessageHandler.isControlMessage(message)) { 195 if (bindings.ControlMessageHandler.isControlMessage(message)) {
202 return bindings.ControlMessageHandler.handleMessage(this, 196 return bindings.ControlMessageHandler.handleMessage(this,
203 0, 197 0,
204 message); 198 message);
205 } 199 }
206 if (_impl == null) { 200 if (_impl == null) {
(...skipping 24 matching lines...) Expand all
231 } 225 }
232 226
233 @override 227 @override
234 void bind(core.MojoMessagePipeEndpoint endpoint) { 228 void bind(core.MojoMessagePipeEndpoint endpoint) {
235 super.bind(endpoint); 229 super.bind(endpoint);
236 if (!isOpen && (_impl != null)) { 230 if (!isOpen && (_impl != null)) {
237 beginHandlingEvents(); 231 beginHandlingEvents();
238 } 232 }
239 } 233 }
240 234
235 @override
241 String toString() { 236 String toString() {
242 var superString = super.toString(); 237 var superString = super.toString();
243 return "TraceProviderRegistryStub($superString)"; 238 return "_TraceProviderRegistryStubControl($superString)";
244 } 239 }
245 240
246 int get version => 0; 241 int get version => 0;
247 242
248 static service_describer.ServiceDescription _cachedServiceDescription; 243 static service_describer.ServiceDescription _cachedServiceDescription;
249 static service_describer.ServiceDescription get serviceDescription { 244 static service_describer.ServiceDescription get serviceDescription {
250 if (_cachedServiceDescription == null) { 245 if (_cachedServiceDescription == null) {
251 _cachedServiceDescription = new _TraceProviderRegistryServiceDescription() ; 246 _cachedServiceDescription = new _TraceProviderRegistryServiceDescription() ;
252 } 247 }
253 return _cachedServiceDescription; 248 return _cachedServiceDescription;
254 } 249 }
255 } 250 }
256 251
252 class TraceProviderRegistryStub
253 extends bindings.Stub<TraceProviderRegistry>
254 implements TraceProviderRegistry {
255 TraceProviderRegistryStub.fromEndpoint(
256 core.MojoMessagePipeEndpoint endpoint, [TraceProviderRegistry impl])
257 : super(new _TraceProviderRegistryStubControl.fromEndpoint(endpoint, impl) );
258
259 TraceProviderRegistryStub.fromHandle(
260 core.MojoHandle handle, [TraceProviderRegistry impl])
261 : super(new _TraceProviderRegistryStubControl.fromHandle(handle, impl));
262
263 TraceProviderRegistryStub.unbound([TraceProviderRegistry impl])
264 : super(new _TraceProviderRegistryStubControl.unbound(impl));
265
266 static TraceProviderRegistryStub newFromEndpoint(
267 core.MojoMessagePipeEndpoint endpoint) {
268 assert(endpoint.setDescription("For TraceProviderRegistryStub"));
269 return new TraceProviderRegistryStub.fromEndpoint(endpoint);
270 }
271
272 static service_describer.ServiceDescription get serviceDescription =>
273 _TraceProviderRegistryStubControl.serviceDescription;
274
275
276 void registerTraceProvider(Object traceProvider) {
277 return impl.registerTraceProvider(traceProvider);
278 }
279 }
280
257 281
258 282
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698