Index: third_party/mojo/src/mojo/public/go/application/application_impl.go |
diff --git a/third_party/mojo/src/mojo/public/go/application/application_impl.go b/third_party/mojo/src/mojo/public/go/application/application_impl.go |
index 43a1eb83eff8a48ba3d5f030b8a718a4c7a8f733..ac6fc75e39cc18b741a34be123225d11d24aeb50 100644 |
--- a/third_party/mojo/src/mojo/public/go/application/application_impl.go |
+++ b/third_party/mojo/src/mojo/public/go/application/application_impl.go |
@@ -47,6 +47,9 @@ type Context interface { |
// should pass a list of services you want to provide to the requested |
// application. |
ConnectToApplication(remoteURL string, providedServices ...ServiceFactory) *OutgoingConnection |
+ |
+ // Close closes the main run loop for this application. |
+ Close() |
} |
// ApplicationImpl is an utility class for communicating with the Shell, and |
@@ -78,8 +81,10 @@ func Run(delegate Delegate, applicationRequest system.MojoHandle) { |
impl.runner = stub |
for { |
if err := stub.ServeRequest(); err != nil { |
- // TODO(rogulenko): don't log in case message pipe was closed |
- log.Println(err) |
+ connectionError, ok := err.(*bindings.ConnectionError) |
+ if !ok || !connectionError.Closed() { |
+ log.Println(err) |
+ } |
impl.RequestQuit() |
break |
} |
@@ -145,6 +150,10 @@ func (impl *ApplicationImpl) ConnectToApplication(remoteURL string, providedServ |
return connection.ProvideServices(providedServices...) |
} |
+func (impl *ApplicationImpl) Close() { |
+ impl.RequestQuit() |
+} |
+ |
// addConnection appends connections slice by a provided connection, removing |
// connections that have been closed. |
func (impl *ApplicationImpl) addConnection(c *Connection) { |