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

Side by Side Diff: mojo/shell/tests/connect/connect_test_package.cc

Issue 1761113002: Monitor the ShellClient binding for pipe closure as a signal to shut down the ShellConnection, rath… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@28lifecycle2
Patch Set: Created 4 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 | « mojo/shell/tests/connect/connect_test_app.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 uint32_t id, uint32_t user_id) override { 141 uint32_t id, uint32_t user_id) override {
142 bindings_.set_connection_error_handler( 142 bindings_.set_connection_error_handler(
143 base::Bind(&ConnectTestShellClient::OnConnectionError, 143 base::Bind(&ConnectTestShellClient::OnConnectionError,
144 base::Unretained(this))); 144 base::Unretained(this)));
145 } 145 }
146 bool AcceptConnection(Connection* connection) override { 146 bool AcceptConnection(Connection* connection) override {
147 connection->AddInterface<ShellClientFactory>(this); 147 connection->AddInterface<ShellClientFactory>(this);
148 connection->AddInterface<test::mojom::ConnectTestService>(this); 148 connection->AddInterface<test::mojom::ConnectTestService>(this);
149 return true; 149 return true;
150 } 150 }
151 bool ShellConnectionLost() override { 151 void ShellConnectionLost() override {
152 if (base::MessageLoop::current() && 152 if (base::MessageLoop::current() &&
153 base::MessageLoop::current()->is_running()) { 153 base::MessageLoop::current()->is_running()) {
154 base::MessageLoop::current()->QuitWhenIdle(); 154 base::MessageLoop::current()->QuitWhenIdle();
155 } 155 }
156 return true;
157 } 156 }
158 157
159 // InterfaceFactory<mojom::ShellClientFactory>: 158 // InterfaceFactory<mojom::ShellClientFactory>:
160 void Create(Connection* connection, 159 void Create(Connection* connection,
161 mojom::ShellClientFactoryRequest request) override { 160 mojom::ShellClientFactoryRequest request) override {
162 shell_client_factory_bindings_.AddBinding(this, std::move(request)); 161 shell_client_factory_bindings_.AddBinding(this, std::move(request));
163 } 162 }
164 163
165 // InterfaceFactory<test::mojom::ConnectTestService>: 164 // InterfaceFactory<test::mojom::ConnectTestService>:
166 void Create(Connection* connection, 165 void Create(Connection* connection,
(...skipping 29 matching lines...) Expand all
196 195
197 } // namespace shell 196 } // namespace shell
198 } // namespace mojo 197 } // namespace mojo
199 198
200 199
201 MojoResult MojoMain(MojoHandle shell_handle) { 200 MojoResult MojoMain(MojoHandle shell_handle) {
202 MojoResult rv = mojo::ApplicationRunner( 201 MojoResult rv = mojo::ApplicationRunner(
203 new mojo::shell::ConnectTestShellClient).Run(shell_handle); 202 new mojo::shell::ConnectTestShellClient).Run(shell_handle);
204 return rv; 203 return rv;
205 } 204 }
OLDNEW
« no previous file with comments | « mojo/shell/tests/connect/connect_test_app.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698