OLD | NEW |
(Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "ui/platform_window/platform_window_factory.h" |
| 6 |
| 7 #include "base/at_exit.h" |
| 8 #include "base/bind.h" |
| 9 #include "base/logging.h" |
| 10 |
| 11 namespace ui { |
| 12 |
| 13 namespace { |
| 14 |
| 15 PlatformWindowFactory* instance = NULL; |
| 16 |
| 17 } // namespace |
| 18 |
| 19 PlatformWindowFactory::PlatformWindowFactory() { |
| 20 CHECK(!instance) << "There can only be a single PlatformWindowFactory."; |
| 21 instance = this; |
| 22 base::AtExitManager::RegisterTask( |
| 23 base::Bind(&base::DeletePointer<PlatformWindowFactory>, instance)); |
| 24 } |
| 25 |
| 26 PlatformWindowFactory::~PlatformWindowFactory() { |
| 27 CHECK_EQ(instance, this); |
| 28 instance = NULL; |
| 29 } |
| 30 |
| 31 // static |
| 32 PlatformWindowFactory* PlatformWindowFactory::GetInstance() { |
| 33 return instance; |
| 34 } |
| 35 |
| 36 } // namespace ui |
OLD | NEW |