OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #include <stddef.h> | 5 #include <stddef.h> |
6 #include <stdint.h> | 6 #include <stdint.h> |
7 | 7 |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 identity_ = identity; | 177 identity_ = identity; |
178 bindings_.set_connection_error_handler( | 178 bindings_.set_connection_error_handler( |
179 base::Bind(&ConnectTestShellClient::OnConnectionError, | 179 base::Bind(&ConnectTestShellClient::OnConnectionError, |
180 base::Unretained(this))); | 180 base::Unretained(this))); |
181 } | 181 } |
182 bool AcceptConnection(Connection* connection) override { | 182 bool AcceptConnection(Connection* connection) override { |
183 connection->AddInterface<ShellClientFactory>(this); | 183 connection->AddInterface<ShellClientFactory>(this); |
184 connection->AddInterface<test::mojom::ConnectTestService>(this); | 184 connection->AddInterface<test::mojom::ConnectTestService>(this); |
185 return true; | 185 return true; |
186 } | 186 } |
| 187 void ShellConnectionLost() override { |
| 188 if (base::MessageLoop::current() && |
| 189 base::MessageLoop::current()->is_running()) { |
| 190 base::MessageLoop::current()->QuitWhenIdle(); |
| 191 } |
| 192 } |
187 | 193 |
188 // InterfaceFactory<mojom::ShellClientFactory>: | 194 // InterfaceFactory<mojom::ShellClientFactory>: |
189 void Create(Connection* connection, | 195 void Create(Connection* connection, |
190 mojom::ShellClientFactoryRequest request) override { | 196 mojom::ShellClientFactoryRequest request) override { |
191 shell_client_factory_bindings_.AddBinding(this, std::move(request)); | 197 shell_client_factory_bindings_.AddBinding(this, std::move(request)); |
192 } | 198 } |
193 | 199 |
194 // InterfaceFactory<test::mojom::ConnectTestService>: | 200 // InterfaceFactory<test::mojom::ConnectTestService>: |
195 void Create(Connection* connection, | 201 void Create(Connection* connection, |
196 test::mojom::ConnectTestServiceRequest request) override { | 202 test::mojom::ConnectTestServiceRequest request) override { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 235 |
230 } // namespace shell | 236 } // namespace shell |
231 } // namespace mojo | 237 } // namespace mojo |
232 | 238 |
233 | 239 |
234 MojoResult MojoMain(MojoHandle shell_handle) { | 240 MojoResult MojoMain(MojoHandle shell_handle) { |
235 MojoResult rv = mojo::ApplicationRunner( | 241 MojoResult rv = mojo::ApplicationRunner( |
236 new mojo::shell::ConnectTestShellClient).Run(shell_handle); | 242 new mojo::shell::ConnectTestShellClient).Run(shell_handle); |
237 return rv; | 243 return rv; |
238 } | 244 } |
OLD | NEW |