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

Side by Side Diff: mojo/dart/packages/mojo_services/lib/mojo/surfaces.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 surfaces_mojom; 5 library surfaces_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/geometry.mojom.dart' as geometry_mojom; 10 import 'package:mojo_services/mojo/geometry.mojom.dart' as geometry_mojom;
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
1254 1254
1255 dynamic getAllTypeDefinitions([Function responseFactory]) => 1255 dynamic getAllTypeDefinitions([Function responseFactory]) =>
1256 responseFactory(null); 1256 responseFactory(null);
1257 } 1257 }
1258 1258
1259 abstract class ResourceReturner { 1259 abstract class ResourceReturner {
1260 static const String serviceName = null; 1260 static const String serviceName = null;
1261 void returnResources(List<ReturnedResource> resources); 1261 void returnResources(List<ReturnedResource> resources);
1262 } 1262 }
1263 1263
1264 1264 class _ResourceReturnerProxyControl
1265 class _ResourceReturnerProxyControl extends bindings.ProxyMessageHandler 1265 extends bindings.ProxyMessageHandler
1266 implements bindings.ProxyControl { 1266 implements bindings.ProxyControl {
1267 _ResourceReturnerProxyControl.fromEndpoint( 1267 _ResourceReturnerProxyControl.fromEndpoint(
1268 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 1268 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
1269 1269
1270 _ResourceReturnerProxyControl.fromHandle( 1270 _ResourceReturnerProxyControl.fromHandle(
1271 core.MojoHandle handle) : super.fromHandle(handle); 1271 core.MojoHandle handle) : super.fromHandle(handle);
1272 1272
1273 _ResourceReturnerProxyControl.unbound() : super.unbound(); 1273 _ResourceReturnerProxyControl.unbound() : super.unbound();
1274 1274
1275 service_describer.ServiceDescription get serviceDescription => 1275 service_describer.ServiceDescription get serviceDescription =>
1276 new _ResourceReturnerServiceDescription(); 1276 new _ResourceReturnerServiceDescription();
1277 1277
1278 String get serviceName => ResourceReturner.serviceName; 1278 String get serviceName => ResourceReturner.serviceName;
1279 1279
1280 @override
1281 void handleResponse(bindings.ServiceMessage message) { 1280 void handleResponse(bindings.ServiceMessage message) {
1282 switch (message.header.type) { 1281 switch (message.header.type) {
1283 default: 1282 default:
1284 proxyError("Unexpected message type: ${message.header.type}"); 1283 proxyError("Unexpected message type: ${message.header.type}");
1285 close(immediate: true); 1284 close(immediate: true);
1286 break; 1285 break;
1287 } 1286 }
1288 } 1287 }
1289 1288
1290 @override 1289 @override
1291 String toString() { 1290 String toString() {
1292 var superString = super.toString(); 1291 var superString = super.toString();
1293 return "_ResourceReturnerProxyControl($superString)"; 1292 return "_ResourceReturnerProxyControl($superString)";
1294 } 1293 }
1295 } 1294 }
1296 1295
1297 1296 class ResourceReturnerProxy
1298 class ResourceReturnerProxy extends bindings.Proxy 1297 extends bindings.Proxy
1299 implements ResourceReturner { 1298 implements ResourceReturner {
1300 ResourceReturnerProxy.fromEndpoint( 1299 ResourceReturnerProxy.fromEndpoint(
1301 core.MojoMessagePipeEndpoint endpoint) 1300 core.MojoMessagePipeEndpoint endpoint)
1302 : super(new _ResourceReturnerProxyControl.fromEndpoint(endpoint)); 1301 : super(new _ResourceReturnerProxyControl.fromEndpoint(endpoint));
1303 1302
1304 ResourceReturnerProxy.fromHandle(core.MojoHandle handle) 1303 ResourceReturnerProxy.fromHandle(core.MojoHandle handle)
1305 : super(new _ResourceReturnerProxyControl.fromHandle(handle)); 1304 : super(new _ResourceReturnerProxyControl.fromHandle(handle));
1306 1305
1307 ResourceReturnerProxy.unbound() 1306 ResourceReturnerProxy.unbound()
1308 : super(new _ResourceReturnerProxyControl.unbound()); 1307 : super(new _ResourceReturnerProxyControl.unbound());
1309 1308
(...skipping 16 matching lines...) Expand all
1326 ctrl.proxyError("The Proxy is closed."); 1325 ctrl.proxyError("The Proxy is closed.");
1327 return; 1326 return;
1328 } 1327 }
1329 var params = new _ResourceReturnerReturnResourcesParams(); 1328 var params = new _ResourceReturnerReturnResourcesParams();
1330 params.resources = resources; 1329 params.resources = resources;
1331 ctrl.sendMessage(params, 1330 ctrl.sendMessage(params,
1332 _resourceReturnerMethodReturnResourcesName); 1331 _resourceReturnerMethodReturnResourcesName);
1333 } 1332 }
1334 } 1333 }
1335 1334
1336 1335 class _ResourceReturnerStubControl
1337 class ResourceReturnerStub extends bindings.Stub { 1336 extends bindings.StubMessageHandler
1337 implements bindings.StubControl<ResourceReturner> {
1338 ResourceReturner _impl; 1338 ResourceReturner _impl;
1339 1339
1340 ResourceReturnerStub.fromEndpoint( 1340 _ResourceReturnerStubControl.fromEndpoint(
1341 core.MojoMessagePipeEndpoint endpoint, [ResourceReturner impl]) 1341 core.MojoMessagePipeEndpoint endpoint, [ResourceReturner impl])
1342 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 1342 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
1343 _impl = impl; 1343 _impl = impl;
1344 } 1344 }
1345 1345
1346 ResourceReturnerStub.fromHandle( 1346 _ResourceReturnerStubControl.fromHandle(
1347 core.MojoHandle handle, [ResourceReturner impl]) 1347 core.MojoHandle handle, [ResourceReturner impl])
1348 : super.fromHandle(handle, autoBegin: impl != null) { 1348 : super.fromHandle(handle, autoBegin: impl != null) {
1349 _impl = impl; 1349 _impl = impl;
1350 } 1350 }
1351 1351
1352 ResourceReturnerStub.unbound([this._impl]) : super.unbound(); 1352 _ResourceReturnerStubControl.unbound([this._impl]) : super.unbound();
1353
1354 static ResourceReturnerStub newFromEndpoint(
1355 core.MojoMessagePipeEndpoint endpoint) {
1356 assert(endpoint.setDescription("For ResourceReturnerStub"));
1357 return new ResourceReturnerStub.fromEndpoint(endpoint);
1358 }
1359 1353
1360 1354
1361 1355
1362 dynamic handleMessage(bindings.ServiceMessage message) { 1356 dynamic handleMessage(bindings.ServiceMessage message) {
1363 if (bindings.ControlMessageHandler.isControlMessage(message)) { 1357 if (bindings.ControlMessageHandler.isControlMessage(message)) {
1364 return bindings.ControlMessageHandler.handleMessage(this, 1358 return bindings.ControlMessageHandler.handleMessage(this,
1365 0, 1359 0,
1366 message); 1360 message);
1367 } 1361 }
1368 if (_impl == null) { 1362 if (_impl == null) {
(...skipping 24 matching lines...) Expand all
1393 } 1387 }
1394 1388
1395 @override 1389 @override
1396 void bind(core.MojoMessagePipeEndpoint endpoint) { 1390 void bind(core.MojoMessagePipeEndpoint endpoint) {
1397 super.bind(endpoint); 1391 super.bind(endpoint);
1398 if (!isOpen && (_impl != null)) { 1392 if (!isOpen && (_impl != null)) {
1399 beginHandlingEvents(); 1393 beginHandlingEvents();
1400 } 1394 }
1401 } 1395 }
1402 1396
1397 @override
1403 String toString() { 1398 String toString() {
1404 var superString = super.toString(); 1399 var superString = super.toString();
1405 return "ResourceReturnerStub($superString)"; 1400 return "_ResourceReturnerStubControl($superString)";
1406 } 1401 }
1407 1402
1408 int get version => 0; 1403 int get version => 0;
1409 1404
1410 static service_describer.ServiceDescription _cachedServiceDescription; 1405 static service_describer.ServiceDescription _cachedServiceDescription;
1411 static service_describer.ServiceDescription get serviceDescription { 1406 static service_describer.ServiceDescription get serviceDescription {
1412 if (_cachedServiceDescription == null) { 1407 if (_cachedServiceDescription == null) {
1413 _cachedServiceDescription = new _ResourceReturnerServiceDescription(); 1408 _cachedServiceDescription = new _ResourceReturnerServiceDescription();
1414 } 1409 }
1415 return _cachedServiceDescription; 1410 return _cachedServiceDescription;
1416 } 1411 }
1417 } 1412 }
1418 1413
1414 class ResourceReturnerStub
1415 extends bindings.Stub<ResourceReturner>
1416 implements ResourceReturner {
1417 ResourceReturnerStub.fromEndpoint(
1418 core.MojoMessagePipeEndpoint endpoint, [ResourceReturner impl])
1419 : super(new _ResourceReturnerStubControl.fromEndpoint(endpoint, impl));
1420
1421 ResourceReturnerStub.fromHandle(
1422 core.MojoHandle handle, [ResourceReturner impl])
1423 : super(new _ResourceReturnerStubControl.fromHandle(handle, impl));
1424
1425 ResourceReturnerStub.unbound([ResourceReturner impl])
1426 : super(new _ResourceReturnerStubControl.unbound(impl));
1427
1428 static ResourceReturnerStub newFromEndpoint(
1429 core.MojoMessagePipeEndpoint endpoint) {
1430 assert(endpoint.setDescription("For ResourceReturnerStub"));
1431 return new ResourceReturnerStub.fromEndpoint(endpoint);
1432 }
1433
1434 static service_describer.ServiceDescription get serviceDescription =>
1435 _ResourceReturnerStubControl.serviceDescription;
1436
1437
1438 void returnResources(List<ReturnedResource> resources) {
1439 return impl.returnResources(resources);
1440 }
1441 }
1442
1419 const int _surfaceMethodGetIdNamespaceName = 0; 1443 const int _surfaceMethodGetIdNamespaceName = 0;
1420 const int _surfaceMethodSetResourceReturnerName = 1; 1444 const int _surfaceMethodSetResourceReturnerName = 1;
1421 const int _surfaceMethodCreateSurfaceName = 2; 1445 const int _surfaceMethodCreateSurfaceName = 2;
1422 const int _surfaceMethodSubmitFrameName = 3; 1446 const int _surfaceMethodSubmitFrameName = 3;
1423 const int _surfaceMethodDestroySurfaceName = 4; 1447 const int _surfaceMethodDestroySurfaceName = 4;
1424 1448
1425 class _SurfaceServiceDescription implements service_describer.ServiceDescription { 1449 class _SurfaceServiceDescription implements service_describer.ServiceDescription {
1426 dynamic getTopLevelInterface([Function responseFactory]) => 1450 dynamic getTopLevelInterface([Function responseFactory]) =>
1427 responseFactory(null); 1451 responseFactory(null);
1428 1452
1429 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) => 1453 dynamic getTypeDefinition(String typeKey, [Function responseFactory]) =>
1430 responseFactory(null); 1454 responseFactory(null);
1431 1455
1432 dynamic getAllTypeDefinitions([Function responseFactory]) => 1456 dynamic getAllTypeDefinitions([Function responseFactory]) =>
1433 responseFactory(null); 1457 responseFactory(null);
1434 } 1458 }
1435 1459
1436 abstract class Surface { 1460 abstract class Surface {
1437 static const String serviceName = "mojo::Surface"; 1461 static const String serviceName = "mojo::Surface";
1438 dynamic getIdNamespace([Function responseFactory = null]); 1462 dynamic getIdNamespace([Function responseFactory = null]);
1439 void setResourceReturner(Object returner); 1463 void setResourceReturner(Object returner);
1440 void createSurface(int idLocal); 1464 void createSurface(int idLocal);
1441 dynamic submitFrame(int idLocal,Frame frame,[Function responseFactory = null]) ; 1465 dynamic submitFrame(int idLocal,Frame frame,[Function responseFactory = null]) ;
1442 void destroySurface(int idLocal); 1466 void destroySurface(int idLocal);
1443 } 1467 }
1444 1468
1445 1469 class _SurfaceProxyControl
1446 class _SurfaceProxyControl extends bindings.ProxyMessageHandler 1470 extends bindings.ProxyMessageHandler
1447 implements bindings.ProxyControl { 1471 implements bindings.ProxyControl {
1448 _SurfaceProxyControl.fromEndpoint( 1472 _SurfaceProxyControl.fromEndpoint(
1449 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint); 1473 core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
1450 1474
1451 _SurfaceProxyControl.fromHandle( 1475 _SurfaceProxyControl.fromHandle(
1452 core.MojoHandle handle) : super.fromHandle(handle); 1476 core.MojoHandle handle) : super.fromHandle(handle);
1453 1477
1454 _SurfaceProxyControl.unbound() : super.unbound(); 1478 _SurfaceProxyControl.unbound() : super.unbound();
1455 1479
1456 service_describer.ServiceDescription get serviceDescription => 1480 service_describer.ServiceDescription get serviceDescription =>
1457 new _SurfaceServiceDescription(); 1481 new _SurfaceServiceDescription();
1458 1482
1459 String get serviceName => Surface.serviceName; 1483 String get serviceName => Surface.serviceName;
1460 1484
1461 @override
1462 void handleResponse(bindings.ServiceMessage message) { 1485 void handleResponse(bindings.ServiceMessage message) {
1463 switch (message.header.type) { 1486 switch (message.header.type) {
1464 case _surfaceMethodGetIdNamespaceName: 1487 case _surfaceMethodGetIdNamespaceName:
1465 var r = SurfaceGetIdNamespaceResponseParams.deserialize( 1488 var r = SurfaceGetIdNamespaceResponseParams.deserialize(
1466 message.payload); 1489 message.payload);
1467 if (!message.header.hasRequestId) { 1490 if (!message.header.hasRequestId) {
1468 proxyError("Expected a message with a valid request Id."); 1491 proxyError("Expected a message with a valid request Id.");
1469 return; 1492 return;
1470 } 1493 }
1471 Completer c = completerMap[message.header.requestId]; 1494 Completer c = completerMap[message.header.requestId];
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
1508 } 1531 }
1509 } 1532 }
1510 1533
1511 @override 1534 @override
1512 String toString() { 1535 String toString() {
1513 var superString = super.toString(); 1536 var superString = super.toString();
1514 return "_SurfaceProxyControl($superString)"; 1537 return "_SurfaceProxyControl($superString)";
1515 } 1538 }
1516 } 1539 }
1517 1540
1518 1541 class SurfaceProxy
1519 class SurfaceProxy extends bindings.Proxy 1542 extends bindings.Proxy
1520 implements Surface { 1543 implements Surface {
1521 SurfaceProxy.fromEndpoint( 1544 SurfaceProxy.fromEndpoint(
1522 core.MojoMessagePipeEndpoint endpoint) 1545 core.MojoMessagePipeEndpoint endpoint)
1523 : super(new _SurfaceProxyControl.fromEndpoint(endpoint)); 1546 : super(new _SurfaceProxyControl.fromEndpoint(endpoint));
1524 1547
1525 SurfaceProxy.fromHandle(core.MojoHandle handle) 1548 SurfaceProxy.fromHandle(core.MojoHandle handle)
1526 : super(new _SurfaceProxyControl.fromHandle(handle)); 1549 : super(new _SurfaceProxyControl.fromHandle(handle));
1527 1550
1528 SurfaceProxy.unbound() 1551 SurfaceProxy.unbound()
1529 : super(new _SurfaceProxyControl.unbound()); 1552 : super(new _SurfaceProxyControl.unbound());
1530 1553
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 ctrl.proxyError("The Proxy is closed."); 1608 ctrl.proxyError("The Proxy is closed.");
1586 return; 1609 return;
1587 } 1610 }
1588 var params = new _SurfaceDestroySurfaceParams(); 1611 var params = new _SurfaceDestroySurfaceParams();
1589 params.idLocal = idLocal; 1612 params.idLocal = idLocal;
1590 ctrl.sendMessage(params, 1613 ctrl.sendMessage(params,
1591 _surfaceMethodDestroySurfaceName); 1614 _surfaceMethodDestroySurfaceName);
1592 } 1615 }
1593 } 1616 }
1594 1617
1595 1618 class _SurfaceStubControl
1596 class SurfaceStub extends bindings.Stub { 1619 extends bindings.StubMessageHandler
1620 implements bindings.StubControl<Surface> {
1597 Surface _impl; 1621 Surface _impl;
1598 1622
1599 SurfaceStub.fromEndpoint( 1623 _SurfaceStubControl.fromEndpoint(
1600 core.MojoMessagePipeEndpoint endpoint, [Surface impl]) 1624 core.MojoMessagePipeEndpoint endpoint, [Surface impl])
1601 : super.fromEndpoint(endpoint, autoBegin: impl != null) { 1625 : super.fromEndpoint(endpoint, autoBegin: impl != null) {
1602 _impl = impl; 1626 _impl = impl;
1603 } 1627 }
1604 1628
1605 SurfaceStub.fromHandle( 1629 _SurfaceStubControl.fromHandle(
1606 core.MojoHandle handle, [Surface impl]) 1630 core.MojoHandle handle, [Surface impl])
1607 : super.fromHandle(handle, autoBegin: impl != null) { 1631 : super.fromHandle(handle, autoBegin: impl != null) {
1608 _impl = impl; 1632 _impl = impl;
1609 } 1633 }
1610 1634
1611 SurfaceStub.unbound([this._impl]) : super.unbound(); 1635 _SurfaceStubControl.unbound([this._impl]) : super.unbound();
1612
1613 static SurfaceStub newFromEndpoint(
1614 core.MojoMessagePipeEndpoint endpoint) {
1615 assert(endpoint.setDescription("For SurfaceStub"));
1616 return new SurfaceStub.fromEndpoint(endpoint);
1617 }
1618 1636
1619 1637
1620 SurfaceGetIdNamespaceResponseParams _surfaceGetIdNamespaceResponseParamsFactor y(int idNamespace) { 1638 SurfaceGetIdNamespaceResponseParams _surfaceGetIdNamespaceResponseParamsFactor y(int idNamespace) {
1621 var result = new SurfaceGetIdNamespaceResponseParams(); 1639 var result = new SurfaceGetIdNamespaceResponseParams();
1622 result.idNamespace = idNamespace; 1640 result.idNamespace = idNamespace;
1623 return result; 1641 return result;
1624 } 1642 }
1625 SurfaceSubmitFrameResponseParams _surfaceSubmitFrameResponseParamsFactory() { 1643 SurfaceSubmitFrameResponseParams _surfaceSubmitFrameResponseParamsFactory() {
1626 var result = new SurfaceSubmitFrameResponseParams(); 1644 var result = new SurfaceSubmitFrameResponseParams();
1627 return result; 1645 return result;
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
1713 } 1731 }
1714 1732
1715 @override 1733 @override
1716 void bind(core.MojoMessagePipeEndpoint endpoint) { 1734 void bind(core.MojoMessagePipeEndpoint endpoint) {
1717 super.bind(endpoint); 1735 super.bind(endpoint);
1718 if (!isOpen && (_impl != null)) { 1736 if (!isOpen && (_impl != null)) {
1719 beginHandlingEvents(); 1737 beginHandlingEvents();
1720 } 1738 }
1721 } 1739 }
1722 1740
1741 @override
1723 String toString() { 1742 String toString() {
1724 var superString = super.toString(); 1743 var superString = super.toString();
1725 return "SurfaceStub($superString)"; 1744 return "_SurfaceStubControl($superString)";
1726 } 1745 }
1727 1746
1728 int get version => 0; 1747 int get version => 0;
1729 1748
1730 static service_describer.ServiceDescription _cachedServiceDescription; 1749 static service_describer.ServiceDescription _cachedServiceDescription;
1731 static service_describer.ServiceDescription get serviceDescription { 1750 static service_describer.ServiceDescription get serviceDescription {
1732 if (_cachedServiceDescription == null) { 1751 if (_cachedServiceDescription == null) {
1733 _cachedServiceDescription = new _SurfaceServiceDescription(); 1752 _cachedServiceDescription = new _SurfaceServiceDescription();
1734 } 1753 }
1735 return _cachedServiceDescription; 1754 return _cachedServiceDescription;
1736 } 1755 }
1737 } 1756 }
1738 1757
1758 class SurfaceStub
1759 extends bindings.Stub<Surface>
1760 implements Surface {
1761 SurfaceStub.fromEndpoint(
1762 core.MojoMessagePipeEndpoint endpoint, [Surface impl])
1763 : super(new _SurfaceStubControl.fromEndpoint(endpoint, impl));
1764
1765 SurfaceStub.fromHandle(
1766 core.MojoHandle handle, [Surface impl])
1767 : super(new _SurfaceStubControl.fromHandle(handle, impl));
1768
1769 SurfaceStub.unbound([Surface impl])
1770 : super(new _SurfaceStubControl.unbound(impl));
1771
1772 static SurfaceStub newFromEndpoint(
1773 core.MojoMessagePipeEndpoint endpoint) {
1774 assert(endpoint.setDescription("For SurfaceStub"));
1775 return new SurfaceStub.fromEndpoint(endpoint);
1776 }
1777
1778 static service_describer.ServiceDescription get serviceDescription =>
1779 _SurfaceStubControl.serviceDescription;
1780
1781
1782 dynamic getIdNamespace([Function responseFactory = null]) {
1783 return impl.getIdNamespace(responseFactory);
1784 }
1785 void setResourceReturner(Object returner) {
1786 return impl.setResourceReturner(returner);
1787 }
1788 void createSurface(int idLocal) {
1789 return impl.createSurface(idLocal);
1790 }
1791 dynamic submitFrame(int idLocal,Frame frame,[Function responseFactory = null]) {
1792 return impl.submitFrame(idLocal,frame,responseFactory);
1793 }
1794 void destroySurface(int idLocal) {
1795 return impl.destroySurface(idLocal);
1796 }
1797 }
1798
1739 1799
1740 1800
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698