| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_ | |
| 6 #define MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_ | |
| 7 | |
| 8 #include "base/callback.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" | |
| 13 #include "mojo/shell/public/interfaces/shell_client.mojom.h" | |
| 14 #include "mojo/shell/public/interfaces/shell_client_factory.mojom.h" | |
| 15 | |
| 16 namespace mojo { | |
| 17 namespace shell { | |
| 18 | |
| 19 // Encapsulates a connection to a runner process. | |
| 20 class RunnerConnection { | |
| 21 public: | |
| 22 virtual ~RunnerConnection(); | |
| 23 | |
| 24 // Establishes a new runner connection using a ShellClientFactory request pipe | |
| 25 // from the command line. | |
| 26 // | |
| 27 // |shell_connection| is a ShellConnection which will be used to service | |
| 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. | |
| 31 // | |
| 32 // If |exit_on_error| is true, the calling process will be terminated in the | |
| 33 // event of an error on the ShellClientFactory pipe. | |
| 34 // | |
| 35 // The RunnerConnection returned by this call bounds the lifetime of the | |
| 36 // connection. If connection fails (which can happen if there is no | |
| 37 // ShellClientFactory request pipe on the command line) this returns null. | |
| 38 // | |
| 39 // TODO(rockot): Remove |exit_on_error|. We shouldn't be killing processes | |
| 40 // abruptly on pipe errors, but some tests currently depend on this behavior. | |
| 41 static scoped_ptr<RunnerConnection> Create( | |
| 42 mojo::ShellConnection* shell_connection, | |
| 43 bool exit_on_error = true); | |
| 44 | |
| 45 protected: | |
| 46 RunnerConnection(); | |
| 47 | |
| 48 private: | |
| 49 DISALLOW_COPY_AND_ASSIGN(RunnerConnection); | |
| 50 }; | |
| 51 | |
| 52 } // namespace shell | |
| 53 } // namespace mojo | |
| 54 | |
| 55 #endif // MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_ | |
| OLD | NEW |