| 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 seeking_reader_mojom; | 5 library seeking_reader_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/mojo/media/media_common.mojom.dart' as media_commo
n_mojom; | 10 import 'package:mojo_services/mojo/media/media_common.mojom.dart' as media_commo
n_mojom; |
| (...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 responseFactory(null); | 346 responseFactory(null); |
| 347 } | 347 } |
| 348 | 348 |
| 349 abstract class SeekingReader { | 349 abstract class SeekingReader { |
| 350 static const String serviceName = null; | 350 static const String serviceName = null; |
| 351 dynamic describe([Function responseFactory = null]); | 351 dynamic describe([Function responseFactory = null]); |
| 352 dynamic readAt(int position,[Function responseFactory = null]); | 352 dynamic readAt(int position,[Function responseFactory = null]); |
| 353 static const int kUnknownSize = 18446744073709551615; | 353 static const int kUnknownSize = 18446744073709551615; |
| 354 } | 354 } |
| 355 | 355 |
| 356 | 356 class _SeekingReaderProxyControl |
| 357 class _SeekingReaderProxyControl extends bindings.ProxyMessageHandler | 357 extends bindings.ProxyMessageHandler |
| 358 implements bindings.ProxyControl { | 358 implements bindings.ProxyControl { |
| 359 _SeekingReaderProxyControl.fromEndpoint( | 359 _SeekingReaderProxyControl.fromEndpoint( |
| 360 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); | 360 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); |
| 361 | 361 |
| 362 _SeekingReaderProxyControl.fromHandle( | 362 _SeekingReaderProxyControl.fromHandle( |
| 363 core.MojoHandle handle) : super.fromHandle(handle); | 363 core.MojoHandle handle) : super.fromHandle(handle); |
| 364 | 364 |
| 365 _SeekingReaderProxyControl.unbound() : super.unbound(); | 365 _SeekingReaderProxyControl.unbound() : super.unbound(); |
| 366 | 366 |
| 367 service_describer.ServiceDescription get serviceDescription => | 367 service_describer.ServiceDescription get serviceDescription => |
| 368 new _SeekingReaderServiceDescription(); | 368 new _SeekingReaderServiceDescription(); |
| 369 | 369 |
| 370 String get serviceName => SeekingReader.serviceName; | 370 String get serviceName => SeekingReader.serviceName; |
| 371 | 371 |
| 372 @override | |
| 373 void handleResponse(bindings.ServiceMessage message) { | 372 void handleResponse(bindings.ServiceMessage message) { |
| 374 switch (message.header.type) { | 373 switch (message.header.type) { |
| 375 case _seekingReaderMethodDescribeName: | 374 case _seekingReaderMethodDescribeName: |
| 376 var r = SeekingReaderDescribeResponseParams.deserialize( | 375 var r = SeekingReaderDescribeResponseParams.deserialize( |
| 377 message.payload); | 376 message.payload); |
| 378 if (!message.header.hasRequestId) { | 377 if (!message.header.hasRequestId) { |
| 379 proxyError("Expected a message with a valid request Id."); | 378 proxyError("Expected a message with a valid request Id."); |
| 380 return; | 379 return; |
| 381 } | 380 } |
| 382 Completer c = completerMap[message.header.requestId]; | 381 Completer c = completerMap[message.header.requestId]; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 419 } | 418 } |
| 420 } | 419 } |
| 421 | 420 |
| 422 @override | 421 @override |
| 423 String toString() { | 422 String toString() { |
| 424 var superString = super.toString(); | 423 var superString = super.toString(); |
| 425 return "_SeekingReaderProxyControl($superString)"; | 424 return "_SeekingReaderProxyControl($superString)"; |
| 426 } | 425 } |
| 427 } | 426 } |
| 428 | 427 |
| 429 | 428 class SeekingReaderProxy |
| 430 class SeekingReaderProxy extends bindings.Proxy | 429 extends bindings.Proxy |
| 431 implements SeekingReader { | 430 implements SeekingReader { |
| 432 SeekingReaderProxy.fromEndpoint( | 431 SeekingReaderProxy.fromEndpoint( |
| 433 core.MojoMessagePipeEndpoint endpoint) | 432 core.MojoMessagePipeEndpoint endpoint) |
| 434 : super(new _SeekingReaderProxyControl.fromEndpoint(endpoint)); | 433 : super(new _SeekingReaderProxyControl.fromEndpoint(endpoint)); |
| 435 | 434 |
| 436 SeekingReaderProxy.fromHandle(core.MojoHandle handle) | 435 SeekingReaderProxy.fromHandle(core.MojoHandle handle) |
| 437 : super(new _SeekingReaderProxyControl.fromHandle(handle)); | 436 : super(new _SeekingReaderProxyControl.fromHandle(handle)); |
| 438 | 437 |
| 439 SeekingReaderProxy.unbound() | 438 SeekingReaderProxy.unbound() |
| 440 : super(new _SeekingReaderProxyControl.unbound()); | 439 : super(new _SeekingReaderProxyControl.unbound()); |
| 441 | 440 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 465 var params = new _SeekingReaderReadAtParams(); | 464 var params = new _SeekingReaderReadAtParams(); |
| 466 params.position = position; | 465 params.position = position; |
| 467 return ctrl.sendMessageWithRequestId( | 466 return ctrl.sendMessageWithRequestId( |
| 468 params, | 467 params, |
| 469 _seekingReaderMethodReadAtName, | 468 _seekingReaderMethodReadAtName, |
| 470 -1, | 469 -1, |
| 471 bindings.MessageHeader.kMessageExpectsResponse); | 470 bindings.MessageHeader.kMessageExpectsResponse); |
| 472 } | 471 } |
| 473 } | 472 } |
| 474 | 473 |
| 475 | 474 class _SeekingReaderStubControl |
| 476 class SeekingReaderStub extends bindings.Stub { | 475 extends bindings.StubMessageHandler |
| 476 implements bindings.StubControl<SeekingReader> { |
| 477 SeekingReader _impl; | 477 SeekingReader _impl; |
| 478 | 478 |
| 479 SeekingReaderStub.fromEndpoint( | 479 _SeekingReaderStubControl.fromEndpoint( |
| 480 core.MojoMessagePipeEndpoint endpoint, [SeekingReader impl]) | 480 core.MojoMessagePipeEndpoint endpoint, [SeekingReader impl]) |
| 481 : super.fromEndpoint(endpoint, autoBegin: impl != null) { | 481 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 482 _impl = impl; | 482 _impl = impl; |
| 483 } | 483 } |
| 484 | 484 |
| 485 SeekingReaderStub.fromHandle( | 485 _SeekingReaderStubControl.fromHandle( |
| 486 core.MojoHandle handle, [SeekingReader impl]) | 486 core.MojoHandle handle, [SeekingReader impl]) |
| 487 : super.fromHandle(handle, autoBegin: impl != null) { | 487 : super.fromHandle(handle, autoBegin: impl != null) { |
| 488 _impl = impl; | 488 _impl = impl; |
| 489 } | 489 } |
| 490 | 490 |
| 491 SeekingReaderStub.unbound([this._impl]) : super.unbound(); | 491 _SeekingReaderStubControl.unbound([this._impl]) : super.unbound(); |
| 492 | |
| 493 static SeekingReaderStub newFromEndpoint( | |
| 494 core.MojoMessagePipeEndpoint endpoint) { | |
| 495 assert(endpoint.setDescription("For SeekingReaderStub")); | |
| 496 return new SeekingReaderStub.fromEndpoint(endpoint); | |
| 497 } | |
| 498 | 492 |
| 499 | 493 |
| 500 SeekingReaderDescribeResponseParams _seekingReaderDescribeResponseParamsFactor
y(media_common_mojom.MediaResult result, int size, bool canSeek) { | 494 SeekingReaderDescribeResponseParams _seekingReaderDescribeResponseParamsFactor
y(media_common_mojom.MediaResult result, int size, bool canSeek) { |
| 501 var result = new SeekingReaderDescribeResponseParams(); | 495 var result = new SeekingReaderDescribeResponseParams(); |
| 502 result.result = result; | 496 result.result = result; |
| 503 result.size = size; | 497 result.size = size; |
| 504 result.canSeek = canSeek; | 498 result.canSeek = canSeek; |
| 505 return result; | 499 return result; |
| 506 } | 500 } |
| 507 SeekingReaderReadAtResponseParams _seekingReaderReadAtResponseParamsFactory(me
dia_common_mojom.MediaResult result, core.MojoDataPipeConsumer dataPipe) { | 501 SeekingReaderReadAtResponseParams _seekingReaderReadAtResponseParamsFactory(me
dia_common_mojom.MediaResult result, core.MojoDataPipeConsumer dataPipe) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 } | 576 } |
| 583 | 577 |
| 584 @override | 578 @override |
| 585 void bind(core.MojoMessagePipeEndpoint endpoint) { | 579 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 586 super.bind(endpoint); | 580 super.bind(endpoint); |
| 587 if (!isOpen && (_impl != null)) { | 581 if (!isOpen && (_impl != null)) { |
| 588 beginHandlingEvents(); | 582 beginHandlingEvents(); |
| 589 } | 583 } |
| 590 } | 584 } |
| 591 | 585 |
| 586 @override |
| 592 String toString() { | 587 String toString() { |
| 593 var superString = super.toString(); | 588 var superString = super.toString(); |
| 594 return "SeekingReaderStub($superString)"; | 589 return "_SeekingReaderStubControl($superString)"; |
| 595 } | 590 } |
| 596 | 591 |
| 597 int get version => 0; | 592 int get version => 0; |
| 598 | 593 |
| 599 static service_describer.ServiceDescription _cachedServiceDescription; | 594 static service_describer.ServiceDescription _cachedServiceDescription; |
| 600 static service_describer.ServiceDescription get serviceDescription { | 595 static service_describer.ServiceDescription get serviceDescription { |
| 601 if (_cachedServiceDescription == null) { | 596 if (_cachedServiceDescription == null) { |
| 602 _cachedServiceDescription = new _SeekingReaderServiceDescription(); | 597 _cachedServiceDescription = new _SeekingReaderServiceDescription(); |
| 603 } | 598 } |
| 604 return _cachedServiceDescription; | 599 return _cachedServiceDescription; |
| 605 } | 600 } |
| 606 } | 601 } |
| 607 | 602 |
| 603 class SeekingReaderStub |
| 604 extends bindings.Stub<SeekingReader> |
| 605 implements SeekingReader { |
| 606 SeekingReaderStub.fromEndpoint( |
| 607 core.MojoMessagePipeEndpoint endpoint, [SeekingReader impl]) |
| 608 : super(new _SeekingReaderStubControl.fromEndpoint(endpoint, impl)); |
| 609 |
| 610 SeekingReaderStub.fromHandle( |
| 611 core.MojoHandle handle, [SeekingReader impl]) |
| 612 : super(new _SeekingReaderStubControl.fromHandle(handle, impl)); |
| 613 |
| 614 SeekingReaderStub.unbound([SeekingReader impl]) |
| 615 : super(new _SeekingReaderStubControl.unbound(impl)); |
| 616 |
| 617 static SeekingReaderStub newFromEndpoint( |
| 618 core.MojoMessagePipeEndpoint endpoint) { |
| 619 assert(endpoint.setDescription("For SeekingReaderStub")); |
| 620 return new SeekingReaderStub.fromEndpoint(endpoint); |
| 621 } |
| 622 |
| 623 static service_describer.ServiceDescription get serviceDescription => |
| 624 _SeekingReaderStubControl.serviceDescription; |
| 625 |
| 626 |
| 627 dynamic describe([Function responseFactory = null]) { |
| 628 return impl.describe(responseFactory); |
| 629 } |
| 630 dynamic readAt(int position,[Function responseFactory = null]) { |
| 631 return impl.readAt(position,responseFactory); |
| 632 } |
| 633 } |
| 634 |
| 608 | 635 |
| 609 | 636 |
| OLD | NEW |