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

Side by Side Diff: mojo/dart/packages/mojo/lib/src/application_connection.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 part of application; 5 part of application;
6 6
7 typedef void ServiceFactory(core.MojoMessagePipeEndpoint endpoint); 7 typedef void ServiceFactory(core.MojoMessagePipeEndpoint endpoint);
8 typedef void FallbackServiceFactory( 8 typedef void FallbackServiceFactory(
9 String interfaceName, core.MojoMessagePipeEndpoint endpoint); 9 String interfaceName, core.MojoMessagePipeEndpoint endpoint);
10 10
11 class LocalServiceProvider implements ServiceProvider { 11 class LocalServiceProvider implements ServiceProvider {
12 final ApplicationConnection connection; 12 final ApplicationConnection connection;
13 ServiceProviderStub _stub; 13 ServiceProviderStub _stub;
14 14
15 LocalServiceProvider(this.connection, this._stub) { 15 LocalServiceProvider(this.connection, this._stub) {
16 _stub.impl = this; 16 _stub.impl = this;
17 if (!_stub.isOpen) { 17 if (!_stub.ctrl.isOpen) {
18 throw new core.MojoApiError("The service provider stub must be open"); 18 throw new core.MojoApiError("The service provider stub must be open");
19 } 19 }
20 } 20 }
21 21
22 set onError(Function f) { 22 set onError(Function f) {
23 _stub.onError = f; 23 _stub.ctrl.onError = f;
24 } 24 }
25 25
26 Future close({bool immediate: false}) => _stub.close(immediate: immediate); 26 Future close({bool immediate: false}) => _stub.close(immediate: immediate);
27 27
28 void connectToService_( 28 void connectToService_(
29 String interfaceName, core.MojoMessagePipeEndpoint pipe) { 29 String interfaceName, core.MojoMessagePipeEndpoint pipe) {
30 if (connection._nameToServiceFactory.containsKey(interfaceName)) { 30 if (connection._nameToServiceFactory.containsKey(interfaceName)) {
31 connection._nameToServiceFactory[interfaceName](pipe); 31 connection._nameToServiceFactory[interfaceName](pipe);
32 return; 32 return;
33 } 33 }
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 if (_localServiceProvider != null) { 161 if (_localServiceProvider != null) {
162 lspCloseFuture = _localServiceProvider.close(immediate: immediate); 162 lspCloseFuture = _localServiceProvider.close(immediate: immediate);
163 _localServiceProvider = null; 163 _localServiceProvider = null;
164 } else { 164 } else {
165 lspCloseFuture = new Future.value(null); 165 lspCloseFuture = new Future.value(null);
166 } 166 }
167 return rspCloseFuture.then((_) => lspCloseFuture); 167 return rspCloseFuture.then((_) => lspCloseFuture);
168 } 168 }
169 } 169 }
OLDNEW
« no previous file with comments | « mojo/dart/packages/mojo/lib/src/application.dart ('k') | mojo/dart/packages/mojo/lib/src/codec.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698