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

Unified Diff: mojo/dart/packages/mojo_services/lib/mojo/asset_bundle/asset_bundle.mojom.dart

Issue 1998433002: Dart: Adds Interface and InterfaceRequest interfaces. (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 side-by-side diff with in-line comments
Download patch
Index: mojo/dart/packages/mojo_services/lib/mojo/asset_bundle/asset_bundle.mojom.dart
diff --git a/mojo/dart/packages/mojo_services/lib/mojo/asset_bundle/asset_bundle.mojom.dart b/mojo/dart/packages/mojo_services/lib/mojo/asset_bundle/asset_bundle.mojom.dart
index b857068a9554852aeb8556ca494f396094091cb9..a7b8bc71703f87a3f0a89d1d6d376a230f48a616 100644
--- a/mojo/dart/packages/mojo_services/lib/mojo/asset_bundle/asset_bundle.mojom.dart
+++ b/mojo/dart/packages/mojo_services/lib/mojo/asset_bundle/asset_bundle.mojom.dart
@@ -158,7 +158,7 @@ class _AssetUnpackerUnpackZipStreamParams extends bindings.Struct {
const bindings.StructDataHeader(16, 0)
];
core.MojoDataPipeConsumer zippedAssets = null;
- Object assetBundle = null;
+ AssetBundleInterfaceRequest assetBundle = null;
_AssetUnpackerUnpackZipStreamParams() : super(kVersions.last.size);
@@ -251,12 +251,50 @@ class _AssetBundleServiceDescription implements service_describer.ServiceDescrip
abstract class AssetBundle {
static const String serviceName = "mojo::asset_bundle::AssetBundle";
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _AssetBundleServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static AssetBundleProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ AssetBundleProxy p = new AssetBundleProxy.unbound();
+ String name = serviceName ?? AssetBundle.serviceName;
+ if ((name == null) || name.isEmpty) {
+ throw new core.MojoApiError(
+ "If an interface has no ServiceName, then one must be provided.");
+ }
+ s.connectToService(url, p, name);
+ return p;
+ }
dynamic getAsStream(String assetName,[Function responseFactory = null]);
}
+abstract class AssetBundleInterface
+ implements bindings.MojoInterface<AssetBundle>,
+ AssetBundle {
+ factory AssetBundleInterface([AssetBundle impl]) =>
+ new AssetBundleStub.unbound(impl);
+ factory AssetBundleInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [AssetBundle impl]) =>
+ new AssetBundleStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class AssetBundleInterfaceRequest
+ implements bindings.MojoInterface<AssetBundle>,
+ AssetBundle {
+ factory AssetBundleInterfaceRequest() =>
+ new AssetBundleProxy.unbound();
+}
+
class _AssetBundleProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<AssetBundle> {
_AssetBundleProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -265,9 +303,6 @@ class _AssetBundleProxyControl
_AssetBundleProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _AssetBundleServiceDescription();
-
String get serviceName => AssetBundle.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -299,6 +334,11 @@ class _AssetBundleProxyControl
}
}
+ AssetBundle get impl => null;
+ set impl(AssetBundle _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -307,8 +347,10 @@ class _AssetBundleProxyControl
}
class AssetBundleProxy
- extends bindings.Proxy
- implements AssetBundle {
+ extends bindings.Proxy<AssetBundle>
+ implements AssetBundle,
+ AssetBundleInterface,
+ AssetBundleInterfaceRequest {
AssetBundleProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _AssetBundleProxyControl.fromEndpoint(endpoint));
@@ -325,13 +367,6 @@ class AssetBundleProxy
return new AssetBundleProxy.fromEndpoint(endpoint);
}
- factory AssetBundleProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- AssetBundleProxy p = new AssetBundleProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
dynamic getAsStream(String assetName,[Function responseFactory = null]) {
var params = new _AssetBundleGetAsStreamParams();
@@ -363,6 +398,8 @@ class _AssetBundleStubControl
_AssetBundleStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => AssetBundle.serviceName;
+
AssetBundleGetAsStreamResponseParams _assetBundleGetAsStreamResponseParamsFactory(core.MojoDataPipeConsumer assetData) {
var result = new AssetBundleGetAsStreamResponseParams();
@@ -435,19 +472,16 @@ class _AssetBundleStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _AssetBundleServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class AssetBundleStub
extends bindings.Stub<AssetBundle>
- implements AssetBundle {
+ implements AssetBundle,
+ AssetBundleInterface,
+ AssetBundleInterfaceRequest {
+ AssetBundleStub.unbound([AssetBundle impl])
+ : super(new _AssetBundleStubControl.unbound(impl));
+
AssetBundleStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [AssetBundle impl])
: super(new _AssetBundleStubControl.fromEndpoint(endpoint, impl));
@@ -456,18 +490,12 @@ class AssetBundleStub
core.MojoHandle handle, [AssetBundle impl])
: super(new _AssetBundleStubControl.fromHandle(handle, impl));
- AssetBundleStub.unbound([AssetBundle impl])
- : super(new _AssetBundleStubControl.unbound(impl));
-
static AssetBundleStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For AssetBundleStub"));
return new AssetBundleStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _AssetBundleStubControl.serviceDescription;
-
dynamic getAsStream(String assetName,[Function responseFactory = null]) {
return impl.getAsStream(assetName,responseFactory);
@@ -489,12 +517,50 @@ class _AssetUnpackerServiceDescription implements service_describer.ServiceDescr
abstract class AssetUnpacker {
static const String serviceName = "mojo::asset_bundle::AssetUnpacker";
- void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, Object assetBundle);
+
+ static service_describer.ServiceDescription _cachedServiceDescription;
+ static service_describer.ServiceDescription get serviceDescription {
+ if (_cachedServiceDescription == null) {
+ _cachedServiceDescription = new _AssetUnpackerServiceDescription();
+ }
+ return _cachedServiceDescription;
+ }
+
+ static AssetUnpackerProxy connectToService(
+ bindings.ServiceConnector s, String url, [String serviceName]) {
+ AssetUnpackerProxy p = new AssetUnpackerProxy.unbound();
+ String name = serviceName ?? AssetUnpacker.serviceName;
+ if ((name == null) || name.isEmpty) {
+ throw new core.MojoApiError(
+ "If an interface has no ServiceName, then one must be provided.");
+ }
+ s.connectToService(url, p, name);
+ return p;
+ }
+ void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, AssetBundleInterfaceRequest assetBundle);
+}
+
+abstract class AssetUnpackerInterface
+ implements bindings.MojoInterface<AssetUnpacker>,
+ AssetUnpacker {
+ factory AssetUnpackerInterface([AssetUnpacker impl]) =>
+ new AssetUnpackerStub.unbound(impl);
+ factory AssetUnpackerInterface.fromEndpoint(
+ core.MojoMessagePipeEndpoint endpoint,
+ [AssetUnpacker impl]) =>
+ new AssetUnpackerStub.fromEndpoint(endpoint, impl);
+}
+
+abstract class AssetUnpackerInterfaceRequest
+ implements bindings.MojoInterface<AssetUnpacker>,
+ AssetUnpacker {
+ factory AssetUnpackerInterfaceRequest() =>
+ new AssetUnpackerProxy.unbound();
}
class _AssetUnpackerProxyControl
extends bindings.ProxyMessageHandler
- implements bindings.ProxyControl {
+ implements bindings.ProxyControl<AssetUnpacker> {
_AssetUnpackerProxyControl.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint) : super.fromEndpoint(endpoint);
@@ -503,9 +569,6 @@ class _AssetUnpackerProxyControl
_AssetUnpackerProxyControl.unbound() : super.unbound();
- service_describer.ServiceDescription get serviceDescription =>
- new _AssetUnpackerServiceDescription();
-
String get serviceName => AssetUnpacker.serviceName;
void handleResponse(bindings.ServiceMessage message) {
@@ -517,6 +580,11 @@ class _AssetUnpackerProxyControl
}
}
+ AssetUnpacker get impl => null;
+ set impl(AssetUnpacker _) {
+ throw new core.MojoApiError("The impl of a Proxy cannot be set.");
+ }
+
@override
String toString() {
var superString = super.toString();
@@ -525,8 +593,10 @@ class _AssetUnpackerProxyControl
}
class AssetUnpackerProxy
- extends bindings.Proxy
- implements AssetUnpacker {
+ extends bindings.Proxy<AssetUnpacker>
+ implements AssetUnpacker,
+ AssetUnpackerInterface,
+ AssetUnpackerInterfaceRequest {
AssetUnpackerProxy.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint)
: super(new _AssetUnpackerProxyControl.fromEndpoint(endpoint));
@@ -543,15 +613,8 @@ class AssetUnpackerProxy
return new AssetUnpackerProxy.fromEndpoint(endpoint);
}
- factory AssetUnpackerProxy.connectToService(
- bindings.ServiceConnector s, String url, [String serviceName]) {
- AssetUnpackerProxy p = new AssetUnpackerProxy.unbound();
- s.connectToService(url, p, serviceName);
- return p;
- }
-
- void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, Object assetBundle) {
+ void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, AssetBundleInterfaceRequest assetBundle) {
if (!ctrl.isBound) {
ctrl.proxyError("The Proxy is closed.");
return;
@@ -583,6 +646,8 @@ class _AssetUnpackerStubControl
_AssetUnpackerStubControl.unbound([this._impl]) : super.unbound();
+ String get serviceName => AssetUnpacker.serviceName;
+
dynamic handleMessage(bindings.ServiceMessage message) {
@@ -633,19 +698,16 @@ class _AssetUnpackerStubControl
}
int get version => 0;
-
- static service_describer.ServiceDescription _cachedServiceDescription;
- static service_describer.ServiceDescription get serviceDescription {
- if (_cachedServiceDescription == null) {
- _cachedServiceDescription = new _AssetUnpackerServiceDescription();
- }
- return _cachedServiceDescription;
- }
}
class AssetUnpackerStub
extends bindings.Stub<AssetUnpacker>
- implements AssetUnpacker {
+ implements AssetUnpacker,
+ AssetUnpackerInterface,
+ AssetUnpackerInterfaceRequest {
+ AssetUnpackerStub.unbound([AssetUnpacker impl])
+ : super(new _AssetUnpackerStubControl.unbound(impl));
+
AssetUnpackerStub.fromEndpoint(
core.MojoMessagePipeEndpoint endpoint, [AssetUnpacker impl])
: super(new _AssetUnpackerStubControl.fromEndpoint(endpoint, impl));
@@ -654,20 +716,14 @@ class AssetUnpackerStub
core.MojoHandle handle, [AssetUnpacker impl])
: super(new _AssetUnpackerStubControl.fromHandle(handle, impl));
- AssetUnpackerStub.unbound([AssetUnpacker impl])
- : super(new _AssetUnpackerStubControl.unbound(impl));
-
static AssetUnpackerStub newFromEndpoint(
core.MojoMessagePipeEndpoint endpoint) {
assert(endpoint.setDescription("For AssetUnpackerStub"));
return new AssetUnpackerStub.fromEndpoint(endpoint);
}
- static service_describer.ServiceDescription get serviceDescription =>
- _AssetUnpackerStubControl.serviceDescription;
-
- void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, Object assetBundle) {
+ void unpackZipStream(core.MojoDataPipeConsumer zippedAssets, AssetBundleInterfaceRequest assetBundle) {
return impl.unpackZipStream(zippedAssets, assetBundle);
}
}

Powered by Google App Engine
This is Rietveld 408576698