| OLD | NEW |
| 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 490 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 501 impl.requireVersion(requiredVersion); | 501 impl.requireVersion(requiredVersion); |
| 502 } | 502 } |
| 503 | 503 |
| 504 String toString() { | 504 String toString() { |
| 505 return "PredictionServiceProxy($impl)"; | 505 return "PredictionServiceProxy($impl)"; |
| 506 } | 506 } |
| 507 } | 507 } |
| 508 | 508 |
| 509 | 509 |
| 510 class PredictionServiceStub extends bindings.Stub { | 510 class PredictionServiceStub extends bindings.Stub { |
| 511 PredictionService _impl = null; | 511 PredictionService _impl; |
| 512 | 512 |
| 513 PredictionServiceStub.fromEndpoint( | 513 PredictionServiceStub.fromEndpoint( |
| 514 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 514 core.MojoMessagePipeEndpoint endpoint, [PredictionService impl]) |
| 515 : super.fromEndpoint(endpoint); | 515 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 516 _impl = impl; |
| 517 } |
| 516 | 518 |
| 517 PredictionServiceStub.fromHandle(core.MojoHandle handle, [this._impl]) | 519 PredictionServiceStub.fromHandle( |
| 518 : super.fromHandle(handle); | 520 core.MojoHandle handle, [PredictionService impl]) |
| 521 : super.fromHandle(handle, autoBegin: impl != null) { |
| 522 _impl = impl; |
| 523 } |
| 519 | 524 |
| 520 PredictionServiceStub.unbound() : super.unbound(); | 525 PredictionServiceStub.unbound() : super.unbound(); |
| 521 | 526 |
| 522 static PredictionServiceStub newFromEndpoint( | 527 static PredictionServiceStub newFromEndpoint( |
| 523 core.MojoMessagePipeEndpoint endpoint) { | 528 core.MojoMessagePipeEndpoint endpoint) { |
| 524 assert(endpoint.setDescription("For PredictionServiceStub")); | 529 assert(endpoint.setDescription("For PredictionServiceStub")); |
| 525 return new PredictionServiceStub.fromEndpoint(endpoint); | 530 return new PredictionServiceStub.fromEndpoint(endpoint); |
| 526 } | 531 } |
| 527 | 532 |
| 528 | 533 |
| 529 PredictionServiceGetPredictionListResponseParams _predictionServiceGetPredicti
onListResponseParamsFactory(List<String> predictionList) { | 534 PredictionServiceGetPredictionListResponseParams _predictionServiceGetPredicti
onListResponseParamsFactory(List<String> predictionList) { |
| 530 var result = new PredictionServiceGetPredictionListResponseParams(); | 535 var result = new PredictionServiceGetPredictionListResponseParams(); |
| 531 result.predictionList = predictionList; | 536 result.predictionList = predictionList; |
| 532 return result; | 537 return result; |
| 533 } | 538 } |
| 534 | 539 |
| 535 dynamic handleMessage(bindings.ServiceMessage message) { | 540 dynamic handleMessage(bindings.ServiceMessage message) { |
| 536 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 541 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 537 return bindings.ControlMessageHandler.handleMessage(this, | 542 return bindings.ControlMessageHandler.handleMessage(this, |
| 538 0, | 543 0, |
| 539 message); | 544 message); |
| 540 } | 545 } |
| 541 assert(_impl != null); | 546 if (_impl == null) { |
| 547 throw new core.MojoApiError("$this has no implementation set"); |
| 548 } |
| 542 switch (message.header.type) { | 549 switch (message.header.type) { |
| 543 case _predictionServiceMethodGetPredictionListName: | 550 case _predictionServiceMethodGetPredictionListName: |
| 544 var params = _PredictionServiceGetPredictionListParams.deserialize( | 551 var params = _PredictionServiceGetPredictionListParams.deserialize( |
| 545 message.payload); | 552 message.payload); |
| 546 var response = _impl.getPredictionList(params.predictionInfo,_prediction
ServiceGetPredictionListResponseParamsFactory); | 553 var response = _impl.getPredictionList(params.predictionInfo,_prediction
ServiceGetPredictionListResponseParamsFactory); |
| 547 if (response is Future) { | 554 if (response is Future) { |
| 548 return response.then((response) { | 555 return response.then((response) { |
| 549 if (response != null) { | 556 if (response != null) { |
| 550 return buildResponseWithId( | 557 return buildResponseWithId( |
| 551 response, | 558 response, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 564 break; | 571 break; |
| 565 default: | 572 default: |
| 566 throw new bindings.MojoCodecError("Unexpected message name"); | 573 throw new bindings.MojoCodecError("Unexpected message name"); |
| 567 break; | 574 break; |
| 568 } | 575 } |
| 569 return null; | 576 return null; |
| 570 } | 577 } |
| 571 | 578 |
| 572 PredictionService get impl => _impl; | 579 PredictionService get impl => _impl; |
| 573 set impl(PredictionService d) { | 580 set impl(PredictionService d) { |
| 574 assert(_impl == null); | 581 if (d == null) { |
| 582 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 583 } |
| 584 if (isBound && (_impl == null)) { |
| 585 beginHandlingEvents(); |
| 586 } |
| 575 _impl = d; | 587 _impl = d; |
| 576 } | 588 } |
| 577 | 589 |
| 590 @override |
| 591 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 592 super.bind(endpoint); |
| 593 if (!isOpen && (_impl != null)) { |
| 594 beginHandlingEvents(); |
| 595 } |
| 596 } |
| 597 |
| 578 String toString() { | 598 String toString() { |
| 579 var superString = super.toString(); | 599 var superString = super.toString(); |
| 580 return "PredictionServiceStub($superString)"; | 600 return "PredictionServiceStub($superString)"; |
| 581 } | 601 } |
| 582 | 602 |
| 583 int get version => 0; | 603 int get version => 0; |
| 584 | 604 |
| 585 static service_describer.ServiceDescription _cachedServiceDescription; | 605 static service_describer.ServiceDescription _cachedServiceDescription; |
| 586 static service_describer.ServiceDescription get serviceDescription { | 606 static service_describer.ServiceDescription get serviceDescription { |
| 587 if (_cachedServiceDescription == null) { | 607 if (_cachedServiceDescription == null) { |
| 588 _cachedServiceDescription = new _PredictionServiceServiceDescription(); | 608 _cachedServiceDescription = new _PredictionServiceServiceDescription(); |
| 589 } | 609 } |
| 590 return _cachedServiceDescription; | 610 return _cachedServiceDescription; |
| 591 } | 611 } |
| 592 } | 612 } |
| 593 | 613 |
| 594 | 614 |
| 595 | 615 |
| OLD | NEW |