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

Unified Diff: content/app/mojo/mojo_init.cc

Issue 872973003: Make InitializeMojo() idempotent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Landing Created 5 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/app/mojo/mojo_init.cc
diff --git a/content/app/mojo/mojo_init.cc b/content/app/mojo/mojo_init.cc
index f2b21fa8ff492a51a6603dd75eaf7910323000df..c70625552bb9b77124eae1fb941e2cdcfac98395 100644
--- a/content/app/mojo/mojo_init.cc
+++ b/content/app/mojo/mojo_init.cc
@@ -4,6 +4,7 @@
#include "content/app/mojo/mojo_init.h"
+#include "base/lazy_instance.h"
#include "base/memory/scoped_ptr.h"
#include "third_party/mojo/src/mojo/edk/embedder/configuration.h"
#include "third_party/mojo/src/mojo/edk/embedder/embedder.h"
@@ -11,14 +12,24 @@
namespace content {
+namespace {
+
+class MojoInitializer {
+ public:
+ MojoInitializer() {
+ mojo::embedder::GetConfiguration()->max_message_num_bytes =
+ 64 * 1024 * 1024;
+ mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>(
+ new mojo::embedder::SimplePlatformSupport()));
+ }
+};
+
+base::LazyInstance<MojoInitializer>::Leaky mojo_initializer;
+
+} // namespace
+
void InitializeMojo() {
- // Things like content_shell and DevTools ocassionally send big
- // message which includes whole rendered screen or all loaded
- // scripts. The buffer size has to be big enough to allow such use
- // cases.
- mojo::embedder::GetConfiguration()->max_message_num_bytes = 64*1024*1024;
- mojo::embedder::Init(scoped_ptr<mojo::embedder::PlatformSupport>(
- new mojo::embedder::SimplePlatformSupport()));
+ mojo_initializer.Get();
}
} // namespace content
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698