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

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

Issue 975973002: Update mojo sdk to rev f68e697e389943cd9bf9652397312280e96b127a (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: shake fist at msvc 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: third_party/mojo/src/mojo/public/dart/src/application_connection.dart
diff --git a/third_party/mojo/src/mojo/public/dart/src/application_connection.dart b/third_party/mojo/src/mojo/public/dart/src/application_connection.dart
index 4f314686a51bb58796a30c91be753758a08f5d8d..4f0b6c8ed250056b670b9b7cddee8faeb53c7b07 100644
--- a/third_party/mojo/src/mojo/public/dart/src/application_connection.dart
+++ b/third_party/mojo/src/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,15 +70,20 @@ class ApplicationConnection {
new LocalServiceProvider(this, stub);
}
- bindings.Proxy requestService(bindings.Proxy proxy) {
- assert(!proxy.isBound &&
+ FallbackServiceFactory get fallbackServiceFactory => _fallbackServiceFactory;
+ set fallbackServiceFactory(FallbackServiceFactory f) {
+ assert(_localServiceProvider != null);
+ _fallbackServiceFactory = f;
+ }
+
+ bindings.ProxyBase requestService(bindings.ProxyBase proxy) {
+ assert(!proxy.impl.isBound &&
(remoteServiceProvider != null) &&
- remoteServiceProvider.isBound);
- var applicationPipe = new core.MojoMessagePipe();
- var proxyEndpoint = applicationPipe.endpoints[0];
- var applicationEndpoint = applicationPipe.endpoints[1];
- proxy.bind(proxyEndpoint);
- remoteServiceProvider.connectToService(proxy.name, applicationEndpoint);
+ remoteServiceProvider.impl.isBound);
+ var pipe = new core.MojoMessagePipe();
+ proxy.impl.bind(pipe.endpoints[0]);
+ remoteServiceProvider.ptr.connectToService(
+ proxy.name, pipe.endpoints[1]);
return proxy;
}
@@ -88,7 +93,8 @@ class ApplicationConnection {
}
void listen() {
- if (_localServiceProvider != null) _localServiceProvider.listen();
+ assert(_localServiceProvider != null);
+ _localServiceProvider.listen();
}
void close({bool nodefer: false}) {
« no previous file with comments | « third_party/mojo/src/mojo/public/dart/src/application.dart ('k') | third_party/mojo/src/mojo/public/dart/src/codec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698