| 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 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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1365 impl.requireVersion(requiredVersion); | 1365 impl.requireVersion(requiredVersion); |
| 1366 } | 1366 } |
| 1367 | 1367 |
| 1368 String toString() { | 1368 String toString() { |
| 1369 return "ResourceReturnerProxy($impl)"; | 1369 return "ResourceReturnerProxy($impl)"; |
| 1370 } | 1370 } |
| 1371 } | 1371 } |
| 1372 | 1372 |
| 1373 | 1373 |
| 1374 class ResourceReturnerStub extends bindings.Stub { | 1374 class ResourceReturnerStub extends bindings.Stub { |
| 1375 ResourceReturner _impl = null; | 1375 ResourceReturner _impl; |
| 1376 | 1376 |
| 1377 ResourceReturnerStub.fromEndpoint( | 1377 ResourceReturnerStub.fromEndpoint( |
| 1378 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 1378 core.MojoMessagePipeEndpoint endpoint, [ResourceReturner impl]) |
| 1379 : super.fromEndpoint(endpoint); | 1379 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 1380 _impl = impl; |
| 1381 } |
| 1380 | 1382 |
| 1381 ResourceReturnerStub.fromHandle(core.MojoHandle handle, [this._impl]) | 1383 ResourceReturnerStub.fromHandle( |
| 1382 : super.fromHandle(handle); | 1384 core.MojoHandle handle, [ResourceReturner impl]) |
| 1385 : super.fromHandle(handle, autoBegin: impl != null) { |
| 1386 _impl = impl; |
| 1387 } |
| 1383 | 1388 |
| 1384 ResourceReturnerStub.unbound() : super.unbound(); | 1389 ResourceReturnerStub.unbound() : super.unbound(); |
| 1385 | 1390 |
| 1386 static ResourceReturnerStub newFromEndpoint( | 1391 static ResourceReturnerStub newFromEndpoint( |
| 1387 core.MojoMessagePipeEndpoint endpoint) { | 1392 core.MojoMessagePipeEndpoint endpoint) { |
| 1388 assert(endpoint.setDescription("For ResourceReturnerStub")); | 1393 assert(endpoint.setDescription("For ResourceReturnerStub")); |
| 1389 return new ResourceReturnerStub.fromEndpoint(endpoint); | 1394 return new ResourceReturnerStub.fromEndpoint(endpoint); |
| 1390 } | 1395 } |
| 1391 | 1396 |
| 1392 | 1397 |
| 1393 | 1398 |
| 1394 dynamic handleMessage(bindings.ServiceMessage message) { | 1399 dynamic handleMessage(bindings.ServiceMessage message) { |
| 1395 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1400 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 1396 return bindings.ControlMessageHandler.handleMessage(this, | 1401 return bindings.ControlMessageHandler.handleMessage(this, |
| 1397 0, | 1402 0, |
| 1398 message); | 1403 message); |
| 1399 } | 1404 } |
| 1400 assert(_impl != null); | 1405 if (_impl == null) { |
| 1406 throw new core.MojoApiError("$this has no implementation set"); |
| 1407 } |
| 1401 switch (message.header.type) { | 1408 switch (message.header.type) { |
| 1402 case _resourceReturnerMethodReturnResourcesName: | 1409 case _resourceReturnerMethodReturnResourcesName: |
| 1403 var params = _ResourceReturnerReturnResourcesParams.deserialize( | 1410 var params = _ResourceReturnerReturnResourcesParams.deserialize( |
| 1404 message.payload); | 1411 message.payload); |
| 1405 _impl.returnResources(params.resources); | 1412 _impl.returnResources(params.resources); |
| 1406 break; | 1413 break; |
| 1407 default: | 1414 default: |
| 1408 throw new bindings.MojoCodecError("Unexpected message name"); | 1415 throw new bindings.MojoCodecError("Unexpected message name"); |
| 1409 break; | 1416 break; |
| 1410 } | 1417 } |
| 1411 return null; | 1418 return null; |
| 1412 } | 1419 } |
| 1413 | 1420 |
| 1414 ResourceReturner get impl => _impl; | 1421 ResourceReturner get impl => _impl; |
| 1415 set impl(ResourceReturner d) { | 1422 set impl(ResourceReturner d) { |
| 1416 assert(_impl == null); | 1423 if (d == null) { |
| 1424 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 1425 } |
| 1426 if (isBound && (_impl == null)) { |
| 1427 beginHandlingEvents(); |
| 1428 } |
| 1417 _impl = d; | 1429 _impl = d; |
| 1418 } | 1430 } |
| 1419 | 1431 |
| 1432 @override |
| 1433 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 1434 super.bind(endpoint); |
| 1435 if (!isOpen && (_impl != null)) { |
| 1436 beginHandlingEvents(); |
| 1437 } |
| 1438 } |
| 1439 |
| 1420 String toString() { | 1440 String toString() { |
| 1421 var superString = super.toString(); | 1441 var superString = super.toString(); |
| 1422 return "ResourceReturnerStub($superString)"; | 1442 return "ResourceReturnerStub($superString)"; |
| 1423 } | 1443 } |
| 1424 | 1444 |
| 1425 int get version => 0; | 1445 int get version => 0; |
| 1426 | 1446 |
| 1427 static service_describer.ServiceDescription _cachedServiceDescription; | 1447 static service_describer.ServiceDescription _cachedServiceDescription; |
| 1428 static service_describer.ServiceDescription get serviceDescription { | 1448 static service_describer.ServiceDescription get serviceDescription { |
| 1429 if (_cachedServiceDescription == null) { | 1449 if (_cachedServiceDescription == null) { |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1639 impl.requireVersion(requiredVersion); | 1659 impl.requireVersion(requiredVersion); |
| 1640 } | 1660 } |
| 1641 | 1661 |
| 1642 String toString() { | 1662 String toString() { |
| 1643 return "SurfaceProxy($impl)"; | 1663 return "SurfaceProxy($impl)"; |
| 1644 } | 1664 } |
| 1645 } | 1665 } |
| 1646 | 1666 |
| 1647 | 1667 |
| 1648 class SurfaceStub extends bindings.Stub { | 1668 class SurfaceStub extends bindings.Stub { |
| 1649 Surface _impl = null; | 1669 Surface _impl; |
| 1650 | 1670 |
| 1651 SurfaceStub.fromEndpoint( | 1671 SurfaceStub.fromEndpoint( |
| 1652 core.MojoMessagePipeEndpoint endpoint, [this._impl]) | 1672 core.MojoMessagePipeEndpoint endpoint, [Surface impl]) |
| 1653 : super.fromEndpoint(endpoint); | 1673 : super.fromEndpoint(endpoint, autoBegin: impl != null) { |
| 1674 _impl = impl; |
| 1675 } |
| 1654 | 1676 |
| 1655 SurfaceStub.fromHandle(core.MojoHandle handle, [this._impl]) | 1677 SurfaceStub.fromHandle( |
| 1656 : super.fromHandle(handle); | 1678 core.MojoHandle handle, [Surface impl]) |
| 1679 : super.fromHandle(handle, autoBegin: impl != null) { |
| 1680 _impl = impl; |
| 1681 } |
| 1657 | 1682 |
| 1658 SurfaceStub.unbound() : super.unbound(); | 1683 SurfaceStub.unbound() : super.unbound(); |
| 1659 | 1684 |
| 1660 static SurfaceStub newFromEndpoint( | 1685 static SurfaceStub newFromEndpoint( |
| 1661 core.MojoMessagePipeEndpoint endpoint) { | 1686 core.MojoMessagePipeEndpoint endpoint) { |
| 1662 assert(endpoint.setDescription("For SurfaceStub")); | 1687 assert(endpoint.setDescription("For SurfaceStub")); |
| 1663 return new SurfaceStub.fromEndpoint(endpoint); | 1688 return new SurfaceStub.fromEndpoint(endpoint); |
| 1664 } | 1689 } |
| 1665 | 1690 |
| 1666 | 1691 |
| 1667 SurfaceGetIdNamespaceResponseParams _surfaceGetIdNamespaceResponseParamsFactor
y(int idNamespace) { | 1692 SurfaceGetIdNamespaceResponseParams _surfaceGetIdNamespaceResponseParamsFactor
y(int idNamespace) { |
| 1668 var result = new SurfaceGetIdNamespaceResponseParams(); | 1693 var result = new SurfaceGetIdNamespaceResponseParams(); |
| 1669 result.idNamespace = idNamespace; | 1694 result.idNamespace = idNamespace; |
| 1670 return result; | 1695 return result; |
| 1671 } | 1696 } |
| 1672 SurfaceSubmitFrameResponseParams _surfaceSubmitFrameResponseParamsFactory() { | 1697 SurfaceSubmitFrameResponseParams _surfaceSubmitFrameResponseParamsFactory() { |
| 1673 var result = new SurfaceSubmitFrameResponseParams(); | 1698 var result = new SurfaceSubmitFrameResponseParams(); |
| 1674 return result; | 1699 return result; |
| 1675 } | 1700 } |
| 1676 | 1701 |
| 1677 dynamic handleMessage(bindings.ServiceMessage message) { | 1702 dynamic handleMessage(bindings.ServiceMessage message) { |
| 1678 if (bindings.ControlMessageHandler.isControlMessage(message)) { | 1703 if (bindings.ControlMessageHandler.isControlMessage(message)) { |
| 1679 return bindings.ControlMessageHandler.handleMessage(this, | 1704 return bindings.ControlMessageHandler.handleMessage(this, |
| 1680 0, | 1705 0, |
| 1681 message); | 1706 message); |
| 1682 } | 1707 } |
| 1683 assert(_impl != null); | 1708 if (_impl == null) { |
| 1709 throw new core.MojoApiError("$this has no implementation set"); |
| 1710 } |
| 1684 switch (message.header.type) { | 1711 switch (message.header.type) { |
| 1685 case _surfaceMethodGetIdNamespaceName: | 1712 case _surfaceMethodGetIdNamespaceName: |
| 1686 var response = _impl.getIdNamespace(_surfaceGetIdNamespaceResponseParams
Factory); | 1713 var response = _impl.getIdNamespace(_surfaceGetIdNamespaceResponseParams
Factory); |
| 1687 if (response is Future) { | 1714 if (response is Future) { |
| 1688 return response.then((response) { | 1715 return response.then((response) { |
| 1689 if (response != null) { | 1716 if (response != null) { |
| 1690 return buildResponseWithId( | 1717 return buildResponseWithId( |
| 1691 response, | 1718 response, |
| 1692 _surfaceMethodGetIdNamespaceName, | 1719 _surfaceMethodGetIdNamespaceName, |
| 1693 message.header.requestId, | 1720 message.header.requestId, |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1741 break; | 1768 break; |
| 1742 default: | 1769 default: |
| 1743 throw new bindings.MojoCodecError("Unexpected message name"); | 1770 throw new bindings.MojoCodecError("Unexpected message name"); |
| 1744 break; | 1771 break; |
| 1745 } | 1772 } |
| 1746 return null; | 1773 return null; |
| 1747 } | 1774 } |
| 1748 | 1775 |
| 1749 Surface get impl => _impl; | 1776 Surface get impl => _impl; |
| 1750 set impl(Surface d) { | 1777 set impl(Surface d) { |
| 1751 assert(_impl == null); | 1778 if (d == null) { |
| 1779 throw new core.MojoApiError("$this: Cannot set a null implementation"); |
| 1780 } |
| 1781 if (isBound && (_impl == null)) { |
| 1782 beginHandlingEvents(); |
| 1783 } |
| 1752 _impl = d; | 1784 _impl = d; |
| 1753 } | 1785 } |
| 1754 | 1786 |
| 1787 @override |
| 1788 void bind(core.MojoMessagePipeEndpoint endpoint) { |
| 1789 super.bind(endpoint); |
| 1790 if (!isOpen && (_impl != null)) { |
| 1791 beginHandlingEvents(); |
| 1792 } |
| 1793 } |
| 1794 |
| 1755 String toString() { | 1795 String toString() { |
| 1756 var superString = super.toString(); | 1796 var superString = super.toString(); |
| 1757 return "SurfaceStub($superString)"; | 1797 return "SurfaceStub($superString)"; |
| 1758 } | 1798 } |
| 1759 | 1799 |
| 1760 int get version => 0; | 1800 int get version => 0; |
| 1761 | 1801 |
| 1762 static service_describer.ServiceDescription _cachedServiceDescription; | 1802 static service_describer.ServiceDescription _cachedServiceDescription; |
| 1763 static service_describer.ServiceDescription get serviceDescription { | 1803 static service_describer.ServiceDescription get serviceDescription { |
| 1764 if (_cachedServiceDescription == null) { | 1804 if (_cachedServiceDescription == null) { |
| 1765 _cachedServiceDescription = new _SurfaceServiceDescription(); | 1805 _cachedServiceDescription = new _SurfaceServiceDescription(); |
| 1766 } | 1806 } |
| 1767 return _cachedServiceDescription; | 1807 return _cachedServiceDescription; |
| 1768 } | 1808 } |
| 1769 } | 1809 } |
| 1770 | 1810 |
| 1771 | 1811 |
| 1772 | 1812 |
| OLD | NEW |