| Index: content/child/child_thread_impl.cc
|
| diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc
|
| index f8b6c1e26b594d198332b07fa8c1fbdc7b9171cf..30cacc02cf4a9cb0b052ad7d3bb95389eca9ffd9 100644
|
| --- a/content/child/child_thread_impl.cc
|
| +++ b/content/child/child_thread_impl.cc
|
| @@ -68,6 +68,8 @@
|
| #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)
|
| @@ -331,14 +333,18 @@ bool ChildThreadImpl::ChildThreadMessageRouter::RouteMessage(
|
|
|
| ChildThreadImpl::ChildThreadImpl()
|
| : router_(this),
|
| - channel_connected_factory_(this) {
|
| + channel_connected_factory_(
|
| + new base::WeakPtrFactory<ChildThreadImpl>(this)),
|
| + weak_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_(this) {
|
| + channel_connected_factory_(
|
| + new base::WeakPtrFactory<ChildThreadImpl>(this)),
|
| + weak_factory_(this) {
|
| Init(options);
|
| }
|
|
|
| @@ -413,8 +419,8 @@ void ChildThreadImpl::Init(const Options& options) {
|
| mojo::edk::CreateChildMessagePipe(mojo_application_token);
|
| DCHECK(handle.is_valid());
|
| mojo_shell_connection_ = MojoShellConnection::Create(
|
| - mojo::MakeRequest<shell::mojom::ShellClient>(std::move(handle)));
|
| - mojo_shell_connection_->AddEmbeddedShellClient(this);
|
| + mojo::MakeRequest<shell::mojom::ShellClient>(std::move(handle)),
|
| + GetIOTaskRunner());
|
| }
|
|
|
| sync_message_filter_ = channel_->CreateSyncMessageFilter();
|
| @@ -499,7 +505,7 @@ void ChildThreadImpl::Init(const Options& options) {
|
|
|
| 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)
|
| @@ -556,7 +562,7 @@ void ChildThreadImpl::ShutdownDiscardableSharedMemoryManager() {
|
| }
|
|
|
| void ChildThreadImpl::OnChannelConnected(int32_t peer_pid) {
|
| - channel_connected_factory_.InvalidateWeakPtrs();
|
| + channel_connected_factory_.reset();
|
| }
|
|
|
| void ChildThreadImpl::OnChannelError() {
|
| @@ -608,14 +614,6 @@ shell::InterfaceProvider* ChildThreadImpl::GetRemoteInterfaces() {
|
| return remote_interfaces_.get();
|
| }
|
|
|
| -shell::InterfaceRegistry* ChildThreadImpl::GetInterfaceRegistryForConnection() {
|
| - return GetInterfaceRegistry();
|
| -}
|
| -
|
| -shell::InterfaceProvider* ChildThreadImpl::GetInterfaceProviderForConnection() {
|
| - return GetRemoteInterfaces();
|
| -}
|
| -
|
| IPC::MessageRouter* ChildThreadImpl::GetRouter() {
|
| DCHECK(base::MessageLoop::current() == message_loop());
|
| return &router_;
|
|
|