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

Unified Diff: mojo/public/dart/src/application_connection.dart

Issue 959993002: Dart: Removes name conflicts from generated bindings. (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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/public/dart/src/application_connection.dart
diff --git a/mojo/public/dart/src/application_connection.dart b/mojo/public/dart/src/application_connection.dart
index c44944e2a21e02bc9693367cae3359d7e67465e1..53a584da512e78937f2ffce2bbadf63b8a162683 100644
--- a/mojo/public/dart/src/application_connection.dart
+++ b/mojo/public/dart/src/application_connection.dart
@@ -4,28 +4,28 @@
part of application;
-typedef core.Listener ServiceFactory(core.MojoMessagePipeEndpoint endpoint);
+typedef Object ServiceFactory(core.MojoMessagePipeEndpoint endpoint);
typedef void FallbackServiceFactory(String interfaceName,
core.MojoMessagePipeEndpoint endpoint);
-class LocalServiceProvider extends ServiceProvider {
+class LocalServiceProvider implements ServiceProvider {
final ApplicationConnection connection;
+ ServiceProviderStub _stub;
- LocalServiceProvider(ApplicationConnection this.connection,
- ServiceProviderStub stub)
- : super.fromStub(stub) {
- delegate = this;
+ LocalServiceProvider(this.connection, this._stub) {
+ _stub.delegate = this;
}
+ listen() => _stub.listen();
+
+ void close({bool nodefer : false}) => _stub.close(nodefer: nodefer);
+
void connectToService(String interfaceName,
core.MojoMessagePipeEndpoint pipe) {
if (connection._nameToServiceFactory.containsKey(interfaceName)) {
- var listener = connection._nameToServiceFactory[interfaceName](pipe);
- if (listener != null) {
- listener.listen();
- return;
- }
+ connection._nameToServiceFactory[interfaceName](pipe);
+ return;
}
if (connection.fallbackServiceFactory != null) {
connection.fallbackServiceFactory(interfaceName, pipe);
@@ -44,11 +44,11 @@ class LocalServiceProvider extends ServiceProvider {
// and they're passed to the Application AcceptConnection() method.
//
// To request a service from the remote application:
-// var proxy = applicationConnection.requestService(ViewManagerClient.name);
+// var proxy = applicationConnection.requestService(ViewManagerClientName);
//
// To provide a service to the remote application, specify a function that
// returns a service. For example:
-// applicationConnection.provideService(ViewManagerClient.name, (pipe) =>
+// applicationConnection.provideService(ViewManagerClientName, (pipe) =>
// new ViewManagerClientImpl(pipe));
//
// To handle requests for any interface, set fallbackServiceFactory to a
@@ -62,7 +62,7 @@ class ApplicationConnection {
ServiceProviderProxy remoteServiceProvider;
LocalServiceProvider _localServiceProvider;
final _nameToServiceFactory = new Map<String, ServiceFactory>();
- FallbackServiceFactory fallbackServiceFactory;
+ FallbackServiceFactory _fallbackServiceFactory;
ApplicationConnection(ServiceProviderStub stub, ServiceProviderProxy proxy)
: remoteServiceProvider = proxy {
@@ -70,10 +70,16 @@ class ApplicationConnection {
new LocalServiceProvider(this, stub);
}
+ FallbackServiceFactory get fallbackServiceFactory => _fallbackServiceFactory;
+ set fallbackServiceFactory(FallbackServiceFactory f) {
+ assert(_localServiceProvider != null);
+ _fallbackServiceFactory = f;
+ }
+
bindings.Proxy requestService(bindings.Proxy proxy) {
assert(!proxy.isBound &&
(remoteServiceProvider != null) &&
- remoteServiceProvider.isBound);
+ ServiceProviderIsBound(remoteServiceProvider));
var pipe = new core.MojoMessagePipe();
proxy.bind(pipe.endpoints[0]);
remoteServiceProvider.connectToService(proxy.name, pipe.endpoints[1]);
@@ -86,12 +92,13 @@ class ApplicationConnection {
}
void listen() {
- if (_localServiceProvider != null) _localServiceProvider.listen();
+ assert(_localServiceProvider != null);
+ _localServiceProvider.listen();
}
void close({bool nodefer: false}) {
if (remoteServiceProvider != null) {
- remoteServiceProvider.close();
+ ServiceProviderProxyClose(remoteServiceProvider);
remoteServiceProvider = null;
}
if (_localServiceProvider != null) {

Powered by Google App Engine
This is Rietveld 408576698