| Index: content/common/mojo/mojo_channel_init.cc
|
| diff --git a/content/common/mojo/mojo_channel_init.cc b/content/common/mojo/mojo_channel_init.cc
|
| index 16661ab1121f874d2d3d2d36ee66c2aa3cbfe6cc..088a8e9508e8789f64dd47c6d8246a60421374d6 100644
|
| --- a/content/common/mojo/mojo_channel_init.cc
|
| +++ b/content/common/mojo/mojo_channel_init.cc
|
| @@ -5,10 +5,32 @@
|
| #include "content/common/mojo/mojo_channel_init.h"
|
|
|
| #include "base/bind.h"
|
| +#include "base/lazy_instance.h"
|
| #include "base/message_loop/message_loop.h"
|
| +#include "base/synchronization/lock.h"
|
| #include "mojo/embedder/embedder.h"
|
|
|
| namespace content {
|
| +
|
| +namespace {
|
| +
|
| +struct Initializer {
|
| + Initializer() {
|
| + mojo::embedder::Init();
|
| + }
|
| +};
|
| +
|
| +static base::LazyInstance<Initializer>::Leaky initializer =
|
| + LAZY_INSTANCE_INITIALIZER;
|
| +
|
| +// Initializes mojo. Use a lazy instance to ensure we only do this once.
|
| +// TODO(sky): this likely wants to move to a more central location, such as
|
| +// startup.
|
| +void InitMojo() {
|
| + initializer.Get();
|
| +}
|
| +
|
| +} // namespace
|
|
|
| MojoChannelInit::MojoChannelInit()
|
| : channel_info_(NULL),
|
| @@ -29,6 +51,7 @@
|
| scoped_refptr<base::TaskRunner> io_thread_task_runner) {
|
| DCHECK(!io_thread_task_runner_.get()); // Should only init once.
|
| io_thread_task_runner_ = io_thread_task_runner;
|
| + InitMojo();
|
| bootstrap_message_pipe_ = mojo::embedder::CreateChannel(
|
| mojo::embedder::ScopedPlatformHandle(
|
| mojo::embedder::PlatformHandle(file)),
|
|
|