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

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

Issue 1814223002: Quit the message loop by default in ShellConnectionLost when ApplicationRunner is used (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
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
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/guid.h" 6 #include "base/guid.h"
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "mojo/public/c/system/main.h" 10 #include "mojo/public/c/system/main.h"
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 state->connection_remote_userid = connection->GetRemoteIdentity().user_id(); 72 state->connection_remote_userid = connection->GetRemoteIdentity().user_id();
73 state->connection_remote_id = remote_id; 73 state->connection_remote_id = remote_id;
74 state->initialize_local_name = identity_.name(); 74 state->initialize_local_name = identity_.name();
75 state->initialize_id = id_; 75 state->initialize_id = id_;
76 state->initialize_userid = identity_.user_id(); 76 state->initialize_userid = identity_.user_id();
77 connection->GetInterface(&caller_); 77 connection->GetInterface(&caller_);
78 caller_->ConnectionAccepted(std::move(state)); 78 caller_->ConnectionAccepted(std::move(state));
79 79
80 return true; 80 return true;
81 } 81 }
82 void ShellConnectionLost() override {
83 if (base::MessageLoop::current() &&
84 base::MessageLoop::current()->is_running()) {
85 base::MessageLoop::current()->QuitWhenIdle();
86 }
87 }
88 82
89 // InterfaceFactory<test::mojom::ConnectTestService>: 83 // InterfaceFactory<test::mojom::ConnectTestService>:
90 void Create(Connection* connection, 84 void Create(Connection* connection,
91 test::mojom::ConnectTestServiceRequest request) override { 85 test::mojom::ConnectTestServiceRequest request) override {
92 bindings_.AddBinding(this, std::move(request)); 86 bindings_.AddBinding(this, std::move(request));
93 } 87 }
94 88
95 // InterfaceFactory<test::mojom::StandaloneApp>: 89 // InterfaceFactory<test::mojom::StandaloneApp>:
96 void Create(Connection* connection, 90 void Create(Connection* connection,
97 test::mojom::StandaloneAppRequest request) override { 91 test::mojom::StandaloneAppRequest request) override {
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 217
224 } // namespace shell 218 } // namespace shell
225 } // namespace mojo 219 } // namespace mojo
226 220
227 221
228 MojoResult MojoMain(MojoHandle shell_handle) { 222 MojoResult MojoMain(MojoHandle shell_handle) {
229 MojoResult rv = mojo::ApplicationRunner( 223 MojoResult rv = mojo::ApplicationRunner(
230 new mojo::shell::ConnectTestApp).Run(shell_handle); 224 new mojo::shell::ConnectTestApp).Run(shell_handle);
231 return rv; 225 return rv;
232 } 226 }
OLDNEW
« no previous file with comments | « mojo/shell/public/cpp/shell_connection.h ('k') | mojo/shell/tests/connect/connect_test_driver.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698