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

Unified Diff: ui/aura/env.cc

Issue 23882007: Explicit initialization of aura::Env for browser shell. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased no-op Created 7 years, 2 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 | « ui/aura/env.h ('k') | ui/aura/test/aura_test_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/env.cc
diff --git a/ui/aura/env.cc b/ui/aura/env.cc
index a4cf8151e240c6958dee287b8394540b1e874299..1f90a29dd564f5cfdd34f0ade35ac27c387d6d2c 100644
--- a/ui/aura/env.cc
+++ b/ui/aura/env.cc
@@ -39,12 +39,18 @@ Env::~Env() {
ui::Compositor::Terminate();
}
-// static
-Env* Env::GetInstance() {
+//static
+void Env::CreateInstance() {
if (!instance_) {
instance_ = new Env;
instance_->Init();
}
+}
+
+// static
+Env* Env::GetInstance() {
+ DCHECK(instance_) << "Env::CreateInstance must be called before getting "
+ "the instance of Env.";
return instance_;
}
@@ -62,6 +68,8 @@ void Env::RemoveObserver(EnvObserver* observer) {
observers_.RemoveObserver(observer);
}
+#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && \
+ !defined(USE_GTK_MESSAGE_PUMP)
base::MessageLoop::Dispatcher* Env::GetDispatcher() {
#if defined(USE_X11)
return base::MessagePumpX11::Current();
@@ -69,6 +77,7 @@ base::MessageLoop::Dispatcher* Env::GetDispatcher() {
return dispatcher_.get();
#endif
}
+#endif
void Env::RootWindowActivated(RootWindow* root_window) {
FOR_EACH_OBSERVER(EnvObserver, observers_,
@@ -79,7 +88,8 @@ void Env::RootWindowActivated(RootWindow* root_window) {
// Env, private:
void Env::Init() {
-#if !defined(USE_X11) && !defined(USE_OZONE)
+#if !defined(OS_MACOSX) && !defined(OS_ANDROID) && !defined(USE_X11) && \
+ !defined(USE_OZONE)
dispatcher_.reset(CreateDispatcher());
#endif
#if defined(USE_X11)
« no previous file with comments | « ui/aura/env.h ('k') | ui/aura/test/aura_test_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698