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

Unified Diff: ui/views/widget/desktop_aura/desktop_factory_ozone.cc

Issue 2024953007: Make DesktopFactoryOzone instances to respect --ozone-platform (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make DesktopFactoryOzone instances to respect --ozone-platform Created 4 years, 6 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: ui/views/widget/desktop_aura/desktop_factory_ozone.cc
diff --git a/ui/views/widget/desktop_aura/desktop_factory_ozone.cc b/ui/views/widget/desktop_aura/desktop_factory_ozone.cc
index e0a44890bc217a53a287c6fb9e35b833805caccc..1f7cc804b814ae93aa4fde44e09512821ff50f5e 100644
--- a/ui/views/widget/desktop_aura/desktop_factory_ozone.cc
+++ b/ui/views/widget/desktop_aura/desktop_factory_ozone.cc
@@ -4,26 +4,36 @@
#include "ui/views/widget/desktop_aura/desktop_factory_ozone.h"
+#include <memory>
+
#include "base/logging.h"
+#include "ui/ozone/platform_object.h"
namespace views {
// static
-DesktopFactoryOzone* DesktopFactoryOzone::impl_ = NULL;
+DesktopFactoryOzone* DesktopFactoryOzone::impl_ = nullptr;
DesktopFactoryOzone::DesktopFactoryOzone() {
+ DCHECK(!impl_) << "There should only be a single DesktopFactoryOzone.";
+ impl_ = this;
}
DesktopFactoryOzone::~DesktopFactoryOzone() {
+ DCHECK_EQ(impl_, this);
+ impl_ = nullptr;
}
DesktopFactoryOzone* DesktopFactoryOzone::GetInstance() {
- CHECK(impl_) << "DesktopFactoryOzone accessed before constructed";
+ if (!impl_) {
+ std::unique_ptr<DesktopFactoryOzone> factory =
+ ui::PlatformObject<DesktopFactoryOzone>::Create();
+
+ // TODO(tonikitoo): Currently need to leak this object.
Michael Forney 2016/06/06 20:08:21 I wasn't sure about this, but it looks like this i
+ DesktopFactoryOzone* leaky = factory.release();
+ DCHECK_EQ(impl_, leaky);
+ }
return impl_;
}
-void DesktopFactoryOzone::SetInstance(DesktopFactoryOzone* impl) {
- impl_ = impl;
-}
-
} // namespace views

Powered by Google App Engine
This is Rietveld 408576698