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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/icu_data/icu_data.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 icu_data_mojom; 5 library icu_data_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
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 163
164 dynamic getAllTypeDefinitions([Function responseFactory]) => 164 dynamic getAllTypeDefinitions([Function responseFactory]) =>
165 responseFactory(null); 165 responseFactory(null);
166 } 166 }
167 167
168 abstract class IcuData { 168 abstract class IcuData {
169 static const String serviceName = "icu_data::ICUData"; 169 static const String serviceName = "icu_data::ICUData";
170 dynamic map(String sha1hash,[Function responseFactory = null]); 170 dynamic map(String sha1hash,[Function responseFactory = null]);
171 } 171 }
172 172
173 173 class _IcuDataProxyControl
174 class _IcuDataProxyControl extends bindings.ProxyMessageHandler 174 extends bindings.ProxyMessageHandler
175 implements bindings.ProxyControl { 175 implements bindings.ProxyControl {
176 _IcuDataProxyControl.fromEndpoint( 176 _IcuDataProxyControl.fromEndpoint(
177 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 177 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
178 178
179 _IcuDataProxyControl.fromHandle( 179 _IcuDataProxyControl.fromHandle(
180 core.MojoHandle handle) : super.fromHandle(handle); 180 core.MojoHandle handle) : super.fromHandle(handle);
181 181
182 _IcuDataProxyControl.unbound() : super.unbound(); 182 _IcuDataProxyControl.unbound() : super.unbound();
183 183
184 service_describer.ServiceDescription get serviceDescription => 184 service_describer.ServiceDescription get serviceDescription =>
185 new _IcuDataServiceDescription(); 185 new _IcuDataServiceDescription();
186 186
187 String get serviceName => IcuData.serviceName; 187 String get serviceName => IcuData.serviceName;
188 188
189 @override
190 void handleResponse(bindings.ServiceMessage message) { 189 void handleResponse(bindings.ServiceMessage message) {
191 switch (message.header.type) { 190 switch (message.header.type) {
192 case _icuDataMethodMapName: 191 case _icuDataMethodMapName:
193 var r = IcuDataMapResponseParams.deserialize( 192 var r = IcuDataMapResponseParams.deserialize(
194 message.payload); 193 message.payload);
195 if (!message.header.hasRequestId) { 194 if (!message.header.hasRequestId) {
196 proxyError("Expected a message with a valid request Id."); 195 proxyError("Expected a message with a valid request Id.");
197 return; 196 return;
198 } 197 }
199 Completer c = completerMap[message.header.requestId]; 198 Completer c = completerMap[message.header.requestId];
(...skipping 16 matching lines...) Expand all
216 } 215 }
217 } 216 }
218 217
219 @override 218 @override
220 String toString() { 219 String toString() {
221 var superString = super.toString(); 220 var superString = super.toString();
222 return "_IcuDataProxyControl($superString)"; 221 return "_IcuDataProxyControl($superString)";
223 } 222 }
224 } 223 }
225 224
226 225 class IcuDataProxy
227 class IcuDataProxy extends bindings.Proxy 226 extends bindings.Proxy
228 implements IcuData { 227 implements IcuData {
229 IcuDataProxy.fromEndpoint( 228 IcuDataProxy.fromEndpoint(
230 core.MojoMessagePipeEndpoint endpoint) 229 core.MojoMessagePipeEndpoint endpoint)
231 : super(new _IcuDataProxyControl.fromEndpoint(endpoint)); 230 : super(new _IcuDataProxyControl.fromEndpoint(endpoint));
232 231
233 IcuDataProxy.fromHandle(core.MojoHandle handle) 232 IcuDataProxy.fromHandle(core.MojoHandle handle)
234 : super(new _IcuDataProxyControl.fromHandle(handle)); 233 : super(new _IcuDataProxyControl.fromHandle(handle));
235 234
236 IcuDataProxy.unbound() 235 IcuDataProxy.unbound()
237 : super(new _IcuDataProxyControl.unbound()); 236 : super(new _IcuDataProxyControl.unbound());
238 237
(...skipping 15 matching lines...) Expand all
254 var params = new _IcuDataMapParams(); 253 var params = new _IcuDataMapParams();
255 params.sha1hash = sha1hash; 254 params.sha1hash = sha1hash;
256 return ctrl.sendMessageWithRequestId( 255 return ctrl.sendMessageWithRequestId(
257 params, 256 params,
258 _icuDataMethodMapName, 257 _icuDataMethodMapName,
259 -1, 258 -1,
260 bindings.MessageHeader.kMessageExpectsResponse); 259 bindings.MessageHeader.kMessageExpectsResponse);
261 } 260 }
262 } 261 }
263 262
264 263 class _IcuDataStubControl
265 class IcuDataStub extends bindings.Stub { 264 extends bindings.StubMessageHandler
265 implements bindings.StubControl<IcuData> {
266 IcuData _impl; 266 IcuData _impl;
267 267
268 IcuDataStub.fromEndpoint( 268 _IcuDataStubControl.fromEndpoint(
269 core.MojoMessagePipeEndpoint endpoint, [IcuData impl]) 269 core.MojoMessagePipeEndpoint endpoint, [IcuData impl])
270 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 270 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
271 _impl = impl; 271 _impl = impl;
272 } 272 }
273 273
274 IcuDataStub.fromHandle( 274 _IcuDataStubControl.fromHandle(
275 core.MojoHandle handle, [IcuData impl]) 275 core.MojoHandle handle, [IcuData impl])
276 : super.fromHandle(handle, autoBegin: impl != null) { 276 : super.fromHandle(handle, autoBegin: impl != null) {
277 _impl = impl; 277 _impl = impl;
278 } 278 }
279 279
280 IcuDataStub.unbound([this._impl]) : super.unbound(); 280 _IcuDataStubControl.unbound([this._impl]) : super.unbound();
281
282 static IcuDataStub newFromEndpoint(
283 core.MojoMessagePipeEndpoint endpoint) {
284 assert(endpoint.setDescription("For IcuDataStub"));
285 return new IcuDataStub.fromEndpoint(endpoint);
286 }
287 281
288 282
289 IcuDataMapResponseParams _icuDataMapResponseParamsFactory(core.MojoSharedBuffe r icuData) { 283 IcuDataMapResponseParams _icuDataMapResponseParamsFactory(core.MojoSharedBuffe r icuData) {
290 var result = new IcuDataMapResponseParams(); 284 var result = new IcuDataMapResponseParams();
291 result.icuData = icuData; 285 result.icuData = icuData;
292 return result; 286 return result;
293 } 287 }
294 288
295 dynamic handleMessage(bindings.ServiceMessage message) { 289 dynamic handleMessage(bindings.ServiceMessage message) {
296 if (bindings.ControlMessageHandler.isControlMessage(message)) { 290 if (bindings.ControlMessageHandler.isControlMessage(message)) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
343 } 337 }
344 338
345 @override 339 @override
346 void bind(core.MojoMessagePipeEndpoint endpoint) { 340 void bind(core.MojoMessagePipeEndpoint endpoint) {
347 super.bind(endpoint); 341 super.bind(endpoint);
348 if (!isOpen && (_impl != null)) { 342 if (!isOpen && (_impl != null)) {
349 beginHandlingEvents(); 343 beginHandlingEvents();
350 } 344 }
351 } 345 }
352 346
347 @override
353 String toString() { 348 String toString() {
354 var superString = super.toString(); 349 var superString = super.toString();
355 return "IcuDataStub($superString)"; 350 return "_IcuDataStubControl($superString)";
356 } 351 }
357 352
358 int get version => 0; 353 int get version => 0;
359 354
360 static service_describer.ServiceDescription _cachedServiceDescription; 355 static service_describer.ServiceDescription _cachedServiceDescription;
361 static service_describer.ServiceDescription get serviceDescription { 356 static service_describer.ServiceDescription get serviceDescription {
362 if (_cachedServiceDescription == null) { 357 if (_cachedServiceDescription == null) {
363 _cachedServiceDescription = new _IcuDataServiceDescription(); 358 _cachedServiceDescription = new _IcuDataServiceDescription();
364 } 359 }
365 return _cachedServiceDescription; 360 return _cachedServiceDescription;
366 } 361 }
367 } 362 }
368 363
364 class IcuDataStub
365 extends bindings.Stub<IcuData>
366 implements IcuData {
367 IcuDataStub.fromEndpoint(
368 core.MojoMessagePipeEndpoint endpoint, [IcuData impl])
369 : super(new _IcuDataStubControl.fromEndpoint(endpoint, impl));
370
371 IcuDataStub.fromHandle(
372 core.MojoHandle handle, [IcuData impl])
373 : super(new _IcuDataStubControl.fromHandle(handle, impl));
374
375 IcuDataStub.unbound([IcuData impl])
376 : super(new _IcuDataStubControl.unbound(impl));
377
378 static IcuDataStub newFromEndpoint(
379 core.MojoMessagePipeEndpoint endpoint) {
380 assert(endpoint.setDescription("For IcuDataStub"));
381 return new IcuDataStub.fromEndpoint(endpoint);
382 }
383
384 static service_describer.ServiceDescription get serviceDescription =>
385 _IcuDataStubControl.serviceDescription;
386
387
388 dynamic map(String sha1hash,[Function responseFactory = null]) {
389 return impl.map(sha1hash,responseFactory);
390 }
391 }
392
369 393
370 394
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698