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

Side by Side Diff: mojo/public/dart/src/application_connection.dart

Issue 954653002: Make Sky embedder.connection deal with null handles (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 5 years, 9 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
« no previous file with comments | « no previous file | sky/framework/embedder.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 core.Listener ServiceFactory(core.MojoMessagePipeEndpoint endpoint); 7 typedef core.Listener ServiceFactory(core.MojoMessagePipeEndpoint endpoint);
8 typedef void FallbackServiceFactory(String interfaceName, 8 typedef void FallbackServiceFactory(String interfaceName,
9 core.MojoMessagePipeEndpoint endpoint); 9 core.MojoMessagePipeEndpoint endpoint);
10 10
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 ApplicationConnection(ServiceProviderStub stub, ServiceProviderProxy proxy) 67 ApplicationConnection(ServiceProviderStub stub, ServiceProviderProxy proxy)
68 : remoteServiceProvider = proxy { 68 : remoteServiceProvider = proxy {
69 if (stub != null) _localServiceProvider = 69 if (stub != null) _localServiceProvider =
70 new LocalServiceProvider(this, stub); 70 new LocalServiceProvider(this, stub);
71 } 71 }
72 72
73 bindings.Proxy requestService(bindings.Proxy proxy) { 73 bindings.Proxy requestService(bindings.Proxy proxy) {
74 assert(!proxy.isBound && 74 assert(!proxy.isBound &&
75 (remoteServiceProvider != null) && 75 (remoteServiceProvider != null) &&
76 remoteServiceProvider.isBound); 76 remoteServiceProvider.isBound);
77 var applicationPipe = new core.MojoMessagePipe(); 77 var pipe = new core.MojoMessagePipe();
78 var proxyEndpoint = applicationPipe.endpoints[0]; 78 proxy.bind(pipe.endpoints[0]);
79 var applicationEndpoint = applicationPipe.endpoints[1]; 79 remoteServiceProvider.connectToService(proxy.name, pipe.endpoints[1]);
80 proxy.bind(proxyEndpoint);
81 remoteServiceProvider.connectToService(proxy.name, applicationEndpoint);
82 return proxy; 80 return proxy;
83 } 81 }
84 82
85 void provideService(String interfaceName, ServiceFactory factory) { 83 void provideService(String interfaceName, ServiceFactory factory) {
86 assert(_localServiceProvider != null); 84 assert(_localServiceProvider != null);
87 _nameToServiceFactory[interfaceName] = factory; 85 _nameToServiceFactory[interfaceName] = factory;
88 } 86 }
89 87
90 void listen() { 88 void listen() {
91 if (_localServiceProvider != null) _localServiceProvider.listen(); 89 if (_localServiceProvider != null) _localServiceProvider.listen();
92 } 90 }
93 91
94 void close({bool nodefer: false}) { 92 void close({bool nodefer: false}) {
95 if (remoteServiceProvider != null) { 93 if (remoteServiceProvider != null) {
96 remoteServiceProvider.close(); 94 remoteServiceProvider.close();
97 remoteServiceProvider = null; 95 remoteServiceProvider = null;
98 } 96 }
99 if (_localServiceProvider != null) { 97 if (_localServiceProvider != null) {
100 _localServiceProvider.close(nodefer: nodefer); 98 _localServiceProvider.close(nodefer: nodefer);
101 _localServiceProvider = null; 99 _localServiceProvider = null;
102 } 100 }
103 101
104 } 102 }
105 } 103 }
OLDNEW
« no previous file with comments | « no previous file | sky/framework/embedder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698