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

Unified Diff: ui/platform_window/platform_window_factory.cc

Issue 403263002: platform-window: Add a PlatformWindowFactory for creating windows. Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win32 Created 6 years, 5 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/platform_window/platform_window_factory.cc
diff --git a/ui/platform_window/platform_window_factory.cc b/ui/platform_window/platform_window_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..3e9c30d7e9ca65218d1553f6506c8fb412a8563d
--- /dev/null
+++ b/ui/platform_window/platform_window_factory.cc
@@ -0,0 +1,36 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/platform_window/platform_window_factory.h"
+
+#include "base/at_exit.h"
+#include "base/bind.h"
+#include "base/logging.h"
+
+namespace ui {
+
+namespace {
+
+PlatformWindowFactory* instance = NULL;
+
+} // namespace
+
+PlatformWindowFactory::PlatformWindowFactory() {
+ CHECK(!instance) << "There can only be a single PlatformWindowFactory.";
+ instance = this;
+ base::AtExitManager::RegisterTask(
+ base::Bind(&base::DeletePointer<PlatformWindowFactory>, instance));
+}
+
+PlatformWindowFactory::~PlatformWindowFactory() {
+ CHECK_EQ(instance, this);
+ instance = NULL;
+}
+
+// static
+PlatformWindowFactory* PlatformWindowFactory::GetInstance() {
+ return instance;
+}
+
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698