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

Unified Diff: content/common/mojo/mojo_shell_connection_impl.cc

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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/common/mojo/mojo_shell_connection_impl.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/mojo/mojo_shell_connection_impl.cc
diff --git a/content/common/mojo/mojo_shell_connection_impl.cc b/content/common/mojo/mojo_shell_connection_impl.cc
index 839e206abcf42ab7aac256c581a94c2fcdfed34d..c2c4139ccde27e686023d9057cbf8ef7523d73ec 100644
--- a/content/common/mojo/mojo_shell_connection_impl.cc
+++ b/content/common/mojo/mojo_shell_connection_impl.cc
@@ -11,6 +11,7 @@
#include "base/stl_util.h"
#include "base/threading/thread_local.h"
#include "mojo/converters/network/network_type_converters.h"
+#include "mojo/edk/embedder/embedder.h"
#include "mojo/shell/public/cpp/shell_client.h"
#include "mojo/shell/public/cpp/shell_connection.h"
#include "mojo/shell/runner/child/runner_connection.h"
@@ -47,10 +48,8 @@ void MojoShellConnectionImpl::Create(
MojoShellConnectionImpl* connection =
new MojoShellConnectionImpl(false /* external */);
lazy_tls_ptr.Pointer()->Set(connection);
-
connection->shell_connection_.reset(
new mojo::ShellConnection(connection, std::move(request)));
- connection->shell_connection_->WaitForInitialize();
}
// static
@@ -58,46 +57,29 @@ MojoShellConnectionImpl* MojoShellConnectionImpl::Get() {
return static_cast<MojoShellConnectionImpl*>(MojoShellConnection::Get());
}
-void MojoShellConnectionImpl::BindToCommandLinePlatformChannel() {
- DCHECK(IsRunningInMojoShell());
- if (initialized_)
- return;
- WaitForShell(mojo::ScopedMessagePipeHandle());
-}
+void MojoShellConnectionImpl::BindToRequestFromCommandLine() {
+ DCHECK(!shell_connection_);
-void MojoShellConnectionImpl::BindToMessagePipe(
- mojo::ScopedMessagePipeHandle handle) {
- if (initialized_)
- return;
- WaitForShell(std::move(handle));
+ shell_connection_.reset(new mojo::ShellConnection(this));
+ runner_connection_ =
+ mojo::shell::RunnerConnection::Create(shell_connection_.get(),
+ false /* exit_on_error */);
+ if (!runner_connection_) {
+ delete this;
+ lazy_tls_ptr.Pointer()->Set(nullptr);
+ }
}
MojoShellConnectionImpl::MojoShellConnectionImpl(bool external) :
- external_(external), initialized_(false) {}
+ external_(external) {}
MojoShellConnectionImpl::~MojoShellConnectionImpl() {
STLDeleteElements(&listeners_);
}
-void MojoShellConnectionImpl::WaitForShell(
- mojo::ScopedMessagePipeHandle handle) {
- mojo::shell::mojom::ShellClientRequest request;
- runner_connection_.reset(mojo::shell::RunnerConnection::ConnectToRunner(
- &request, std::move(handle), false /* exit_on_error */));
- if (!runner_connection_) {
- DLOG(ERROR) << "Unable to connect to the Mojo shell.";
- delete this;
- lazy_tls_ptr.Pointer()->Set(nullptr);
- return;
- }
- shell_connection_.reset(new mojo::ShellConnection(this, std::move(request)));
- shell_connection_->WaitForInitialize();
-}
-
void MojoShellConnectionImpl::Initialize(mojo::Connector* connector,
const mojo::Identity& identity,
uint32_t id) {
- initialized_ = true;
}
bool MojoShellConnectionImpl::AcceptConnection(mojo::Connection* connection) {
@@ -108,7 +90,7 @@ bool MojoShellConnectionImpl::AcceptConnection(mojo::Connection* connection) {
}
mojo::Connector* MojoShellConnectionImpl::GetConnector() {
- DCHECK(initialized_);
+ DCHECK(shell_connection_);
return shell_connection_->connector();
}
« no previous file with comments | « content/common/mojo/mojo_shell_connection_impl.h ('k') | content/content_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698