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

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: fix mus views tests 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 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.
22 // it is established. The Application request from the runner is returned via
23 // |request|.
24 // 25 //
25 // If a connection to the runner cannot be established, |request| will not be 26 // |connection| is a ShellConnection which will be used to service incoming
26 // modified and this function will return null. 27 // connection requests from other clients. This may be null, in which case no
28 // incoming connection requests will be serviced. This is not owned and must
29 // out-live the RunnerConnection.
30 //
31 // |client_factory_request| should be a pending request from the shell; if
32 // null, the RunnerConnection will attempt to extract a request pipe from the
33 // command line.
27 // 34 //
28 // If |exit_on_error| is true, the calling process will be terminated in the 35 // If |exit_on_error| is true, the calling process will be terminated in the
29 // event of an error on |handle|. 36 // event of an error on the ShellClientFactory pipe.
30 // 37 //
31 // TODO(rockot): Remove |exit_on_error| when it's safe for all clients to be 38 // 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 39 // connection. If connection fails (which can happen if there is no
33 // child processes. 40 // provided ShellClientFactory request pipe here or on the command line) this
34 static RunnerConnection* ConnectToRunner( 41 // returns null.
35 InterfaceRequest<mojom::ShellClient>* request, 42 //
36 ScopedMessagePipeHandle handle, 43 // TODO(rockot): Remove |exit_on_error|. We shouldn't be killing processes
44 // abruptly on pipe errors, but some tests currently depend on this behavior.
45 static scoped_ptr<RunnerConnection> Create(
46 mojo::ShellConnection* shell_connection,
47 mojom::ShellClientFactoryRequest client_factory_request,
37 bool exit_on_error = true); 48 bool exit_on_error = true);
38 49
39 protected: 50 protected:
40 RunnerConnection(); 51 RunnerConnection();
41 52
42 private: 53 private:
43 DISALLOW_COPY_AND_ASSIGN(RunnerConnection); 54 DISALLOW_COPY_AND_ASSIGN(RunnerConnection);
44 }; 55 };
45 56
46 } // namespace shell 57 } // namespace shell
47 } // namespace mojo 58 } // namespace mojo
48 59
49 #endif // MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_ 60 #endif // MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698