OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 package application | 5 package application |
6 | 6 |
7 import ( | 7 import ( |
8 "log" | 8 "log" |
9 "sync" | 9 "sync" |
10 | 10 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 impl.shell = shell.NewShellProxy(shellPointer, bindings.GetAsyncWaiter()
) | 94 impl.shell = shell.NewShellProxy(shellPointer, bindings.GetAsyncWaiter()
) |
95 if args != nil { | 95 if args != nil { |
96 impl.args = *args | 96 impl.args = *args |
97 } | 97 } |
98 impl.url = url | 98 impl.url = url |
99 impl.delegate.Initialize(impl) | 99 impl.delegate.Initialize(impl) |
100 return nil | 100 return nil |
101 } | 101 } |
102 | 102 |
103 // Mojo application implementation. | 103 // Mojo application implementation. |
104 func (impl *ApplicationImpl) AcceptConnection(requestorURL string, services *sp.
ServiceProvider_Request, exposedServices *sp.ServiceProvider_Pointer, resolvedUR
L string) error { | 104 func (impl *ApplicationImpl) AcceptConnection(requestorURL string, resolvedURL s
tring, services sp.ServiceProvider_Request) error { |
105 connection := newConnection(requestorURL, services, resolvedURL) | 105 connection := newConnection(requestorURL, services, resolvedURL) |
106 impl.delegate.AcceptConnection(connection) | 106 impl.delegate.AcceptConnection(connection) |
107 impl.addConnection(connection) | 107 impl.addConnection(connection) |
108 return nil | 108 return nil |
109 } | 109 } |
110 | 110 |
111 // Mojo application implementation. | 111 // Mojo application implementation. |
112 func (impl *ApplicationImpl) RequestQuit() error { | 112 func (impl *ApplicationImpl) RequestQuit() error { |
113 impl.quitOnce.Do(func() { | 113 impl.quitOnce.Do(func() { |
114 impl.delegate.Quit() | 114 impl.delegate.Quit() |
(...skipping 14 matching lines...) Expand all Loading... |
129 } | 129 } |
130 | 130 |
131 // Context implementaion. | 131 // Context implementaion. |
132 func (impl *ApplicationImpl) Args() []string { | 132 func (impl *ApplicationImpl) Args() []string { |
133 return impl.args | 133 return impl.args |
134 } | 134 } |
135 | 135 |
136 // Context implementaion. | 136 // Context implementaion. |
137 func (impl *ApplicationImpl) ConnectToApplication(remoteURL string) *OutgoingCon
nection { | 137 func (impl *ApplicationImpl) ConnectToApplication(remoteURL string) *OutgoingCon
nection { |
138 servicesRequest, servicesPointer := sp.CreateMessagePipeForServiceProvid
er() | 138 servicesRequest, servicesPointer := sp.CreateMessagePipeForServiceProvid
er() |
139 » if err := impl.shell.ConnectToApplication(remoteURL, &servicesRequest, n
il); err != nil { | 139 » if err := impl.shell.ConnectToApplication(remoteURL, servicesRequest); e
rr != nil { |
140 log.Printf("can't connect to %v: %v", remoteURL, err) | 140 log.Printf("can't connect to %v: %v", remoteURL, err) |
141 // In case of error message pipes sent through Shell are closed
and | 141 // In case of error message pipes sent through Shell are closed
and |
142 // the connection will work as if the remote application closed | 142 // the connection will work as if the remote application closed |
143 // both ServiceProvider's pipes. | 143 // both ServiceProvider's pipes. |
144 } | 144 } |
145 return &OutgoingConnection{ | 145 return &OutgoingConnection{ |
146 connectionInfo{ | 146 connectionInfo{ |
147 impl.url, | 147 impl.url, |
148 remoteURL, | 148 remoteURL, |
149 }, | 149 }, |
(...skipping 18 matching lines...) Expand all Loading... |
168 impl.connections = impl.connections[:last] | 168 impl.connections = impl.connections[:last] |
169 } else { | 169 } else { |
170 i++ | 170 i++ |
171 } | 171 } |
172 } | 172 } |
173 if !c.isClosed { | 173 if !c.isClosed { |
174 impl.connections = append(impl.connections, c) | 174 impl.connections = append(impl.connections, c) |
175 } | 175 } |
176 impl.mu.Unlock() | 176 impl.mu.Unlock() |
177 } | 177 } |
OLD | NEW |