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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/asset_bundle/asset_bundle.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 asset_bundle_mojom; 5 library asset_bundle_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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 247
248 dynamic getAllTypeDefinitions([Function responseFactory]) => 248 dynamic getAllTypeDefinitions([Function responseFactory]) =>
249 responseFactory(null); 249 responseFactory(null);
250 } 250 }
251 251
252 abstract class AssetBundle { 252 abstract class AssetBundle {
253 static const String serviceName = "mojo::asset_bundle::AssetBundle"; 253 static const String serviceName = "mojo::asset_bundle::AssetBundle";
254 dynamic getAsStream(String assetName,[Function responseFactory = null]); 254 dynamic getAsStream(String assetName,[Function responseFactory = null]);
255 } 255 }
256 256
257 257 class _AssetBundleProxyControl
258 class _AssetBundleProxyControl extends bindings.ProxyMessageHandler 258 extends bindings.ProxyMessageHandler
259 implements bindings.ProxyControl { 259 implements bindings.ProxyControl {
260 _AssetBundleProxyControl.fromEndpoint( 260 _AssetBundleProxyControl.fromEndpoint(
261 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 261 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
262 262
263 _AssetBundleProxyControl.fromHandle( 263 _AssetBundleProxyControl.fromHandle(
264 core.MojoHandle handle) : super.fromHandle(handle); 264 core.MojoHandle handle) : super.fromHandle(handle);
265 265
266 _AssetBundleProxyControl.unbound() : super.unbound(); 266 _AssetBundleProxyControl.unbound() : super.unbound();
267 267
268 service_describer.ServiceDescription get serviceDescription => 268 service_describer.ServiceDescription get serviceDescription =>
269 new _AssetBundleServiceDescription(); 269 new _AssetBundleServiceDescription();
270 270
271 String get serviceName => AssetBundle.serviceName; 271 String get serviceName => AssetBundle.serviceName;
272 272
273 @override
274 void handleResponse(bindings.ServiceMessage message) { 273 void handleResponse(bindings.ServiceMessage message) {
275 switch (message.header.type) { 274 switch (message.header.type) {
276 case _assetBundleMethodGetAsStreamName: 275 case _assetBundleMethodGetAsStreamName:
277 var r = AssetBundleGetAsStreamResponseParams.deserialize( 276 var r = AssetBundleGetAsStreamResponseParams.deserialize(
278 message.payload); 277 message.payload);
279 if (!message.header.hasRequestId) { 278 if (!message.header.hasRequestId) {
280 proxyError("Expected a message with a valid request Id."); 279 proxyError("Expected a message with a valid request Id.");
281 return; 280 return;
282 } 281 }
283 Completer c = completerMap[message.header.requestId]; 282 Completer c = completerMap[message.header.requestId];
(...skipping 16 matching lines...) Expand all
300 } 299 }
301 } 300 }
302 301
303 @override 302 @override
304 String toString() { 303 String toString() {
305 var superString = super.toString(); 304 var superString = super.toString();
306 return "_AssetBundleProxyControl($superString)"; 305 return "_AssetBundleProxyControl($superString)";
307 } 306 }
308 } 307 }
309 308
310 309 class AssetBundleProxy
311 class AssetBundleProxy extends bindings.Proxy 310 extends bindings.Proxy
312 implements AssetBundle { 311 implements AssetBundle {
313 AssetBundleProxy.fromEndpoint( 312 AssetBundleProxy.fromEndpoint(
314 core.MojoMessagePipeEndpoint endpoint) 313 core.MojoMessagePipeEndpoint endpoint)
315 : super(new _AssetBundleProxyControl.fromEndpoint(endpoint)); 314 : super(new _AssetBundleProxyControl.fromEndpoint(endpoint));
316 315
317 AssetBundleProxy.fromHandle(core.MojoHandle handle) 316 AssetBundleProxy.fromHandle(core.MojoHandle handle)
318 : super(new _AssetBundleProxyControl.fromHandle(handle)); 317 : super(new _AssetBundleProxyControl.fromHandle(handle));
319 318
320 AssetBundleProxy.unbound() 319 AssetBundleProxy.unbound()
321 : super(new _AssetBundleProxyControl.unbound()); 320 : super(new _AssetBundleProxyControl.unbound());
322 321
(...skipping 15 matching lines...) Expand all
338 var params = new _AssetBundleGetAsStreamParams(); 337 var params = new _AssetBundleGetAsStreamParams();
339 params.assetName = assetName; 338 params.assetName = assetName;
340 return ctrl.sendMessageWithRequestId( 339 return ctrl.sendMessageWithRequestId(
341 params, 340 params,
342 _assetBundleMethodGetAsStreamName, 341 _assetBundleMethodGetAsStreamName,
343 -1, 342 -1,
344 bindings.MessageHeader.kMessageExpectsResponse); 343 bindings.MessageHeader.kMessageExpectsResponse);
345 } 344 }
346 } 345 }
347 346
348 347 class _AssetBundleStubControl
349 class AssetBundleStub extends bindings.Stub { 348 extends bindings.StubMessageHandler
349 implements bindings.StubControl<AssetBundle> {
350 AssetBundle _impl; 350 AssetBundle _impl;
351 351
352 AssetBundleStub.fromEndpoint( 352 _AssetBundleStubControl.fromEndpoint(
353 core.MojoMessagePipeEndpoint endpoint, [AssetBundle impl]) 353 core.MojoMessagePipeEndpoint endpoint, [AssetBundle impl])
354 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 354 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
355 _impl = impl; 355 _impl = impl;
356 } 356 }
357 357
358 AssetBundleStub.fromHandle( 358 _AssetBundleStubControl.fromHandle(
359 core.MojoHandle handle, [AssetBundle impl]) 359 core.MojoHandle handle, [AssetBundle impl])
360 : super.fromHandle(handle, autoBegin: impl != null) { 360 : super.fromHandle(handle, autoBegin: impl != null) {
361 _impl = impl; 361 _impl = impl;
362 } 362 }
363 363
364 AssetBundleStub.unbound([this._impl]) : super.unbound(); 364 _AssetBundleStubControl.unbound([this._impl]) : super.unbound();
365
366 static AssetBundleStub newFromEndpoint(
367 core.MojoMessagePipeEndpoint endpoint) {
368 assert(endpoint.setDescription("For AssetBundleStub"));
369 return new AssetBundleStub.fromEndpoint(endpoint);
370 }
371 365
372 366
373 AssetBundleGetAsStreamResponseParams _assetBundleGetAsStreamResponseParamsFact ory(core.MojoDataPipeConsumer assetData) { 367 AssetBundleGetAsStreamResponseParams _assetBundleGetAsStreamResponseParamsFact ory(core.MojoDataPipeConsumer assetData) {
374 var result = new AssetBundleGetAsStreamResponseParams(); 368 var result = new AssetBundleGetAsStreamResponseParams();
375 result.assetData = assetData; 369 result.assetData = assetData;
376 return result; 370 return result;
377 } 371 }
378 372
379 dynamic handleMessage(bindings.ServiceMessage message) { 373 dynamic handleMessage(bindings.ServiceMessage message) {
380 if (bindings.ControlMessageHandler.isControlMessage(message)) { 374 if (bindings.ControlMessageHandler.isControlMessage(message)) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
427 } 421 }
428 422
429 @override 423 @override
430 void bind(core.MojoMessagePipeEndpoint endpoint) { 424 void bind(core.MojoMessagePipeEndpoint endpoint) {
431 super.bind(endpoint); 425 super.bind(endpoint);
432 if (!isOpen && (_impl != null)) { 426 if (!isOpen && (_impl != null)) {
433 beginHandlingEvents(); 427 beginHandlingEvents();
434 } 428 }
435 } 429 }
436 430
431 @override
437 String toString() { 432 String toString() {
438 var superString = super.toString(); 433 var superString = super.toString();
439 return "AssetBundleStub($superString)"; 434 return "_AssetBundleStubControl($superString)";
440 } 435 }
441 436
442 int get version => 0; 437 int get version => 0;
443 438
444 static service_describer.ServiceDescription _cachedServiceDescription; 439 static service_describer.ServiceDescription _cachedServiceDescription;
445 static service_describer.ServiceDescription get serviceDescription { 440 static service_describer.ServiceDescription get serviceDescription {
446 if (_cachedServiceDescription == null) { 441 if (_cachedServiceDescription == null) {
447 _cachedServiceDescription = new _AssetBundleServiceDescription(); 442 _cachedServiceDescription = new _AssetBundleServiceDescription();
448 } 443 }
449 return _cachedServiceDescription; 444 return _cachedServiceDescription;
450 } 445 }
451 } 446 }
452 447
448 class AssetBundleStub
449 extends bindings.Stub<AssetBundle>
450 implements AssetBundle {
451 AssetBundleStub.fromEndpoint(
452 core.MojoMessagePipeEndpoint endpoint, [AssetBundle impl])
453 : super(new _AssetBundleStubControl.fromEndpoint(endpoint, impl));
454
455 AssetBundleStub.fromHandle(
456 core.MojoHandle handle, [AssetBundle impl])
457 : super(new _AssetBundleStubControl.fromHandle(handle, impl));
458
459 AssetBundleStub.unbound([AssetBundle impl])
460 : super(new _AssetBundleStubControl.unbound(impl));
461
462 static AssetBundleStub newFromEndpoint(
463 core.MojoMessagePipeEndpoint endpoint) {
464 assert(endpoint.setDescription("For AssetBundleStub"));
465 return new AssetBundleStub.fromEndpoint(endpoint);
466 }
467
468 static service_describer.ServiceDescription get serviceDescription =>
469 _AssetBundleStubControl.serviceDescription;
470
471
472 dynamic getAsStream(String assetName,[Function responseFactory = null]) {
473 return impl.getAsStream(assetName,responseFactory);
474 }
475 }
476
453 const int _assetUnpackerMethodUnpackZipStreamName = 0; 477 const int _assetUnpackerMethodUnpackZipStreamName = 0;
454 478
455 class _AssetUnpackerServiceDescription implements service_describer.ServiceDescr iption { 479 class _AssetUnpackerServiceDescription implements service_describer.ServiceDescr iption {
456 dynamic getTopLevelInterface([Function responseFactory]) => 480 dynamic getTopLevelInterface([Function responseFactory]) =>
457 responseFactory(null); 481 responseFactory(null);
458 482
459 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 483 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
460 responseFactory(null); 484 responseFactory(null);
461 485
462 dynamic getAllTypeDefinitions([Function responseFactory]) => 486 dynamic getAllTypeDefinitions([Function responseFactory]) =>
463 responseFactory(null); 487 responseFactory(null);
464 } 488 }
465 489
466 abstract class AssetUnpacker { 490 abstract class AssetUnpacker {
467 static const String serviceName = "mojo::asset_bundle::AssetUnpacker"; 491 static const String serviceName = "mojo::asset_bundle::AssetUnpacker";
468 void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, Object assetBundl e); 492 void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, Object assetBundl e);
469 } 493 }
470 494
471 495 class _AssetUnpackerProxyControl
472 class _AssetUnpackerProxyControl extends bindings.ProxyMessageHandler 496 extends bindings.ProxyMessageHandler
473 implements bindings.ProxyControl { 497 implements bindings.ProxyControl {
474 _AssetUnpackerProxyControl.fromEndpoint( 498 _AssetUnpackerProxyControl.fromEndpoint(
475 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 499 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
476 500
477 _AssetUnpackerProxyControl.fromHandle( 501 _AssetUnpackerProxyControl.fromHandle(
478 core.MojoHandle handle) : super.fromHandle(handle); 502 core.MojoHandle handle) : super.fromHandle(handle);
479 503
480 _AssetUnpackerProxyControl.unbound() : super.unbound(); 504 _AssetUnpackerProxyControl.unbound() : super.unbound();
481 505
482 service_describer.ServiceDescription get serviceDescription => 506 service_describer.ServiceDescription get serviceDescription =>
483 new _AssetUnpackerServiceDescription(); 507 new _AssetUnpackerServiceDescription();
484 508
485 String get serviceName => AssetUnpacker.serviceName; 509 String get serviceName => AssetUnpacker.serviceName;
486 510
487 @override
488 void handleResponse(bindings.ServiceMessage message) { 511 void handleResponse(bindings.ServiceMessage message) {
489 switch (message.header.type) { 512 switch (message.header.type) {
490 default: 513 default:
491 proxyError("Unexpected message type: ${message.header.type}"); 514 proxyError("Unexpected message type: ${message.header.type}");
492 close(immediate: true); 515 close(immediate: true);
493 break; 516 break;
494 } 517 }
495 } 518 }
496 519
497 @override 520 @override
498 String toString() { 521 String toString() {
499 var superString = super.toString(); 522 var superString = super.toString();
500 return "_AssetUnpackerProxyControl($superString)"; 523 return "_AssetUnpackerProxyControl($superString)";
501 } 524 }
502 } 525 }
503 526
504 527 class AssetUnpackerProxy
505 class AssetUnpackerProxy extends bindings.Proxy 528 extends bindings.Proxy
506 implements AssetUnpacker { 529 implements AssetUnpacker {
507 AssetUnpackerProxy.fromEndpoint( 530 AssetUnpackerProxy.fromEndpoint(
508 core.MojoMessagePipeEndpoint endpoint) 531 core.MojoMessagePipeEndpoint endpoint)
509 : super(new _AssetUnpackerProxyControl.fromEndpoint(endpoint)); 532 : super(new _AssetUnpackerProxyControl.fromEndpoint(endpoint));
510 533
511 AssetUnpackerProxy.fromHandle(core.MojoHandle handle) 534 AssetUnpackerProxy.fromHandle(core.MojoHandle handle)
512 : super(new _AssetUnpackerProxyControl.fromHandle(handle)); 535 : super(new _AssetUnpackerProxyControl.fromHandle(handle));
513 536
514 AssetUnpackerProxy.unbound() 537 AssetUnpackerProxy.unbound()
515 : super(new _AssetUnpackerProxyControl.unbound()); 538 : super(new _AssetUnpackerProxyControl.unbound());
516 539
(...skipping 17 matching lines...) Expand all
534 return; 557 return;
535 } 558 }
536 var params = new _AssetUnpackerUnpackZipStreamParams(); 559 var params = new _AssetUnpackerUnpackZipStreamParams();
537 params.zippedAssets = zippedAssets; 560 params.zippedAssets = zippedAssets;
538 params.assetBundle = assetBundle; 561 params.assetBundle = assetBundle;
539 ctrl.sendMessage(params, 562 ctrl.sendMessage(params,
540 _assetUnpackerMethodUnpackZipStreamName); 563 _assetUnpackerMethodUnpackZipStreamName);
541 } 564 }
542 } 565 }
543 566
544 567 class _AssetUnpackerStubControl
545 class AssetUnpackerStub extends bindings.Stub { 568 extends bindings.StubMessageHandler
569 implements bindings.StubControl<AssetUnpacker> {
546 AssetUnpacker _impl; 570 AssetUnpacker _impl;
547 571
548 AssetUnpackerStub.fromEndpoint( 572 _AssetUnpackerStubControl.fromEndpoint(
549 core.MojoMessagePipeEndpoint endpoint, [AssetUnpacker impl]) 573 core.MojoMessagePipeEndpoint endpoint, [AssetUnpacker impl])
550 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 574 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
551 _impl = impl; 575 _impl = impl;
552 } 576 }
553 577
554 AssetUnpackerStub.fromHandle( 578 _AssetUnpackerStubControl.fromHandle(
555 core.MojoHandle handle, [AssetUnpacker impl]) 579 core.MojoHandle handle, [AssetUnpacker impl])
556 : super.fromHandle(handle, autoBegin: impl != null) { 580 : super.fromHandle(handle, autoBegin: impl != null) {
557 _impl = impl; 581 _impl = impl;
558 } 582 }
559 583
560 AssetUnpackerStub.unbound([this._impl]) : super.unbound(); 584 _AssetUnpackerStubControl.unbound([this._impl]) : super.unbound();
561
562 static AssetUnpackerStub newFromEndpoint(
563 core.MojoMessagePipeEndpoint endpoint) {
564 assert(endpoint.setDescription("For AssetUnpackerStub"));
565 return new AssetUnpackerStub.fromEndpoint(endpoint);
566 }
567 585
568 586
569 587
570 dynamic handleMessage(bindings.ServiceMessage message) { 588 dynamic handleMessage(bindings.ServiceMessage message) {
571 if (bindings.ControlMessageHandler.isControlMessage(message)) { 589 if (bindings.ControlMessageHandler.isControlMessage(message)) {
572 return bindings.ControlMessageHandler.handleMessage(this, 590 return bindings.ControlMessageHandler.handleMessage(this,
573 0, 591 0,
574 message); 592 message);
575 } 593 }
576 if (_impl == null) { 594 if (_impl == null) {
(...skipping 24 matching lines...) Expand all
601 } 619 }
602 620
603 @override 621 @override
604 void bind(core.MojoMessagePipeEndpoint endpoint) { 622 void bind(core.MojoMessagePipeEndpoint endpoint) {
605 super.bind(endpoint); 623 super.bind(endpoint);
606 if (!isOpen && (_impl != null)) { 624 if (!isOpen && (_impl != null)) {
607 beginHandlingEvents(); 625 beginHandlingEvents();
608 } 626 }
609 } 627 }
610 628
629 @override
611 String toString() { 630 String toString() {
612 var superString = super.toString(); 631 var superString = super.toString();
613 return "AssetUnpackerStub($superString)"; 632 return "_AssetUnpackerStubControl($superString)";
614 } 633 }
615 634
616 int get version => 0; 635 int get version => 0;
617 636
618 static service_describer.ServiceDescription _cachedServiceDescription; 637 static service_describer.ServiceDescription _cachedServiceDescription;
619 static service_describer.ServiceDescription get serviceDescription { 638 static service_describer.ServiceDescription get serviceDescription {
620 if (_cachedServiceDescription == null) { 639 if (_cachedServiceDescription == null) {
621 _cachedServiceDescription = new _AssetUnpackerServiceDescription(); 640 _cachedServiceDescription = new _AssetUnpackerServiceDescription();
622 } 641 }
623 return _cachedServiceDescription; 642 return _cachedServiceDescription;
624 } 643 }
625 } 644 }
626 645
646 class AssetUnpackerStub
647 extends bindings.Stub<AssetUnpacker>
648 implements AssetUnpacker {
649 AssetUnpackerStub.fromEndpoint(
650 core.MojoMessagePipeEndpoint endpoint, [AssetUnpacker impl])
651 : super(new _AssetUnpackerStubControl.fromEndpoint(endpoint, impl));
652
653 AssetUnpackerStub.fromHandle(
654 core.MojoHandle handle, [AssetUnpacker impl])
655 : super(new _AssetUnpackerStubControl.fromHandle(handle, impl));
656
657 AssetUnpackerStub.unbound([AssetUnpacker impl])
658 : super(new _AssetUnpackerStubControl.unbound(impl));
659
660 static AssetUnpackerStub newFromEndpoint(
661 core.MojoMessagePipeEndpoint endpoint) {
662 assert(endpoint.setDescription("For AssetUnpackerStub"));
663 return new AssetUnpackerStub.fromEndpoint(endpoint);
664 }
665
666 static service_describer.ServiceDescription get serviceDescription =>
667 _AssetUnpackerStubControl.serviceDescription;
668
669
670 void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, Object assetBundl e) {
671 return impl.unpackZipStream(zippedAssets, assetBundle);
672 }
673 }
674
627 675
628 676
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698