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

Unified Diff: content/common/mojo/mojo_channel_init.cc

Issue 208223006: Revert of Add creation of ServiceManager to Content (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/app/mojo/mojo_init.cc ('k') | content/content_app.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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)),
« no previous file with comments | « content/app/mojo/mojo_init.cc ('k') | content/content_app.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698