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

Side by Side Diff: mojo/shell/runner/child/runner_connection.h

Issue 1793793002: Remove ShellConnection::WaitForInitialize (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
« no previous file with comments | « mojo/shell/runner/child/BUILD.gn ('k') | mojo/shell/runner/child/runner_connection.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #ifndef MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_ 5 #ifndef MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_
6 #define MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_ 6 #define MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_
7 7
8 #include "base/callback.h"
8 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "mojo/shell/public/cpp/shell_connection.h"
12 #include "mojo/shell/public/interfaces/connector.mojom.h"
9 #include "mojo/shell/public/interfaces/shell_client.mojom.h" 13 #include "mojo/shell/public/interfaces/shell_client.mojom.h"
14 #include "mojo/shell/public/interfaces/shell_client_factory.mojom.h"
10 15
11 namespace mojo { 16 namespace mojo {
12 namespace shell { 17 namespace shell {
13 18
14 // Encapsulates a connection to a runner process. The connection object starts a 19 // Encapsulates a connection to a runner process.
15 // background controller thread that is used to receive control messages from
16 // the runner. When this object is destroyed the thread is joined.
17 class RunnerConnection { 20 class RunnerConnection {
18 public: 21 public:
19 virtual ~RunnerConnection(); 22 virtual ~RunnerConnection();
20 23
21 // Establish a connection to the runner, blocking the calling thread until 24 // Establishes a new runner connection using a ShellClientFactory request pipe
22 // it is established. The Application request from the runner is returned via 25 // from the command line.
23 // |request|.
24 // 26 //
25 // If a connection to the runner cannot be established, |request| will not be 27 // |shell_connection| is a ShellConnection which will be used to service
26 // modified and this function will return null. 28 // incoming connection requests from other clients. This may be null, in which
29 // case no incoming connection requests will be serviced. This is not owned
30 // and must out-live the RunnerConnection.
27 // 31 //
28 // If |exit_on_error| is true, the calling process will be terminated in the 32 // If |exit_on_error| is true, the calling process will be terminated in the
29 // event of an error on |handle|. 33 // event of an error on the ShellClientFactory pipe.
30 // 34 //
31 // TODO(rockot): Remove |exit_on_error| when it's safe for all clients to be 35 // The RunnerConnection returned by this call bounds the lifetime of the
32 // terminated on such errors. For now we don't want this killing content's 36 // connection. If connection fails (which can happen if there is no
33 // child processes. 37 // ShellClientFactory request pipe on the command line) this returns null.
34 static RunnerConnection* ConnectToRunner( 38 //
35 InterfaceRequest<mojom::ShellClient>* request, 39 // TODO(rockot): Remove |exit_on_error|. We shouldn't be killing processes
36 ScopedMessagePipeHandle handle, 40 // abruptly on pipe errors, but some tests currently depend on this behavior.
41 static scoped_ptr<RunnerConnection> Create(
42 mojo::ShellConnection* shell_connection,
37 bool exit_on_error = true); 43 bool exit_on_error = true);
38 44
39 protected: 45 protected:
40 RunnerConnection(); 46 RunnerConnection();
41 47
42 private: 48 private:
43 DISALLOW_COPY_AND_ASSIGN(RunnerConnection); 49 DISALLOW_COPY_AND_ASSIGN(RunnerConnection);
44 }; 50 };
45 51
46 } // namespace shell 52 } // namespace shell
47 } // namespace mojo 53 } // namespace mojo
48 54
49 #endif // MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_ 55 #endif // MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_
OLDNEW
« no previous file with comments | « mojo/shell/runner/child/BUILD.gn ('k') | mojo/shell/runner/child/runner_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698