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

Unified Diff: content/child/child_thread_impl.cc

Issue 2138263002: Revert of Move content's shell connections to the IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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') | content/common/mojo/mojo_shell_connection_impl.h » ('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 d388d33398e4003c9680ae489e28a9d01c4d774d..3bac8ae72e2deaecb0b63934a166125cc760b8af 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -68,8 +68,6 @@
#include "mojo/edk/embedder/named_platform_channel_pair.h"
#include "mojo/edk/embedder/platform_channel_pair.h"
#include "mojo/edk/embedder/scoped_ipc_support.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"
#if defined(OS_POSIX)
@@ -333,18 +331,14 @@
ChildThreadImpl::ChildThreadImpl()
: router_(this),
- channel_connected_factory_(
- new base::WeakPtrFactory<ChildThreadImpl>(this)),
- weak_factory_(this) {
+ channel_connected_factory_(this) {
Init(Options::Builder().Build());
}
ChildThreadImpl::ChildThreadImpl(const Options& options)
: router_(this),
browser_process_io_runner_(options.browser_process_io_runner),
- channel_connected_factory_(
- new base::WeakPtrFactory<ChildThreadImpl>(this)),
- weak_factory_(this) {
+ channel_connected_factory_(this) {
Init(options);
}
@@ -419,18 +413,8 @@
mojo::edk::CreateChildMessagePipe(mojo_application_token);
DCHECK(handle.is_valid());
mojo_shell_connection_ = MojoShellConnection::Create(
- mojo::MakeRequest<shell::mojom::Service>(std::move(handle)),
- GetIOTaskRunner());
-
- // TODO(rockot): Remove this once all child-to-browser interface connections
- // are made via a Connector rather than directly through an
- // InterfaceProvider, and all exposed interfaces are exposed via a
- // ConnectionFilter.
- mojo_shell_connection_->SetupInterfaceRequestProxies(
- GetInterfaceRegistry(), GetRemoteInterfaces());
-
- AddConnectionFilters(mojo_shell_connection_.get());
- mojo_shell_connection_->Start();
+ mojo::MakeRequest<shell::mojom::Service>(std::move(handle)));
+ mojo_shell_connection_->MergeService(this);
}
sync_message_filter_ = channel_->CreateSyncMessageFilter();
@@ -515,7 +499,7 @@
message_loop_->task_runner()->PostDelayedTask(
FROM_HERE, base::Bind(&ChildThreadImpl::EnsureConnected,
- channel_connected_factory_->GetWeakPtr()),
+ channel_connected_factory_.GetWeakPtr()),
base::TimeDelta::FromSeconds(connection_timeout));
#if defined(OS_ANDROID)
@@ -533,6 +517,9 @@
}
ChildThreadImpl::~ChildThreadImpl() {
+ if (MojoShellConnection::GetForProcess())
+ MojoShellConnection::DestroyForProcess();
+
#ifdef IPC_MESSAGE_LOG_ENABLED
IPC::Logging::GetInstance()->SetIPCSender(NULL);
#endif
@@ -569,7 +556,7 @@
}
void ChildThreadImpl::OnChannelConnected(int32_t peer_pid) {
- channel_connected_factory_.reset();
+ channel_connected_factory_.InvalidateWeakPtrs();
}
void ChildThreadImpl::OnChannelError() {
@@ -619,6 +606,14 @@
if (!remote_interfaces_.get())
remote_interfaces_.reset(new shell::InterfaceProvider);
return remote_interfaces_.get();
+}
+
+shell::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistryForConnection() {
+ return GetInterfaceRegistry();
+}
+
+shell::InterfaceProvider* ChildThreadImpl::GetInterfaceProviderForConnection() {
+ return GetRemoteInterfaces();
}
IPC::MessageRouter* ChildThreadImpl::GetRouter() {
@@ -696,8 +691,6 @@
return router_.OnMessageReceived(msg);
}
-void ChildThreadImpl::AddConnectionFilters(MojoShellConnection* connection) {}
-
bool ChildThreadImpl::OnControlMessageReceived(const IPC::Message& msg) {
return false;
}
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/common/mojo/mojo_shell_connection_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698