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

Side by Side Diff: mojo/dart/packages/_mojo_for_test_only/lib/imported/sample_import.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 sample_import_mojom; 5 library sample_import_mojom;
6 import 'dart:async'; 6 import 'dart:async';
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:convert'; 8 import 'dart:convert';
9 import 'dart:io'; 9 import 'dart:io';
10 import 'dart:typed_data'; 10 import 'dart:typed_data';
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 353
354 dynamic getAllTypeDefinitions([Function responseFactory]) => 354 dynamic getAllTypeDefinitions([Function responseFactory]) =>
355 responseFactory(null); 355 responseFactory(null);
356 } 356 }
357 357
358 abstract class ImportedInterface { 358 abstract class ImportedInterface {
359 static const String serviceName = null; 359 static const String serviceName = null;
360 void doSomething(); 360 void doSomething();
361 } 361 }
362 362
363 363 class _ImportedInterfaceProxyControl
364 class _ImportedInterfaceProxyControl extends bindings.ProxyMessageHandler 364 extends bindings.ProxyMessageHandler
365 implements bindings.ProxyControl { 365 implements bindings.ProxyControl {
366 _ImportedInterfaceProxyControl.fromEndpoint( 366 _ImportedInterfaceProxyControl.fromEndpoint(
367 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 367 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
368 368
369 _ImportedInterfaceProxyControl.fromHandle( 369 _ImportedInterfaceProxyControl.fromHandle(
370 core.MojoHandle handle) : super.fromHandle(handle); 370 core.MojoHandle handle) : super.fromHandle(handle);
371 371
372 _ImportedInterfaceProxyControl.unbound() : super.unbound(); 372 _ImportedInterfaceProxyControl.unbound() : super.unbound();
373 373
374 service_describer.ServiceDescription get serviceDescription => 374 service_describer.ServiceDescription get serviceDescription =>
375 new _ImportedInterfaceServiceDescription(); 375 new _ImportedInterfaceServiceDescription();
376 376
377 String get serviceName => ImportedInterface.serviceName; 377 String get serviceName => ImportedInterface.serviceName;
378 378
379 @override
380 void handleResponse(bindings.ServiceMessage message) { 379 void handleResponse(bindings.ServiceMessage message) {
381 switch (message.header.type) { 380 switch (message.header.type) {
382 default: 381 default:
383 proxyError("Unexpected message type: ${message.header.type}"); 382 proxyError("Unexpected message type: ${message.header.type}");
384 close(immediate: true); 383 close(immediate: true);
385 break; 384 break;
386 } 385 }
387 } 386 }
388 387
389 @override 388 @override
390 String toString() { 389 String toString() {
391 var superString = super.toString(); 390 var superString = super.toString();
392 return "_ImportedInterfaceProxyControl($superString)"; 391 return "_ImportedInterfaceProxyControl($superString)";
393 } 392 }
394 } 393 }
395 394
396 395 class ImportedInterfaceProxy
397 class ImportedInterfaceProxy extends bindings.Proxy 396 extends bindings.Proxy
398 implements ImportedInterface { 397 implements ImportedInterface {
399 ImportedInterfaceProxy.fromEndpoint( 398 ImportedInterfaceProxy.fromEndpoint(
400 core.MojoMessagePipeEndpoint endpoint) 399 core.MojoMessagePipeEndpoint endpoint)
401 : super(new _ImportedInterfaceProxyControl.fromEndpoint(endpoint)); 400 : super(new _ImportedInterfaceProxyControl.fromEndpoint(endpoint));
402 401
403 ImportedInterfaceProxy.fromHandle(core.MojoHandle handle) 402 ImportedInterfaceProxy.fromHandle(core.MojoHandle handle)
404 : super(new _ImportedInterfaceProxyControl.fromHandle(handle)); 403 : super(new _ImportedInterfaceProxyControl.fromHandle(handle));
405 404
406 ImportedInterfaceProxy.unbound() 405 ImportedInterfaceProxy.unbound()
407 : super(new _ImportedInterfaceProxyControl.unbound()); 406 : super(new _ImportedInterfaceProxyControl.unbound());
408 407
(...skipping 15 matching lines...) Expand all
424 if (!ctrl.isBound) { 423 if (!ctrl.isBound) {
425 ctrl.proxyError("The Proxy is closed."); 424 ctrl.proxyError("The Proxy is closed.");
426 return; 425 return;
427 } 426 }
428 var params = new _ImportedInterfaceDoSomethingParams(); 427 var params = new _ImportedInterfaceDoSomethingParams();
429 ctrl.sendMessage(params, 428 ctrl.sendMessage(params,
430 _importedInterfaceMethodDoSomethingName); 429 _importedInterfaceMethodDoSomethingName);
431 } 430 }
432 } 431 }
433 432
434 433 class _ImportedInterfaceStubControl
435 class ImportedInterfaceStub extends bindings.Stub { 434 extends bindings.StubMessageHandler
435 implements bindings.StubControl<ImportedInterface> {
436 ImportedInterface _impl; 436 ImportedInterface _impl;
437 437
438 ImportedInterfaceStub.fromEndpoint( 438 _ImportedInterfaceStubControl.fromEndpoint(
439 core.MojoMessagePipeEndpoint endpoint, [ImportedInterface impl]) 439 core.MojoMessagePipeEndpoint endpoint, [ImportedInterface impl])
440 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 440 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
441 _impl = impl; 441 _impl = impl;
442 } 442 }
443 443
444 ImportedInterfaceStub.fromHandle( 444 _ImportedInterfaceStubControl.fromHandle(
445 core.MojoHandle handle, [ImportedInterface impl]) 445 core.MojoHandle handle, [ImportedInterface impl])
446 : super.fromHandle(handle, autoBegin: impl != null) { 446 : super.fromHandle(handle, autoBegin: impl != null) {
447 _impl = impl; 447 _impl = impl;
448 } 448 }
449 449
450 ImportedInterfaceStub.unbound([this._impl]) : super.unbound(); 450 _ImportedInterfaceStubControl.unbound([this._impl]) : super.unbound();
451
452 static ImportedInterfaceStub newFromEndpoint(
453 core.MojoMessagePipeEndpoint endpoint) {
454 assert(endpoint.setDescription("For ImportedInterfaceStub"));
455 return new ImportedInterfaceStub.fromEndpoint(endpoint);
456 }
457 451
458 452
459 453
460 dynamic handleMessage(bindings.ServiceMessage message) { 454 dynamic handleMessage(bindings.ServiceMessage message) {
461 if (bindings.ControlMessageHandler.isControlMessage(message)) { 455 if (bindings.ControlMessageHandler.isControlMessage(message)) {
462 return bindings.ControlMessageHandler.handleMessage(this, 456 return bindings.ControlMessageHandler.handleMessage(this,
463 0, 457 0,
464 message); 458 message);
465 } 459 }
466 if (_impl == null) { 460 if (_impl == null) {
(...skipping 22 matching lines...) Expand all
489 } 483 }
490 484
491 @override 485 @override
492 void bind(core.MojoMessagePipeEndpoint endpoint) { 486 void bind(core.MojoMessagePipeEndpoint endpoint) {
493 super.bind(endpoint); 487 super.bind(endpoint);
494 if (!isOpen && (_impl != null)) { 488 if (!isOpen && (_impl != null)) {
495 beginHandlingEvents(); 489 beginHandlingEvents();
496 } 490 }
497 } 491 }
498 492
493 @override
499 String toString() { 494 String toString() {
500 var superString = super.toString(); 495 var superString = super.toString();
501 return "ImportedInterfaceStub($superString)"; 496 return "_ImportedInterfaceStubControl($superString)";
502 } 497 }
503 498
504 int get version => 0; 499 int get version => 0;
505 500
506 static service_describer.ServiceDescription _cachedServiceDescription; 501 static service_describer.ServiceDescription _cachedServiceDescription;
507 static service_describer.ServiceDescription get serviceDescription { 502 static service_describer.ServiceDescription get serviceDescription {
508 if (_cachedServiceDescription == null) { 503 if (_cachedServiceDescription == null) {
509 _cachedServiceDescription = new _ImportedInterfaceServiceDescription(); 504 _cachedServiceDescription = new _ImportedInterfaceServiceDescription();
510 } 505 }
511 return _cachedServiceDescription; 506 return _cachedServiceDescription;
512 } 507 }
513 } 508 }
514 509
510 class ImportedInterfaceStub
511 extends bindings.Stub<ImportedInterface>
512 implements ImportedInterface {
513 ImportedInterfaceStub.fromEndpoint(
514 core.MojoMessagePipeEndpoint endpoint, [ImportedInterface impl])
515 : super(new _ImportedInterfaceStubControl.fromEndpoint(endpoint, impl));
516
517 ImportedInterfaceStub.fromHandle(
518 core.MojoHandle handle, [ImportedInterface impl])
519 : super(new _ImportedInterfaceStubControl.fromHandle(handle, impl));
520
521 ImportedInterfaceStub.unbound([ImportedInterface impl])
522 : super(new _ImportedInterfaceStubControl.unbound(impl));
523
524 static ImportedInterfaceStub newFromEndpoint(
525 core.MojoMessagePipeEndpoint endpoint) {
526 assert(endpoint.setDescription("For ImportedInterfaceStub"));
527 return new ImportedInterfaceStub.fromEndpoint(endpoint);
528 }
529
530 static service_describer.ServiceDescription get serviceDescription =>
531 _ImportedInterfaceStubControl.serviceDescription;
532
533
534 void doSomething() {
535 return impl.doSomething();
536 }
537 }
538
515 539
516 mojom_types.RuntimeTypeInfo getRuntimeTypeInfo() => _runtimeTypeInfo ?? 540 mojom_types.RuntimeTypeInfo getRuntimeTypeInfo() => _runtimeTypeInfo ??
517 _initRuntimeTypeInfo(); 541 _initRuntimeTypeInfo();
518 542
519 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() { 543 Map<String, mojom_types.UserDefinedType> getAllMojomTypeDefinitions() {
520 return getRuntimeTypeInfo().typeMap; 544 return getRuntimeTypeInfo().typeMap;
521 } 545 }
522 546
523 var _runtimeTypeInfo; 547 var _runtimeTypeInfo;
524 mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() { 548 mojom_types.RuntimeTypeInfo _initRuntimeTypeInfo() {
525 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of 549 // serializedRuntimeTypeInfo contains the bytes of the Mojo serialization of
526 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this 550 // a mojom_types.RuntimeTypeInfo struct describing the Mojom types in this
527 // file. The string contains the base64 encoding of the gzip-compressed bytes. 551 // file. The string contains the base64 encoding of the gzip-compressed bytes.
528 var serializedRuntimeTypeInfo = "H4sIAAAJbogC/8yYX3PSQBDAL9AqtbTi2D/0j5pq1aoj8 bHjUzuVEcaOwwAP8OAUSiOJAwSTMKN+Aj9GP4ofxY/QR9/0QvYk2dxBojRwMztHck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G+ 8BayH1g/ZrOZwLnWZgbKGJeO3O2H2xE5FMLuR+wc2Ihn9ERDdevdmPm9CcAAP//jmet5PgXAAA=";
529 553
530 // Deserialize RuntimeTypeInfo 554 // Deserialize RuntimeTypeInfo
531 var bytes = BASE64.decode(serializedRuntimeTypeInfo); 555 var bytes = BASE64.decode(serializedRuntimeTypeInfo);
532 var unzippedBytes = new ZLibDecoder().convert(bytes); 556 var unzippedBytes = new ZLibDecoder().convert(bytes);
533 var bdata = new ByteData.view(unzippedBytes.buffer); 557 var bdata = new ByteData.view(unzippedBytes.buffer);
534 var message = new bindings.Message(bdata, null, unzippedBytes.length, 0); 558 var message = new bindings.Message(bdata, null, unzippedBytes.length, 0);
535 _runtimeTypeInfo = mojom_types.RuntimeTypeInfo.deserialize(message); 559 _runtimeTypeInfo = mojom_types.RuntimeTypeInfo.deserialize(message);
536 return _runtimeTypeInfo; 560 return _runtimeTypeInfo;
537 } 561 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698