| 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 tracing_mojom; | 5 library tracing_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 |
| 11 | 11 |
| 12 | 12 |
| 13 class _TraceProviderStartTracingParams extends bindings.Struct { | 13 class _TraceProviderStartTracingParams extends bindings.Struct { |
| 14 static const List<bindings.StructDataHeader> kVersions = const [ | 14 static const List<bindings.StructDataHeader> kVersions = const [ |
| 15 const bindings.StructDataHeader(24, 0) | 15 const bindings.StructDataHeader(24, 0) |
| 16 ]; | 16 ]; |
| 17 String categories = null; | 17 String categories = null; |
| 18 Object recorder = null; | 18 TraceRecorderInterface recorder = null; |
| 19 | 19 |
| 20 _TraceProviderStartTracingParams() : super(kVersions.last.size); | 20 _TraceProviderStartTracingParams() : super(kVersions.last.size); |
| 21 | 21 |
| 22 static _TraceProviderStartTracingParams deserialize(bindings.Message message)
{ | 22 static _TraceProviderStartTracingParams deserialize(bindings.Message message)
{ |
| 23 var decoder = new bindings.Decoder(message); | 23 var decoder = new bindings.Decoder(message); |
| 24 var result = decode(decoder); | 24 var result = decode(decoder); |
| 25 if (decoder.excessHandles != null) { | 25 if (decoder.excessHandles != null) { |
| 26 decoder.excessHandles.forEach((h) => h.close()); | 26 decoder.excessHandles.forEach((h) => h.close()); |
| 27 } | 27 } |
| 28 return result; | 28 return result; |
| (...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 | 374 |
| 375 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 375 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
| 376 responseFactory(null); | 376 responseFactory(null); |
| 377 | 377 |
| 378 dynamic getAllTypeDefinitions([Function responseFactory]) => | 378 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 379 responseFactory(null); | 379 responseFactory(null); |
| 380 } | 380 } |
| 381 | 381 |
| 382 abstract class TraceProvider { | 382 abstract class TraceProvider { |
| 383 static const String serviceName = "tracing::TraceProvider"; | 383 static const String serviceName = "tracing::TraceProvider"; |
| 384 void startTracing(String categories, Object recorder); | 384 |
| 385 static service_describer.ServiceDescription _cachedServiceDescription; |
| 386 static service_describer.ServiceDescription get serviceDescription { |
| 387 if (_cachedServiceDescription == null) { |
| 388 _cachedServiceDescription = new _TraceProviderServiceDescription(); |
| 389 } |
| 390 return _cachedServiceDescription; |
| 391 } |
| 392 |
| 393 static TraceProviderProxy connectToService( |
| 394 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 395 TraceProviderProxy p = new TraceProviderProxy.unbound(); |
| 396 String name = serviceName ?? TraceProvider.serviceName; |
| 397 if ((name == null) || name.isEmpty) { |
| 398 throw new core.MojoApiError( |
| 399 "If an interface has no ServiceName, then one must be provided."); |
| 400 } |
| 401 s.connectToService(url, p, name); |
| 402 return p; |
| 403 } |
| 404 void startTracing(String categories, TraceRecorderInterface recorder); |
| 385 void stopTracing(); | 405 void stopTracing(); |
| 386 } | 406 } |
| 387 | 407 |
| 408 abstract class TraceProviderInterface |
| 409 implements bindings.MojoInterface<TraceProvider>, |
| 410 TraceProvider { |
| 411 factory TraceProviderInterface([TraceProvider impl]) => |
| 412 new TraceProviderStub.unbound(impl); |
| 413 factory TraceProviderInterface.fromEndpoint( |
| 414 core.MojoMessagePipeEndpoint endpoint, |
| 415 [TraceProvider impl]) => |
| 416 new TraceProviderStub.fromEndpoint(endpoint, impl); |
| 417 } |
| 418 |
| 419 abstract class TraceProviderInterfaceRequest |
| 420 implements bindings.MojoInterface<TraceProvider>, |
| 421 TraceProvider { |
| 422 factory TraceProviderInterfaceRequest() => |
| 423 new TraceProviderProxy.unbound(); |
| 424 } |
| 425 |
| 388 class _TraceProviderProxyControl | 426 class _TraceProviderProxyControl |
| 389 extends bindings.ProxyMessageHandler | 427 extends bindings.ProxyMessageHandler |
| 390 implements bindings.ProxyControl { | 428 implements bindings.ProxyControl<TraceProvider> { |
| 391 _TraceProviderProxyControl.fromEndpoint( | 429 _TraceProviderProxyControl.fromEndpoint( |
| 392 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 430 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 393 | 431 |
| 394 _TraceProviderProxyControl.fromHandle( | 432 _TraceProviderProxyControl.fromHandle( |
| 395 core.MojoHandle handle) : super.fromHandle(handle); | 433 core.MojoHandle handle) : super.fromHandle(handle); |
| 396 | 434 |
| 397 _TraceProviderProxyControl.unbound() : super.unbound(); | 435 _TraceProviderProxyControl.unbound() : super.unbound(); |
| 398 | 436 |
| 399 service_describer.ServiceDescription get serviceDescription => | |
| 400 new _TraceProviderServiceDescription(); | |
| 401 | |
| 402 String get serviceName => TraceProvider.serviceName; | 437 String get serviceName => TraceProvider.serviceName; |
| 403 | 438 |
| 404 void handleResponse(bindings.ServiceMessage message) { | 439 void handleResponse(bindings.ServiceMessage message) { |
| 405 switch (message.header.type) { | 440 switch (message.header.type) { |
| 406 default: | 441 default: |
| 407 proxyError("Unexpected message type: ${message.header.type}"); | 442 proxyError("Unexpected message type: ${message.header.type}"); |
| 408 close(immediate: true); | 443 close(immediate: true); |
| 409 break; | 444 break; |
| 410 } | 445 } |
| 411 } | 446 } |
| 412 | 447 |
| 448 TraceProvider get impl => null; |
| 449 set impl(TraceProvider _) { |
| 450 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 451 } |
| 452 |
| 413 @override | 453 @override |
| 414 String toString() { | 454 String toString() { |
| 415 var superString = super.toString(); | 455 var superString = super.toString(); |
| 416 return "_TraceProviderProxyControl($superString)"; | 456 return "_TraceProviderProxyControl($superString)"; |
| 417 } | 457 } |
| 418 } | 458 } |
| 419 | 459 |
| 420 class TraceProviderProxy | 460 class TraceProviderProxy |
| 421 extends bindings.Proxy | 461 extends bindings.Proxy<TraceProvider> |
| 422 implements TraceProvider { | 462 implements TraceProvider, |
| 463 TraceProviderInterface, |
| 464 TraceProviderInterfaceRequest { |
| 423 TraceProviderProxy.fromEndpoint( | 465 TraceProviderProxy.fromEndpoint( |
| 424 core.MojoMessagePipeEndpoint endpoint) | 466 core.MojoMessagePipeEndpoint endpoint) |
| 425 : super(new _TraceProviderProxyControl.fromEndpoint(endpoint)); | 467 : super(new _TraceProviderProxyControl.fromEndpoint(endpoint)); |
| 426 | 468 |
| 427 TraceProviderProxy.fromHandle(core.MojoHandle handle) | 469 TraceProviderProxy.fromHandle(core.MojoHandle handle) |
| 428 : super(new _TraceProviderProxyControl.fromHandle(handle)); | 470 : super(new _TraceProviderProxyControl.fromHandle(handle)); |
| 429 | 471 |
| 430 TraceProviderProxy.unbound() | 472 TraceProviderProxy.unbound() |
| 431 : super(new _TraceProviderProxyControl.unbound()); | 473 : super(new _TraceProviderProxyControl.unbound()); |
| 432 | 474 |
| 433 static TraceProviderProxy newFromEndpoint( | 475 static TraceProviderProxy newFromEndpoint( |
| 434 core.MojoMessagePipeEndpoint endpoint) { | 476 core.MojoMessagePipeEndpoint endpoint) { |
| 435 assert(endpoint.setDescription("For TraceProviderProxy")); | 477 assert(endpoint.setDescription("For TraceProviderProxy")); |
| 436 return new TraceProviderProxy.fromEndpoint(endpoint); | 478 return new TraceProviderProxy.fromEndpoint(endpoint); |
| 437 } | 479 } |
| 438 | 480 |
| 439 factory TraceProviderProxy.connectToService( | |
| 440 bindings.ServiceConnector s, String url, [String serviceName]) { | |
| 441 TraceProviderProxy p = new TraceProviderProxy.unbound(); | |
| 442 s.connectToService(url, p, serviceName); | |
| 443 return p; | |
| 444 } | |
| 445 | 481 |
| 446 | 482 void startTracing(String categories, TraceRecorderInterface recorder) { |
| 447 void startTracing(String categories, Object recorder) { | |
| 448 if (!ctrl.isBound) { | 483 if (!ctrl.isBound) { |
| 449 ctrl.proxyError("The Proxy is closed."); | 484 ctrl.proxyError("The Proxy is closed."); |
| 450 return; | 485 return; |
| 451 } | 486 } |
| 452 var params = new _TraceProviderStartTracingParams(); | 487 var params = new _TraceProviderStartTracingParams(); |
| 453 params.categories = categories; | 488 params.categories = categories; |
| 454 params.recorder = recorder; | 489 params.recorder = recorder; |
| 455 ctrl.sendMessage(params, | 490 ctrl.sendMessage(params, |
| 456 _traceProviderMethodStartTracingName); | 491 _traceProviderMethodStartTracingName); |
| 457 } | 492 } |
| (...skipping 20 matching lines...) Expand all Loading... |
| 478 } | 513 } |
| 479 | 514 |
| 480 _TraceProviderStubControl.fromHandle( | 515 _TraceProviderStubControl.fromHandle( |
| 481 core.MojoHandle handle, [TraceProvider impl]) | 516 core.MojoHandle handle, [TraceProvider impl]) |
| 482 : super.fromHandle(handle, autoBegin: impl != null) { | 517 : super.fromHandle(handle, autoBegin: impl != null) { |
| 483 _impl = impl; | 518 _impl = impl; |
| 484 } | 519 } |
| 485 | 520 |
| 486 _TraceProviderStubControl.unbound([this._impl]) : super.unbound(); | 521 _TraceProviderStubControl.unbound([this._impl]) : super.unbound(); |
| 487 | 522 |
| 523 String get serviceName => TraceProvider.serviceName; |
| 524 |
| 488 | 525 |
| 489 | 526 |
| 490 dynamic handleMessage(bindings.ServiceMessage message) { | 527 dynamic handleMessage(bindings.ServiceMessage message) { |
| 491 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 528 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 492 return bindings.ControlMessageHandler.handleMessage(this, | 529 return bindings.ControlMessageHandler.handleMessage(this, |
| 493 0, | 530 0, |
| 494 message); | 531 message); |
| 495 } | 532 } |
| 496 if (_impl == null) { | 533 if (_impl == null) { |
| 497 throw new core.MojoApiError("$this has no implementation set"); | 534 throw new core.MojoApiError("$this has no implementation set"); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 531 } | 568 } |
| 532 } | 569 } |
| 533 | 570 |
| 534 @override | 571 @override |
| 535 String toString() { | 572 String toString() { |
| 536 var superString = super.toString(); | 573 var superString = super.toString(); |
| 537 return "_TraceProviderStubControl($superString)"; | 574 return "_TraceProviderStubControl($superString)"; |
| 538 } | 575 } |
| 539 | 576 |
| 540 int get version => 0; | 577 int get version => 0; |
| 541 | |
| 542 static service_describer.ServiceDescription _cachedServiceDescription; | |
| 543 static service_describer.ServiceDescription get serviceDescription { | |
| 544 if (_cachedServiceDescription == null) { | |
| 545 _cachedServiceDescription = new _TraceProviderServiceDescription(); | |
| 546 } | |
| 547 return _cachedServiceDescription; | |
| 548 } | |
| 549 } | 578 } |
| 550 | 579 |
| 551 class TraceProviderStub | 580 class TraceProviderStub |
| 552 extends bindings.Stub<TraceProvider> | 581 extends bindings.Stub<TraceProvider> |
| 553 implements TraceProvider { | 582 implements TraceProvider, |
| 583 TraceProviderInterface, |
| 584 TraceProviderInterfaceRequest { |
| 585 TraceProviderStub.unbound([TraceProvider impl]) |
| 586 : super(new _TraceProviderStubControl.unbound(impl)); |
| 587 |
| 554 TraceProviderStub.fromEndpoint( | 588 TraceProviderStub.fromEndpoint( |
| 555 core.MojoMessagePipeEndpoint endpoint, [TraceProvider impl]) | 589 core.MojoMessagePipeEndpoint endpoint, [TraceProvider impl]) |
| 556 : super(new _TraceProviderStubControl.fromEndpoint(endpoint, impl)); | 590 : super(new _TraceProviderStubControl.fromEndpoint(endpoint, impl)); |
| 557 | 591 |
| 558 TraceProviderStub.fromHandle( | 592 TraceProviderStub.fromHandle( |
| 559 core.MojoHandle handle, [TraceProvider impl]) | 593 core.MojoHandle handle, [TraceProvider impl]) |
| 560 : super(new _TraceProviderStubControl.fromHandle(handle, impl)); | 594 : super(new _TraceProviderStubControl.fromHandle(handle, impl)); |
| 561 | 595 |
| 562 TraceProviderStub.unbound([TraceProvider impl]) | |
| 563 : super(new _TraceProviderStubControl.unbound(impl)); | |
| 564 | |
| 565 static TraceProviderStub newFromEndpoint( | 596 static TraceProviderStub newFromEndpoint( |
| 566 core.MojoMessagePipeEndpoint endpoint) { | 597 core.MojoMessagePipeEndpoint endpoint) { |
| 567 assert(endpoint.setDescription("For TraceProviderStub")); | 598 assert(endpoint.setDescription("For TraceProviderStub")); |
| 568 return new TraceProviderStub.fromEndpoint(endpoint); | 599 return new TraceProviderStub.fromEndpoint(endpoint); |
| 569 } | 600 } |
| 570 | 601 |
| 571 static service_describer.ServiceDescription get serviceDescription => | |
| 572 _TraceProviderStubControl.serviceDescription; | |
| 573 | 602 |
| 574 | 603 void startTracing(String categories, TraceRecorderInterface recorder) { |
| 575 void startTracing(String categories, Object recorder) { | |
| 576 return impl.startTracing(categories, recorder); | 604 return impl.startTracing(categories, recorder); |
| 577 } | 605 } |
| 578 void stopTracing() { | 606 void stopTracing() { |
| 579 return impl.stopTracing(); | 607 return impl.stopTracing(); |
| 580 } | 608 } |
| 581 } | 609 } |
| 582 | 610 |
| 583 const int _traceRecorderMethodRecordName = 0; | 611 const int _traceRecorderMethodRecordName = 0; |
| 584 | 612 |
| 585 class _TraceRecorderServiceDescription implements service_describer.ServiceDescr
iption { | 613 class _TraceRecorderServiceDescription implements service_describer.ServiceDescr
iption { |
| 586 dynamic getTopLevelInterface([Function responseFactory]) => | 614 dynamic getTopLevelInterface([Function responseFactory]) => |
| 587 responseFactory(null); | 615 responseFactory(null); |
| 588 | 616 |
| 589 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 617 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
| 590 responseFactory(null); | 618 responseFactory(null); |
| 591 | 619 |
| 592 dynamic getAllTypeDefinitions([Function responseFactory]) => | 620 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 593 responseFactory(null); | 621 responseFactory(null); |
| 594 } | 622 } |
| 595 | 623 |
| 596 abstract class TraceRecorder { | 624 abstract class TraceRecorder { |
| 597 static const String serviceName = null; | 625 static const String serviceName = null; |
| 626 |
| 627 static service_describer.ServiceDescription _cachedServiceDescription; |
| 628 static service_describer.ServiceDescription get serviceDescription { |
| 629 if (_cachedServiceDescription == null) { |
| 630 _cachedServiceDescription = new _TraceRecorderServiceDescription(); |
| 631 } |
| 632 return _cachedServiceDescription; |
| 633 } |
| 634 |
| 635 static TraceRecorderProxy connectToService( |
| 636 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 637 TraceRecorderProxy p = new TraceRecorderProxy.unbound(); |
| 638 String name = serviceName ?? TraceRecorder.serviceName; |
| 639 if ((name == null) || name.isEmpty) { |
| 640 throw new core.MojoApiError( |
| 641 "If an interface has no ServiceName, then one must be provided."); |
| 642 } |
| 643 s.connectToService(url, p, name); |
| 644 return p; |
| 645 } |
| 598 void record(String json); | 646 void record(String json); |
| 599 } | 647 } |
| 600 | 648 |
| 649 abstract class TraceRecorderInterface |
| 650 implements bindings.MojoInterface<TraceRecorder>, |
| 651 TraceRecorder { |
| 652 factory TraceRecorderInterface([TraceRecorder impl]) => |
| 653 new TraceRecorderStub.unbound(impl); |
| 654 factory TraceRecorderInterface.fromEndpoint( |
| 655 core.MojoMessagePipeEndpoint endpoint, |
| 656 [TraceRecorder impl]) => |
| 657 new TraceRecorderStub.fromEndpoint(endpoint, impl); |
| 658 } |
| 659 |
| 660 abstract class TraceRecorderInterfaceRequest |
| 661 implements bindings.MojoInterface<TraceRecorder>, |
| 662 TraceRecorder { |
| 663 factory TraceRecorderInterfaceRequest() => |
| 664 new TraceRecorderProxy.unbound(); |
| 665 } |
| 666 |
| 601 class _TraceRecorderProxyControl | 667 class _TraceRecorderProxyControl |
| 602 extends bindings.ProxyMessageHandler | 668 extends bindings.ProxyMessageHandler |
| 603 implements bindings.ProxyControl { | 669 implements bindings.ProxyControl<TraceRecorder> { |
| 604 _TraceRecorderProxyControl.fromEndpoint( | 670 _TraceRecorderProxyControl.fromEndpoint( |
| 605 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 671 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 606 | 672 |
| 607 _TraceRecorderProxyControl.fromHandle( | 673 _TraceRecorderProxyControl.fromHandle( |
| 608 core.MojoHandle handle) : super.fromHandle(handle); | 674 core.MojoHandle handle) : super.fromHandle(handle); |
| 609 | 675 |
| 610 _TraceRecorderProxyControl.unbound() : super.unbound(); | 676 _TraceRecorderProxyControl.unbound() : super.unbound(); |
| 611 | 677 |
| 612 service_describer.ServiceDescription get serviceDescription => | |
| 613 new _TraceRecorderServiceDescription(); | |
| 614 | |
| 615 String get serviceName => TraceRecorder.serviceName; | 678 String get serviceName => TraceRecorder.serviceName; |
| 616 | 679 |
| 617 void handleResponse(bindings.ServiceMessage message) { | 680 void handleResponse(bindings.ServiceMessage message) { |
| 618 switch (message.header.type) { | 681 switch (message.header.type) { |
| 619 default: | 682 default: |
| 620 proxyError("Unexpected message type: ${message.header.type}"); | 683 proxyError("Unexpected message type: ${message.header.type}"); |
| 621 close(immediate: true); | 684 close(immediate: true); |
| 622 break; | 685 break; |
| 623 } | 686 } |
| 624 } | 687 } |
| 625 | 688 |
| 689 TraceRecorder get impl => null; |
| 690 set impl(TraceRecorder _) { |
| 691 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 692 } |
| 693 |
| 626 @override | 694 @override |
| 627 String toString() { | 695 String toString() { |
| 628 var superString = super.toString(); | 696 var superString = super.toString(); |
| 629 return "_TraceRecorderProxyControl($superString)"; | 697 return "_TraceRecorderProxyControl($superString)"; |
| 630 } | 698 } |
| 631 } | 699 } |
| 632 | 700 |
| 633 class TraceRecorderProxy | 701 class TraceRecorderProxy |
| 634 extends bindings.Proxy | 702 extends bindings.Proxy<TraceRecorder> |
| 635 implements TraceRecorder { | 703 implements TraceRecorder, |
| 704 TraceRecorderInterface, |
| 705 TraceRecorderInterfaceRequest { |
| 636 TraceRecorderProxy.fromEndpoint( | 706 TraceRecorderProxy.fromEndpoint( |
| 637 core.MojoMessagePipeEndpoint endpoint) | 707 core.MojoMessagePipeEndpoint endpoint) |
| 638 : super(new _TraceRecorderProxyControl.fromEndpoint(endpoint)); | 708 : super(new _TraceRecorderProxyControl.fromEndpoint(endpoint)); |
| 639 | 709 |
| 640 TraceRecorderProxy.fromHandle(core.MojoHandle handle) | 710 TraceRecorderProxy.fromHandle(core.MojoHandle handle) |
| 641 : super(new _TraceRecorderProxyControl.fromHandle(handle)); | 711 : super(new _TraceRecorderProxyControl.fromHandle(handle)); |
| 642 | 712 |
| 643 TraceRecorderProxy.unbound() | 713 TraceRecorderProxy.unbound() |
| 644 : super(new _TraceRecorderProxyControl.unbound()); | 714 : super(new _TraceRecorderProxyControl.unbound()); |
| 645 | 715 |
| 646 static TraceRecorderProxy newFromEndpoint( | 716 static TraceRecorderProxy newFromEndpoint( |
| 647 core.MojoMessagePipeEndpoint endpoint) { | 717 core.MojoMessagePipeEndpoint endpoint) { |
| 648 assert(endpoint.setDescription("For TraceRecorderProxy")); | 718 assert(endpoint.setDescription("For TraceRecorderProxy")); |
| 649 return new TraceRecorderProxy.fromEndpoint(endpoint); | 719 return new TraceRecorderProxy.fromEndpoint(endpoint); |
| 650 } | 720 } |
| 651 | 721 |
| 652 factory TraceRecorderProxy.connectToService( | |
| 653 bindings.ServiceConnector s, String url, [String serviceName]) { | |
| 654 TraceRecorderProxy p = new TraceRecorderProxy.unbound(); | |
| 655 s.connectToService(url, p, serviceName); | |
| 656 return p; | |
| 657 } | |
| 658 | |
| 659 | 722 |
| 660 void record(String json) { | 723 void record(String json) { |
| 661 if (!ctrl.isBound) { | 724 if (!ctrl.isBound) { |
| 662 ctrl.proxyError("The Proxy is closed."); | 725 ctrl.proxyError("The Proxy is closed."); |
| 663 return; | 726 return; |
| 664 } | 727 } |
| 665 var params = new _TraceRecorderRecordParams(); | 728 var params = new _TraceRecorderRecordParams(); |
| 666 params.json = json; | 729 params.json = json; |
| 667 ctrl.sendMessage(params, | 730 ctrl.sendMessage(params, |
| 668 _traceRecorderMethodRecordName); | 731 _traceRecorderMethodRecordName); |
| (...skipping 12 matching lines...) Expand all Loading... |
| 681 } | 744 } |
| 682 | 745 |
| 683 _TraceRecorderStubControl.fromHandle( | 746 _TraceRecorderStubControl.fromHandle( |
| 684 core.MojoHandle handle, [TraceRecorder impl]) | 747 core.MojoHandle handle, [TraceRecorder impl]) |
| 685 : super.fromHandle(handle, autoBegin: impl != null) { | 748 : super.fromHandle(handle, autoBegin: impl != null) { |
| 686 _impl = impl; | 749 _impl = impl; |
| 687 } | 750 } |
| 688 | 751 |
| 689 _TraceRecorderStubControl.unbound([this._impl]) : super.unbound(); | 752 _TraceRecorderStubControl.unbound([this._impl]) : super.unbound(); |
| 690 | 753 |
| 754 String get serviceName => TraceRecorder.serviceName; |
| 755 |
| 691 | 756 |
| 692 | 757 |
| 693 dynamic handleMessage(bindings.ServiceMessage message) { | 758 dynamic handleMessage(bindings.ServiceMessage message) { |
| 694 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 759 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 695 return bindings.ControlMessageHandler.handleMessage(this, | 760 return bindings.ControlMessageHandler.handleMessage(this, |
| 696 0, | 761 0, |
| 697 message); | 762 message); |
| 698 } | 763 } |
| 699 if (_impl == null) { | 764 if (_impl == null) { |
| 700 throw new core.MojoApiError("$this has no implementation set"); | 765 throw new core.MojoApiError("$this has no implementation set"); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 731 } | 796 } |
| 732 } | 797 } |
| 733 | 798 |
| 734 @override | 799 @override |
| 735 String toString() { | 800 String toString() { |
| 736 var superString = super.toString(); | 801 var superString = super.toString(); |
| 737 return "_TraceRecorderStubControl($superString)"; | 802 return "_TraceRecorderStubControl($superString)"; |
| 738 } | 803 } |
| 739 | 804 |
| 740 int get version => 0; | 805 int get version => 0; |
| 741 | |
| 742 static service_describer.ServiceDescription _cachedServiceDescription; | |
| 743 static service_describer.ServiceDescription get serviceDescription { | |
| 744 if (_cachedServiceDescription == null) { | |
| 745 _cachedServiceDescription = new _TraceRecorderServiceDescription(); | |
| 746 } | |
| 747 return _cachedServiceDescription; | |
| 748 } | |
| 749 } | 806 } |
| 750 | 807 |
| 751 class TraceRecorderStub | 808 class TraceRecorderStub |
| 752 extends bindings.Stub<TraceRecorder> | 809 extends bindings.Stub<TraceRecorder> |
| 753 implements TraceRecorder { | 810 implements TraceRecorder, |
| 811 TraceRecorderInterface, |
| 812 TraceRecorderInterfaceRequest { |
| 813 TraceRecorderStub.unbound([TraceRecorder impl]) |
| 814 : super(new _TraceRecorderStubControl.unbound(impl)); |
| 815 |
| 754 TraceRecorderStub.fromEndpoint( | 816 TraceRecorderStub.fromEndpoint( |
| 755 core.MojoMessagePipeEndpoint endpoint, [TraceRecorder impl]) | 817 core.MojoMessagePipeEndpoint endpoint, [TraceRecorder impl]) |
| 756 : super(new _TraceRecorderStubControl.fromEndpoint(endpoint, impl)); | 818 : super(new _TraceRecorderStubControl.fromEndpoint(endpoint, impl)); |
| 757 | 819 |
| 758 TraceRecorderStub.fromHandle( | 820 TraceRecorderStub.fromHandle( |
| 759 core.MojoHandle handle, [TraceRecorder impl]) | 821 core.MojoHandle handle, [TraceRecorder impl]) |
| 760 : super(new _TraceRecorderStubControl.fromHandle(handle, impl)); | 822 : super(new _TraceRecorderStubControl.fromHandle(handle, impl)); |
| 761 | 823 |
| 762 TraceRecorderStub.unbound([TraceRecorder impl]) | |
| 763 : super(new _TraceRecorderStubControl.unbound(impl)); | |
| 764 | |
| 765 static TraceRecorderStub newFromEndpoint( | 824 static TraceRecorderStub newFromEndpoint( |
| 766 core.MojoMessagePipeEndpoint endpoint) { | 825 core.MojoMessagePipeEndpoint endpoint) { |
| 767 assert(endpoint.setDescription("For TraceRecorderStub")); | 826 assert(endpoint.setDescription("For TraceRecorderStub")); |
| 768 return new TraceRecorderStub.fromEndpoint(endpoint); | 827 return new TraceRecorderStub.fromEndpoint(endpoint); |
| 769 } | 828 } |
| 770 | 829 |
| 771 static service_describer.ServiceDescription get serviceDescription => | |
| 772 _TraceRecorderStubControl.serviceDescription; | |
| 773 | |
| 774 | 830 |
| 775 void record(String json) { | 831 void record(String json) { |
| 776 return impl.record(json); | 832 return impl.record(json); |
| 777 } | 833 } |
| 778 } | 834 } |
| 779 | 835 |
| 780 const int _traceCollectorMethodStartName = 0; | 836 const int _traceCollectorMethodStartName = 0; |
| 781 const int _traceCollectorMethodStopAndFlushName = 1; | 837 const int _traceCollectorMethodStopAndFlushName = 1; |
| 782 | 838 |
| 783 class _TraceCollectorServiceDescription implements service_describer.ServiceDesc
ription { | 839 class _TraceCollectorServiceDescription implements service_describer.ServiceDesc
ription { |
| 784 dynamic getTopLevelInterface([Function responseFactory]) => | 840 dynamic getTopLevelInterface([Function responseFactory]) => |
| 785 responseFactory(null); | 841 responseFactory(null); |
| 786 | 842 |
| 787 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => | 843 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => |
| 788 responseFactory(null); | 844 responseFactory(null); |
| 789 | 845 |
| 790 dynamic getAllTypeDefinitions([Function responseFactory]) => | 846 dynamic getAllTypeDefinitions([Function responseFactory]) => |
| 791 responseFactory(null); | 847 responseFactory(null); |
| 792 } | 848 } |
| 793 | 849 |
| 794 abstract class TraceCollector { | 850 abstract class TraceCollector { |
| 795 static const String serviceName = "tracing::TraceCollector"; | 851 static const String serviceName = "tracing::TraceCollector"; |
| 852 |
| 853 static service_describer.ServiceDescription _cachedServiceDescription; |
| 854 static service_describer.ServiceDescription get serviceDescription { |
| 855 if (_cachedServiceDescription == null) { |
| 856 _cachedServiceDescription = new _TraceCollectorServiceDescription(); |
| 857 } |
| 858 return _cachedServiceDescription; |
| 859 } |
| 860 |
| 861 static TraceCollectorProxy connectToService( |
| 862 bindings.ServiceConnector s, String url, [String serviceName]) { |
| 863 TraceCollectorProxy p = new TraceCollectorProxy.unbound(); |
| 864 String name = serviceName ?? TraceCollector.serviceName; |
| 865 if ((name == null) || name.isEmpty) { |
| 866 throw new core.MojoApiError( |
| 867 "If an interface has no ServiceName, then one must be provided."); |
| 868 } |
| 869 s.connectToService(url, p, name); |
| 870 return p; |
| 871 } |
| 796 void start(core.MojoDataPipeProducer stream, String categories); | 872 void start(core.MojoDataPipeProducer stream, String categories); |
| 797 void stopAndFlush(); | 873 void stopAndFlush(); |
| 798 } | 874 } |
| 799 | 875 |
| 876 abstract class TraceCollectorInterface |
| 877 implements bindings.MojoInterface<TraceCollector>, |
| 878 TraceCollector { |
| 879 factory TraceCollectorInterface([TraceCollector impl]) => |
| 880 new TraceCollectorStub.unbound(impl); |
| 881 factory TraceCollectorInterface.fromEndpoint( |
| 882 core.MojoMessagePipeEndpoint endpoint, |
| 883 [TraceCollector impl]) => |
| 884 new TraceCollectorStub.fromEndpoint(endpoint, impl); |
| 885 } |
| 886 |
| 887 abstract class TraceCollectorInterfaceRequest |
| 888 implements bindings.MojoInterface<TraceCollector>, |
| 889 TraceCollector { |
| 890 factory TraceCollectorInterfaceRequest() => |
| 891 new TraceCollectorProxy.unbound(); |
| 892 } |
| 893 |
| 800 class _TraceCollectorProxyControl | 894 class _TraceCollectorProxyControl |
| 801 extends bindings.ProxyMessageHandler | 895 extends bindings.ProxyMessageHandler |
| 802 implements bindings.ProxyControl { | 896 implements bindings.ProxyControl<TraceCollector> { |
| 803 _TraceCollectorProxyControl.fromEndpoint( | 897 _TraceCollectorProxyControl.fromEndpoint( |
| 804 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 898 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 805 | 899 |
| 806 _TraceCollectorProxyControl.fromHandle( | 900 _TraceCollectorProxyControl.fromHandle( |
| 807 core.MojoHandle handle) : super.fromHandle(handle); | 901 core.MojoHandle handle) : super.fromHandle(handle); |
| 808 | 902 |
| 809 _TraceCollectorProxyControl.unbound() : super.unbound(); | 903 _TraceCollectorProxyControl.unbound() : super.unbound(); |
| 810 | 904 |
| 811 service_describer.ServiceDescription get serviceDescription => | |
| 812 new _TraceCollectorServiceDescription(); | |
| 813 | |
| 814 String get serviceName => TraceCollector.serviceName; | 905 String get serviceName => TraceCollector.serviceName; |
| 815 | 906 |
| 816 void handleResponse(bindings.ServiceMessage message) { | 907 void handleResponse(bindings.ServiceMessage message) { |
| 817 switch (message.header.type) { | 908 switch (message.header.type) { |
| 818 default: | 909 default: |
| 819 proxyError("Unexpected message type: ${message.header.type}"); | 910 proxyError("Unexpected message type: ${message.header.type}"); |
| 820 close(immediate: true); | 911 close(immediate: true); |
| 821 break; | 912 break; |
| 822 } | 913 } |
| 823 } | 914 } |
| 824 | 915 |
| 916 TraceCollector get impl => null; |
| 917 set impl(TraceCollector _) { |
| 918 throw new core.MojoApiError("The impl of a Proxy cannot be set."); |
| 919 } |
| 920 |
| 825 @override | 921 @override |
| 826 String toString() { | 922 String toString() { |
| 827 var superString = super.toString(); | 923 var superString = super.toString(); |
| 828 return "_TraceCollectorProxyControl($superString)"; | 924 return "_TraceCollectorProxyControl($superString)"; |
| 829 } | 925 } |
| 830 } | 926 } |
| 831 | 927 |
| 832 class TraceCollectorProxy | 928 class TraceCollectorProxy |
| 833 extends bindings.Proxy | 929 extends bindings.Proxy<TraceCollector> |
| 834 implements TraceCollector { | 930 implements TraceCollector, |
| 931 TraceCollectorInterface, |
| 932 TraceCollectorInterfaceRequest { |
| 835 TraceCollectorProxy.fromEndpoint( | 933 TraceCollectorProxy.fromEndpoint( |
| 836 core.MojoMessagePipeEndpoint endpoint) | 934 core.MojoMessagePipeEndpoint endpoint) |
| 837 : super(new _TraceCollectorProxyControl.fromEndpoint(endpoint)); | 935 : super(new _TraceCollectorProxyControl.fromEndpoint(endpoint)); |
| 838 | 936 |
| 839 TraceCollectorProxy.fromHandle(core.MojoHandle handle) | 937 TraceCollectorProxy.fromHandle(core.MojoHandle handle) |
| 840 : super(new _TraceCollectorProxyControl.fromHandle(handle)); | 938 : super(new _TraceCollectorProxyControl.fromHandle(handle)); |
| 841 | 939 |
| 842 TraceCollectorProxy.unbound() | 940 TraceCollectorProxy.unbound() |
| 843 : super(new _TraceCollectorProxyControl.unbound()); | 941 : super(new _TraceCollectorProxyControl.unbound()); |
| 844 | 942 |
| 845 static TraceCollectorProxy newFromEndpoint( | 943 static TraceCollectorProxy newFromEndpoint( |
| 846 core.MojoMessagePipeEndpoint endpoint) { | 944 core.MojoMessagePipeEndpoint endpoint) { |
| 847 assert(endpoint.setDescription("For TraceCollectorProxy")); | 945 assert(endpoint.setDescription("For TraceCollectorProxy")); |
| 848 return new TraceCollectorProxy.fromEndpoint(endpoint); | 946 return new TraceCollectorProxy.fromEndpoint(endpoint); |
| 849 } | 947 } |
| 850 | 948 |
| 851 factory TraceCollectorProxy.connectToService( | |
| 852 bindings.ServiceConnector s, String url, [String serviceName]) { | |
| 853 TraceCollectorProxy p = new TraceCollectorProxy.unbound(); | |
| 854 s.connectToService(url, p, serviceName); | |
| 855 return p; | |
| 856 } | |
| 857 | |
| 858 | 949 |
| 859 void start(core.MojoDataPipeProducer stream, String categories) { | 950 void start(core.MojoDataPipeProducer stream, String categories) { |
| 860 if (!ctrl.isBound) { | 951 if (!ctrl.isBound) { |
| 861 ctrl.proxyError("The Proxy is closed."); | 952 ctrl.proxyError("The Proxy is closed."); |
| 862 return; | 953 return; |
| 863 } | 954 } |
| 864 var params = new _TraceCollectorStartParams(); | 955 var params = new _TraceCollectorStartParams(); |
| 865 params.stream = stream; | 956 params.stream = stream; |
| 866 params.categories = categories; | 957 params.categories = categories; |
| 867 ctrl.sendMessage(params, | 958 ctrl.sendMessage(params, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 890 } | 981 } |
| 891 | 982 |
| 892 _TraceCollectorStubControl.fromHandle( | 983 _TraceCollectorStubControl.fromHandle( |
| 893 core.MojoHandle handle, [TraceCollector impl]) | 984 core.MojoHandle handle, [TraceCollector impl]) |
| 894 : super.fromHandle(handle, autoBegin: impl != null) { | 985 : super.fromHandle(handle, autoBegin: impl != null) { |
| 895 _impl = impl; | 986 _impl = impl; |
| 896 } | 987 } |
| 897 | 988 |
| 898 _TraceCollectorStubControl.unbound([this._impl]) : super.unbound(); | 989 _TraceCollectorStubControl.unbound([this._impl]) : super.unbound(); |
| 899 | 990 |
| 991 String get serviceName => TraceCollector.serviceName; |
| 992 |
| 900 | 993 |
| 901 | 994 |
| 902 dynamic handleMessage(bindings.ServiceMessage message) { | 995 dynamic handleMessage(bindings.ServiceMessage message) { |
| 903 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 996 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 904 return bindings.ControlMessageHandler.handleMessage(this, | 997 return bindings.ControlMessageHandler.handleMessage(this, |
| 905 0, | 998 0, |
| 906 message); | 999 message); |
| 907 } | 1000 } |
| 908 if (_impl == null) { | 1001 if (_impl == null) { |
| 909 throw new core.MojoApiError("$this has no implementation set"); | 1002 throw new core.MojoApiError("$this has no implementation set"); |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 943 } | 1036 } |
| 944 } | 1037 } |
| 945 | 1038 |
| 946 @override | 1039 @override |
| 947 String toString() { | 1040 String toString() { |
| 948 var superString = super.toString(); | 1041 var superString = super.toString(); |
| 949 return "_TraceCollectorStubControl($superString)"; | 1042 return "_TraceCollectorStubControl($superString)"; |
| 950 } | 1043 } |
| 951 | 1044 |
| 952 int get version => 0; | 1045 int get version => 0; |
| 953 | |
| 954 static service_describer.ServiceDescription _cachedServiceDescription; | |
| 955 static service_describer.ServiceDescription get serviceDescription { | |
| 956 if (_cachedServiceDescription == null) { | |
| 957 _cachedServiceDescription = new _TraceCollectorServiceDescription(); | |
| 958 } | |
| 959 return _cachedServiceDescription; | |
| 960 } | |
| 961 } | 1046 } |
| 962 | 1047 |
| 963 class TraceCollectorStub | 1048 class TraceCollectorStub |
| 964 extends bindings.Stub<TraceCollector> | 1049 extends bindings.Stub<TraceCollector> |
| 965 implements TraceCollector { | 1050 implements TraceCollector, |
| 1051 TraceCollectorInterface, |
| 1052 TraceCollectorInterfaceRequest { |
| 1053 TraceCollectorStub.unbound([TraceCollector impl]) |
| 1054 : super(new _TraceCollectorStubControl.unbound(impl)); |
| 1055 |
| 966 TraceCollectorStub.fromEndpoint( | 1056 TraceCollectorStub.fromEndpoint( |
| 967 core.MojoMessagePipeEndpoint endpoint, [TraceCollector impl]) | 1057 core.MojoMessagePipeEndpoint endpoint, [TraceCollector impl]) |
| 968 : super(new _TraceCollectorStubControl.fromEndpoint(endpoint, impl)); | 1058 : super(new _TraceCollectorStubControl.fromEndpoint(endpoint, impl)); |
| 969 | 1059 |
| 970 TraceCollectorStub.fromHandle( | 1060 TraceCollectorStub.fromHandle( |
| 971 core.MojoHandle handle, [TraceCollector impl]) | 1061 core.MojoHandle handle, [TraceCollector impl]) |
| 972 : super(new _TraceCollectorStubControl.fromHandle(handle, impl)); | 1062 : super(new _TraceCollectorStubControl.fromHandle(handle, impl)); |
| 973 | 1063 |
| 974 TraceCollectorStub.unbound([TraceCollector impl]) | |
| 975 : super(new _TraceCollectorStubControl.unbound(impl)); | |
| 976 | |
| 977 static TraceCollectorStub newFromEndpoint( | 1064 static TraceCollectorStub newFromEndpoint( |
| 978 core.MojoMessagePipeEndpoint endpoint) { | 1065 core.MojoMessagePipeEndpoint endpoint) { |
| 979 assert(endpoint.setDescription("For TraceCollectorStub")); | 1066 assert(endpoint.setDescription("For TraceCollectorStub")); |
| 980 return new TraceCollectorStub.fromEndpoint(endpoint); | 1067 return new TraceCollectorStub.fromEndpoint(endpoint); |
| 981 } | 1068 } |
| 982 | 1069 |
| 983 static service_describer.ServiceDescription get serviceDescription => | |
| 984 _TraceCollectorStubControl.serviceDescription; | |
| 985 | |
| 986 | 1070 |
| 987 void start(core.MojoDataPipeProducer stream, String categories) { | 1071 void start(core.MojoDataPipeProducer stream, String categories) { |
| 988 return impl.start(stream, categories); | 1072 return impl.start(stream, categories); |
| 989 } | 1073 } |
| 990 void stopAndFlush() { | 1074 void stopAndFlush() { |
| 991 return impl.stopAndFlush(); | 1075 return impl.stopAndFlush(); |
| 992 } | 1076 } |
| 993 } | 1077 } |
| 994 | 1078 |
| 995 | 1079 |
| 996 | 1080 |
| OLD | NEW |