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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: mojo/shell/runner/child/runner_connection.h
diff --git a/mojo/shell/runner/child/runner_connection.h b/mojo/shell/runner/child/runner_connection.h
index e49f73e60e8d4d07041f2970c40f87fffe9703b7..26fb3b08767481f5f6d3eff4190703f05061cae5 100644
--- a/mojo/shell/runner/child/runner_connection.h
+++ b/mojo/shell/runner/child/runner_connection.h
@@ -5,35 +5,46 @@
#ifndef MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_
#define MOJO_SHELL_RUNNER_CHILD_RUNNER_CONNECTION_H_
+#include "base/callback.h"
#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "mojo/shell/public/cpp/shell_connection.h"
+#include "mojo/shell/public/interfaces/connector.mojom.h"
#include "mojo/shell/public/interfaces/shell_client.mojom.h"
+#include "mojo/shell/public/interfaces/shell_client_factory.mojom.h"
namespace mojo {
namespace shell {
-// Encapsulates a connection to a runner process. The connection object starts a
-// background controller thread that is used to receive control messages from
-// the runner. When this object is destroyed the thread is joined.
+// Encapsulates a connection to a runner process.
class RunnerConnection {
public:
virtual ~RunnerConnection();
- // Establish a connection to the runner, blocking the calling thread until
- // it is established. The Application request from the runner is returned via
- // |request|.
+ // Establishes a new runner connection.
//
- // If a connection to the runner cannot be established, |request| will not be
- // modified and this function will return null.
+ // |connection| is a ShellConnection which will be used to service incoming
+ // connection requests from other clients. This may be null, in which case no
+ // incoming connection requests will be serviced. This is not owned and must
+ // out-live the RunnerConnection.
+ //
+ // |client_factory_request| should be a pending request from the shell; if
+ // null, the RunnerConnection will attempt to extract a request pipe from the
+ // command line.
//
// If |exit_on_error| is true, the calling process will be terminated in the
- // event of an error on |handle|.
+ // event of an error on the ShellClientFactory pipe.
+ //
+ // The RunnerConnection returned by this call bounds the lifetime of the
+ // connection. If connection fails (which can happen if there is no
+ // provided ShellClientFactory request pipe here or on the command line) this
+ // returns null.
//
- // TODO(rockot): Remove |exit_on_error| when it's safe for all clients to be
- // terminated on such errors. For now we don't want this killing content's
- // child processes.
- static RunnerConnection* ConnectToRunner(
- InterfaceRequest<mojom::ShellClient>* request,
- ScopedMessagePipeHandle handle,
+ // TODO(rockot): Remove |exit_on_error|. We shouldn't be killing processes
+ // abruptly on pipe errors, but some tests currently depend on this behavior.
+ static scoped_ptr<RunnerConnection> Create(
+ mojo::ShellConnection* shell_connection,
+ mojom::ShellClientFactoryRequest client_factory_request,
bool exit_on_error = true);
protected:

Powered by Google App Engine
This is Rietveld 408576698