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

Unified Diff: content/child/child_thread_impl.cc

Issue 2222373002: Revert of Eliminate kMojoChannelToken usage for render processes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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/child/child_thread_impl.h ('k') | ipc/ipc.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/child_thread_impl.cc
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
index e3cd874acdcc8b0032523550c2887373210cb4a1..6f7360358daae3d50a0eaaa168e18618227b1be3 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -52,7 +52,6 @@
#include "content/common/child_process_messages.h"
#include "content/common/in_process_child_thread_params.h"
#include "content/common/mojo/constants.h"
-#include "content/public/common/connection_filter.h"
#include "content/public/common/content_switches.h"
#include "content/public/common/mojo_channel_switches.h"
#include "content/public/common/mojo_shell_connection.h"
@@ -69,7 +68,6 @@
#include "mojo/edk/embedder/platform_channel_pair.h"
#include "mojo/edk/embedder/scoped_ipc_support.h"
#include "services/shell/public/cpp/connector.h"
-#include "services/shell/public/cpp/interface_factory.h"
#include "services/shell/public/cpp/interface_provider.h"
#include "services/shell/public/cpp/interface_registry.h"
#include "services/shell/runner/common/client_util.h"
@@ -257,36 +255,6 @@
mojo::edk::SetParentPipeHandle(std::move(platform_channel));
}
-class ChannelBootstrapFilter
- : public ConnectionFilter,
- public shell::InterfaceFactory<IPC::mojom::ChannelBootstrap> {
- public:
- explicit ChannelBootstrapFilter(IPC::mojom::ChannelBootstrapPtrInfo bootstrap)
- : bootstrap_(std::move(bootstrap)) {}
-
- private:
- // ConnectionFilter:
- bool OnConnect(shell::Connection* connection,
- shell::Connector* connector) override {
- if (connection->GetRemoteIdentity().name() != kBrowserMojoApplicationName)
- return false;
-
- connection->AddInterface<IPC::mojom::ChannelBootstrap>(this);
- return true;
- }
-
- // shell::InterfaceFactory<IPC::mojom::ChannelBootstrap>:
- void Create(const shell::Identity& remote_identity,
- IPC::mojom::ChannelBootstrapRequest request) override {
- DCHECK(bootstrap_.is_valid());
- mojo::FuseInterface(std::move(request), std::move(bootstrap_));
- }
-
- IPC::mojom::ChannelBootstrapPtrInfo bootstrap_;
-
- DISALLOW_COPY_AND_ASSIGN(ChannelBootstrapFilter);
-};
-
} // namespace
ChildThread* ChildThread::Get() {
@@ -407,29 +375,15 @@
bool create_pipe_now = true;
if (use_mojo_channel) {
VLOG(1) << "Mojo is enabled on child";
- std::string channel_token;
mojo::ScopedMessagePipeHandle handle;
if (!IsInBrowserProcess()) {
- channel_token =
+ DCHECK(!handle.is_valid());
+ handle = mojo::edk::CreateChildMessagePipe(
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
- switches::kMojoChannelToken);
+ switches::kMojoChannelToken));
} else {
- channel_token = ipc_token;
+ handle = mojo::edk::CreateChildMessagePipe(ipc_token);
}
-
- if (!channel_token.empty()) {
- // TODO(rockot): Remove all paths which lead to this branch. The Channel
- // connection should always be established by a shell connection from the
- // browser. http://crbug.com/623396.
- handle = mojo::edk::CreateChildMessagePipe(channel_token);
- } else {
- DCHECK(mojo_shell_connection_);
- IPC::mojom::ChannelBootstrapPtr bootstrap;
- handle = mojo::GetProxy(&bootstrap).PassMessagePipe();
- mojo_shell_connection_->AddConnectionFilter(
- base::MakeUnique<ChannelBootstrapFilter>(bootstrap.PassInterface()));
- }
-
DCHECK(handle.is_valid());
channel_->Init(
IPC::ChannelMojo::CreateClientFactory(
@@ -503,6 +457,9 @@
// ConnectionFilter.
mojo_shell_connection_->SetupInterfaceRequestProxies(
GetInterfaceRegistry(), remote_interfaces);
+
+ if (options.auto_start_mojo_shell_connection)
+ StartMojoShellConnection();
}
sync_message_filter_ = channel_->CreateSyncMessageFilter();
@@ -568,13 +525,7 @@
IPC::AttachmentBroker* broker = IPC::AttachmentBroker::GetGlobal();
if (broker && !broker->IsPrivilegedBroker())
broker->RegisterBrokerCommunicationChannel(channel_.get());
-
ConnectChannel(options.use_mojo_channel, options.in_process_ipc_token);
-
- // This must always be done after ConnectChannel, because ConnectChannel() may
- // add a ConnectionFilter to the connection.
- if (options.auto_start_mojo_shell_connection && mojo_shell_connection_)
- StartMojoShellConnection();
int connection_timeout = kConnectionTimeoutS;
std::string connection_override =
« no previous file with comments | « content/child/child_thread_impl.h ('k') | ipc/ipc.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698