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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/prediction/prediction.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 prediction_mojom; 5 library prediction_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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 370
371 dynamic getAllTypeDefinitions([Function responseFactory]) => 371 dynamic getAllTypeDefinitions([Function responseFactory]) =>
372 responseFactory(null); 372 responseFactory(null);
373 } 373 }
374 374
375 abstract class PredictionService { 375 abstract class PredictionService {
376 static const String serviceName = "prediction::PredictionService"; 376 static const String serviceName = "prediction::PredictionService";
377 dynamic getPredictionList(PredictionInfo predictionInfo,[Function responseFact ory = null]); 377 dynamic getPredictionList(PredictionInfo predictionInfo,[Function responseFact ory = null]);
378 } 378 }
379 379
380 380 class _PredictionServiceProxyControl
381 class _PredictionServiceProxyControl extends bindings.ProxyMessageHandler 381 extends bindings.ProxyMessageHandler
382 implements bindings.ProxyControl { 382 implements bindings.ProxyControl {
383 _PredictionServiceProxyControl.fromEndpoint( 383 _PredictionServiceProxyControl.fromEndpoint(
384 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 384 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
385 385
386 _PredictionServiceProxyControl.fromHandle( 386 _PredictionServiceProxyControl.fromHandle(
387 core.MojoHandle handle) : super.fromHandle(handle); 387 core.MojoHandle handle) : super.fromHandle(handle);
388 388
389 _PredictionServiceProxyControl.unbound() : super.unbound(); 389 _PredictionServiceProxyControl.unbound() : super.unbound();
390 390
391 service_describer.ServiceDescription get serviceDescription => 391 service_describer.ServiceDescription get serviceDescription =>
392 new _PredictionServiceServiceDescription(); 392 new _PredictionServiceServiceDescription();
393 393
394 String get serviceName => PredictionService.serviceName; 394 String get serviceName => PredictionService.serviceName;
395 395
396 @override
397 void handleResponse(bindings.ServiceMessage message) { 396 void handleResponse(bindings.ServiceMessage message) {
398 switch (message.header.type) { 397 switch (message.header.type) {
399 case _predictionServiceMethodGetPredictionListName: 398 case _predictionServiceMethodGetPredictionListName:
400 var r = PredictionServiceGetPredictionListResponseParams.deserialize( 399 var r = PredictionServiceGetPredictionListResponseParams.deserialize(
401 message.payload); 400 message.payload);
402 if (!message.header.hasRequestId) { 401 if (!message.header.hasRequestId) {
403 proxyError("Expected a message with a valid request Id."); 402 proxyError("Expected a message with a valid request Id.");
404 return; 403 return;
405 } 404 }
406 Completer c = completerMap[message.header.requestId]; 405 Completer c = completerMap[message.header.requestId];
(...skipping 16 matching lines...) Expand all
423 } 422 }
424 } 423 }
425 424
426 @override 425 @override
427 String toString() { 426 String toString() {
428 var superString = super.toString(); 427 var superString = super.toString();
429 return "_PredictionServiceProxyControl($superString)"; 428 return "_PredictionServiceProxyControl($superString)";
430 } 429 }
431 } 430 }
432 431
433 432 class PredictionServiceProxy
434 class PredictionServiceProxy extends bindings.Proxy 433 extends bindings.Proxy
435 implements PredictionService { 434 implements PredictionService {
436 PredictionServiceProxy.fromEndpoint( 435 PredictionServiceProxy.fromEndpoint(
437 core.MojoMessagePipeEndpoint endpoint) 436 core.MojoMessagePipeEndpoint endpoint)
438 : super(new _PredictionServiceProxyControl.fromEndpoint(endpoint)); 437 : super(new _PredictionServiceProxyControl.fromEndpoint(endpoint));
439 438
440 PredictionServiceProxy.fromHandle(core.MojoHandle handle) 439 PredictionServiceProxy.fromHandle(core.MojoHandle handle)
441 : super(new _PredictionServiceProxyControl.fromHandle(handle)); 440 : super(new _PredictionServiceProxyControl.fromHandle(handle));
442 441
443 PredictionServiceProxy.unbound() 442 PredictionServiceProxy.unbound()
444 : super(new _PredictionServiceProxyControl.unbound()); 443 : super(new _PredictionServiceProxyControl.unbound());
445 444
(...skipping 15 matching lines...) Expand all
461 var params = new _PredictionServiceGetPredictionListParams(); 460 var params = new _PredictionServiceGetPredictionListParams();
462 params.predictionInfo = predictionInfo; 461 params.predictionInfo = predictionInfo;
463 return ctrl.sendMessageWithRequestId( 462 return ctrl.sendMessageWithRequestId(
464 params, 463 params,
465 _predictionServiceMethodGetPredictionListName, 464 _predictionServiceMethodGetPredictionListName,
466 -1, 465 -1,
467 bindings.MessageHeader.kMessageExpectsResponse); 466 bindings.MessageHeader.kMessageExpectsResponse);
468 } 467 }
469 } 468 }
470 469
471 470 class _PredictionServiceStubControl
472 class PredictionServiceStub extends bindings.Stub { 471 extends bindings.StubMessageHandler
472 implements bindings.StubControl<PredictionService> {
473 PredictionService _impl; 473 PredictionService _impl;
474 474
475 PredictionServiceStub.fromEndpoint( 475 _PredictionServiceStubControl.fromEndpoint(
476 core.MojoMessagePipeEndpoint endpoint, [PredictionService impl]) 476 core.MojoMessagePipeEndpoint endpoint, [PredictionService impl])
477 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 477 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
478 _impl = impl; 478 _impl = impl;
479 } 479 }
480 480
481 PredictionServiceStub.fromHandle( 481 _PredictionServiceStubControl.fromHandle(
482 core.MojoHandle handle, [PredictionService impl]) 482 core.MojoHandle handle, [PredictionService impl])
483 : super.fromHandle(handle, autoBegin: impl != null) { 483 : super.fromHandle(handle, autoBegin: impl != null) {
484 _impl = impl; 484 _impl = impl;
485 } 485 }
486 486
487 PredictionServiceStub.unbound([this._impl]) : super.unbound(); 487 _PredictionServiceStubControl.unbound([this._impl]) : super.unbound();
488
489 static PredictionServiceStub newFromEndpoint(
490 core.MojoMessagePipeEndpoint endpoint) {
491 assert(endpoint.setDescription("For PredictionServiceStub"));
492 return new PredictionServiceStub.fromEndpoint(endpoint);
493 }
494 488
495 489
496 PredictionServiceGetPredictionListResponseParams _predictionServiceGetPredicti onListResponseParamsFactory(List<String> predictionList) { 490 PredictionServiceGetPredictionListResponseParams _predictionServiceGetPredicti onListResponseParamsFactory(List<String> predictionList) {
497 var result = new PredictionServiceGetPredictionListResponseParams(); 491 var result = new PredictionServiceGetPredictionListResponseParams();
498 result.predictionList = predictionList; 492 result.predictionList = predictionList;
499 return result; 493 return result;
500 } 494 }
501 495
502 dynamic handleMessage(bindings.ServiceMessage message) { 496 dynamic handleMessage(bindings.ServiceMessage message) {
503 if (bindings.ControlMessageHandler.isControlMessage(message)) { 497 if (bindings.ControlMessageHandler.isControlMessage(message)) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } 544 }
551 545
552 @override 546 @override
553 void bind(core.MojoMessagePipeEndpoint endpoint) { 547 void bind(core.MojoMessagePipeEndpoint endpoint) {
554 super.bind(endpoint); 548 super.bind(endpoint);
555 if (!isOpen && (_impl != null)) { 549 if (!isOpen && (_impl != null)) {
556 beginHandlingEvents(); 550 beginHandlingEvents();
557 } 551 }
558 } 552 }
559 553
554 @override
560 String toString() { 555 String toString() {
561 var superString = super.toString(); 556 var superString = super.toString();
562 return "PredictionServiceStub($superString)"; 557 return "_PredictionServiceStubControl($superString)";
563 } 558 }
564 559
565 int get version => 0; 560 int get version => 0;
566 561
567 static service_describer.ServiceDescription _cachedServiceDescription; 562 static service_describer.ServiceDescription _cachedServiceDescription;
568 static service_describer.ServiceDescription get serviceDescription { 563 static service_describer.ServiceDescription get serviceDescription {
569 if (_cachedServiceDescription == null) { 564 if (_cachedServiceDescription == null) {
570 _cachedServiceDescription = new _PredictionServiceServiceDescription(); 565 _cachedServiceDescription = new _PredictionServiceServiceDescription();
571 } 566 }
572 return _cachedServiceDescription; 567 return _cachedServiceDescription;
573 } 568 }
574 } 569 }
575 570
571 class PredictionServiceStub
572 extends bindings.Stub<PredictionService>
573 implements PredictionService {
574 PredictionServiceStub.fromEndpoint(
575 core.MojoMessagePipeEndpoint endpoint, [PredictionService impl])
576 : super(new _PredictionServiceStubControl.fromEndpoint(endpoint, impl));
577
578 PredictionServiceStub.fromHandle(
579 core.MojoHandle handle, [PredictionService impl])
580 : super(new _PredictionServiceStubControl.fromHandle(handle, impl));
581
582 PredictionServiceStub.unbound([PredictionService impl])
583 : super(new _PredictionServiceStubControl.unbound(impl));
584
585 static PredictionServiceStub newFromEndpoint(
586 core.MojoMessagePipeEndpoint endpoint) {
587 assert(endpoint.setDescription("For PredictionServiceStub"));
588 return new PredictionServiceStub.fromEndpoint(endpoint);
589 }
590
591 static service_describer.ServiceDescription get serviceDescription =>
592 _PredictionServiceStubControl.serviceDescription;
593
594
595 dynamic getPredictionList(PredictionInfo predictionInfo,[Function responseFact ory = null]) {
596 return impl.getPredictionList(predictionInfo,responseFactory);
597 }
598 }
599
576 600
577 601
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698