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

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

Issue 1797153002: Reinstate wait-for-Initialize when Chrome is run in Mash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shell-client
Patch Set: fix views_mus_unittests too 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/public/common/content_switches.h » ('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 5d38de8a9a9fcf319e7679c7d3424b5c18ab3012..8321673424b1d9ad1ce500d10701741d17b220bf 100644
--- a/content/common/mojo/mojo_shell_connection_impl.cc
+++ b/content/common/mojo/mojo_shell_connection_impl.cc
@@ -8,10 +8,13 @@
#include "base/command_line.h"
#include "base/lazy_instance.h"
+#include "base/run_loop.h"
#include "base/stl_util.h"
#include "base/threading/thread_local.h"
+#include "content/public/common/content_switches.h"
#include "mojo/converters/network/network_type_converters.h"
#include "mojo/edk/embedder/embedder.h"
+#include "mojo/edk/embedder/platform_channel_pair.h"
#include "mojo/shell/public/cpp/shell_client.h"
#include "mojo/shell/public/cpp/shell_connection.h"
#include "mojo/shell/runner/common/client_util.h"
@@ -30,7 +33,13 @@ base::LazyInstance<MojoShellConnectionPtr>::Leaky lazy_tls_ptr =
bool IsRunningInMojoShell() {
return base::CommandLine::ForCurrentProcess()->HasSwitch(
- "mojo-platform-channel-handle");
+ mojo::edk::PlatformChannelPair::kMojoPlatformChannelHandleSwitch);
+}
+
+bool ShouldWaitForShell() {
+ return IsRunningInMojoShell() &&
+ base::CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kWaitForMojoShell);
}
// static
@@ -61,6 +70,13 @@ void MojoShellConnectionImpl::BindToRequestFromCommandLine() {
DCHECK(!shell_connection_);
shell_connection_.reset(new mojo::ShellConnection(
this, mojo::shell::GetShellClientRequestFromCommandLine()));
+
+ // TODO(rockot): Remove this. http://crbug.com/594852.
+ if (ShouldWaitForShell()) {
+ base::RunLoop wait_loop;
+ shell_connection_->set_initialize_handler(wait_loop.QuitClosure());
+ wait_loop.Run();
+ }
}
MojoShellConnectionImpl::MojoShellConnectionImpl(bool external) :
@@ -82,6 +98,10 @@ bool MojoShellConnectionImpl::AcceptConnection(mojo::Connection* connection) {
return found;
}
+void MojoShellConnectionImpl::ShellConnectionLost() {
+ LOG(ERROR) << "Shell connection lost.";
+}
+
mojo::Connector* MojoShellConnectionImpl::GetConnector() {
DCHECK(shell_connection_);
return shell_connection_->connector();
« no previous file with comments | « content/common/mojo/mojo_shell_connection_impl.h ('k') | content/public/common/content_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698