summaryrefslogtreecommitdiffstats
path: root/content/child/mojo
diff options
context:
space:
mode:
authormorrita <morrita@chromium.org>2015-03-17 18:48:29 -0700
committerCommit bot <commit-bot@chromium.org>2015-03-18 01:49:26 +0000
commitc6238ab6b40c8f0a291f75dbceb58535cf942eac (patch)
tree00442ea1dff2879348e36399816483f374015f7c /content/child/mojo
parentc61ff5194d2d46e2302e25f2c864115cc28ac13e (diff)
downloadchromium_src-c6238ab6b40c8f0a291f75dbceb58535cf942eac.zip
chromium_src-c6238ab6b40c8f0a291f75dbceb58535cf942eac.tar.gz
chromium_src-c6238ab6b40c8f0a291f75dbceb58535cf942eac.tar.bz2
Get rid of ChannelInit::SetSingleProcessIOTaskRunner()
The globally-set TaskRunner doesn't work because some child thread can run inside the browser process even when other child threads run in their own processes. For example, there is a configuration where GpuChildThread being in-process while RenderThreadImpl isn't. It is troublesome once non-renderer child processes adopt ChannelMojo. This CL eliminates the global in-process IO task runner and instead, passes an IO runnner for each thread if it is configured as an in-process mode. Note that InProcessChildThreadParams object is introuced to clarify that the parameter is for in-process mode. This is a spin-off from https://codereview.chromium.org/960693003/. R=jamesr@chromium.org, rockot@chromium.org, jam@chromium.org BUG=377980 Review URL: https://codereview.chromium.org/987693005 Cr-Commit-Position: refs/heads/master@{#321047}
Diffstat (limited to 'content/child/mojo')
-rw-r--r--content/child/mojo/mojo_application.cc13
-rw-r--r--content/child/mojo/mojo_application.h9
2 files changed, 13 insertions, 9 deletions
diff --git a/content/child/mojo/mojo_application.cc b/content/child/mojo/mojo_application.cc
index f896dc6..5deee5d 100644
--- a/content/child/mojo/mojo_application.cc
+++ b/content/child/mojo/mojo_application.cc
@@ -13,7 +13,10 @@
namespace content {
-MojoApplication::MojoApplication() {
+MojoApplication::MojoApplication(
+ scoped_refptr<base::SequencedTaskRunner> io_task_runner)
+ : io_task_runner_(io_task_runner) {
+ DCHECK(io_task_runner_);
}
MojoApplication::~MojoApplication() {
@@ -35,15 +38,9 @@ void MojoApplication::OnActivate(
#elif defined(OS_WIN)
base::PlatformFile handle = file;
#endif
- scoped_refptr<base::TaskRunner> io_task_runner =
- ChannelInit::GetSingleProcessIOTaskRunner();
- if (!io_task_runner) {
- io_task_runner = ChildProcess::current()->io_message_loop_proxy();
- }
- DCHECK(io_task_runner);
mojo::ScopedMessagePipeHandle message_pipe =
- channel_init_.Init(handle, io_task_runner);
+ channel_init_.Init(handle, io_task_runner_);
DCHECK(message_pipe.is_valid());
ApplicationSetupPtr application_setup;
diff --git a/content/child/mojo/mojo_application.h b/content/child/mojo/mojo_application.h
index 5b89ddb..5c207f2 100644
--- a/content/child/mojo/mojo_application.h
+++ b/content/child/mojo/mojo_application.h
@@ -9,6 +9,10 @@
#include "content/common/mojo/service_registry_impl.h"
#include "ipc/ipc_platform_file.h"
+namespace base {
+class SequencedTaskRunner;
+}
+
namespace IPC {
class Message;
}
@@ -21,7 +25,8 @@ namespace content {
// It makes the ServiceRegistry interface available.
class MojoApplication {
public:
- MojoApplication();
+ explicit MojoApplication(
+ scoped_refptr<base::SequencedTaskRunner> io_task_runner);
virtual ~MojoApplication();
bool OnMessageReceived(const IPC::Message& msg);
@@ -31,6 +36,8 @@ class MojoApplication {
private:
void OnActivate(const IPC::PlatformFileForTransit& file);
+ scoped_refptr<base::SequencedTaskRunner> io_task_runner_;
+
ChannelInit channel_init_;
ServiceRegistryImpl service_registry_;