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

Unified Diff: shell/context.cc

Issue 1686953003: Remove uses of base/lazy_instance (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 4 years, 10 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: shell/context.cc
diff --git a/shell/context.cc b/shell/context.cc
index 8569a1a98a43e558c2b1bd4bebc922f13932207e..703d428b333624f40b073872dee82ea3e78dc797 100644
--- a/shell/context.cc
+++ b/shell/context.cc
@@ -11,7 +11,6 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/files/file_util.h"
-#include "base/lazy_instance.h"
#include "base/macros.h"
#include "base/memory/scoped_ptr.h"
#include "base/memory/scoped_vector.h"
@@ -53,19 +52,6 @@ using mojo::ServiceProviderPtr;
namespace shell {
namespace {
-// Used to ensure we only init once.
-class Setup {
- public:
- Setup() {
- mojo::embedder::Init(mojo::embedder::CreateSimplePlatformSupport());
- }
-
- ~Setup() {}
-
- private:
- DISALLOW_COPY_AND_ASSIGN(Setup);
-};
-
ApplicationManager::Options MakeApplicationManagerOptions() {
ApplicationManager::Options options;
options.disable_cache = base::CommandLine::ForCurrentProcess()->HasSwitch(
@@ -253,8 +239,11 @@ Context::~Context() {
// static
void Context::EnsureEmbedderIsInitialized() {
- static base::LazyInstance<Setup>::Leaky setup = LAZY_INSTANCE_INITIALIZER;
- setup.Get();
+ static bool initialized = ([]() {
+ mojo::embedder::Init(mojo::embedder::CreateSimplePlatformSupport());
+ return true;
+ })();
+ std::ignore = initialized;
jamesr 2016/02/10 21:28:39 arguably this is too fancy, especially since it co
viettrungluu 2016/02/10 23:55:50 Should probably use MOJO_ALLOW_UNUSED_LOCAL from m
}
void Context::SetShellFileRoot(const base::FilePath& path) {
« mojo/message_pump/message_pump_mojo.cc ('K') | « mojo/message_pump/message_pump_mojo.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698