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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 2111353002: Move content's shell connections to the IO thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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
Index: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 29fe5b2a57909538c6b9b133daa389a830675696..49a1881cd35be094c8aa4c5cb6cb7155150bd976 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -169,6 +169,8 @@
#include "mojo/edk/embedder/embedder.h"
#include "net/url_request/url_request_context_getter.h"
#include "ppapi/shared_impl/ppapi_switches.h"
+#include "services/shell/public/cpp/interface_provider.h"
+#include "services/shell/public/cpp/interface_registry.h"
#include "services/shell/runner/common/switches.h"
#include "storage/browser/fileapi/sandbox_file_system_backend.h"
#include "third_party/skia/include/core/SkBitmap.h"
@@ -603,6 +605,8 @@ RenderProcessHostImpl::RenderProcessHostImpl(
#endif // defined(OS_MACOSX)
#endif // USE_ATTACHMENT_BROKER
+ scoped_refptr<base::SequencedTaskRunner> io_task_runner =
+ BrowserThread::GetTaskRunnerForThread(BrowserThread::IO);
shell::Connector* connector =
BrowserContext::GetShellConnectorFor(browser_context_);
// Some embedders may not initialize Mojo or the shell connector for a browser
@@ -615,15 +619,14 @@ RenderProcessHostImpl::RenderProcessHostImpl(
if (!MojoShellConnection::GetForProcess()) {
shell::mojom::ServiceRequest request = mojo::GetProxy(&test_service_);
MojoShellConnection::SetForProcess(MojoShellConnection::Create(
- std::move(request)));
+ std::move(request), io_task_runner));
}
connector = MojoShellConnection::GetForProcess()->GetConnector();
}
mojo_child_connection_.reset(new MojoChildConnection(
kRendererMojoApplicationName,
- base::StringPrintf("%d_%d", id_, instance_id_++),
- child_token_,
- connector));
+ base::StringPrintf("%d_%d", id_, instance_id_++), child_token_, connector,
+ io_task_runner));
}
// static
@@ -763,8 +766,7 @@ bool RenderProcessHostImpl::Init() {
in_process_renderer_.reset(
g_renderer_main_thread_factory(InProcessChildThreadParams(
channel_id,
- BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO)
- ->task_runner(),
+ BrowserThread::GetTaskRunnerForThread(BrowserThread::IO),
mojo_channel_token_,
mojo_child_connection_->service_token())));
@@ -1130,16 +1132,11 @@ void RenderProcessHostImpl::NotifyTimezoneChange(const std::string& zone_id) {
}
shell::InterfaceRegistry* RenderProcessHostImpl::GetInterfaceRegistry() {
- return GetChildConnection()->GetInterfaceRegistry();
+ return mojo_child_connection_->GetInterfaceRegistry();
}
shell::InterfaceProvider* RenderProcessHostImpl::GetRemoteInterfaces() {
- return GetChildConnection()->GetRemoteInterfaces();
-}
-
-shell::Connection* RenderProcessHostImpl::GetChildConnection() {
- DCHECK(mojo_child_connection_);
- return mojo_child_connection_->connection();
+ return mojo_child_connection_->GetRemoteInterfaces();
}
std::unique_ptr<base::SharedPersistentMemoryAllocator>
@@ -2456,9 +2453,8 @@ void RenderProcessHostImpl::ProcessDied(bool already_dead,
connector = MojoShellConnection::GetForProcess()->GetConnector();
mojo_child_connection_.reset(new MojoChildConnection(
kRendererMojoApplicationName,
- base::StringPrintf("%d_%d", id_, instance_id_++),
- child_token_,
- connector));
+ base::StringPrintf("%d_%d", id_, instance_id_++), child_token_, connector,
+ BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)));
within_process_died_observer_ = true;
NotificationService::current()->Notify(
« no previous file with comments | « content/browser/renderer_host/render_process_host_impl.h ('k') | content/browser/renderer_host/render_widget_host_view_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698