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 "device/udev_linux/udev_loader.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "device/udev_linux/udev0_loader.h" |
| 9 #include "device/udev_linux/udev1_loader.h" |
| 10 |
| 11 namespace device { |
| 12 |
| 13 namespace { |
| 14 |
| 15 UdevLoader* g_udev_loader = NULL; |
| 16 |
| 17 } // namespace |
| 18 |
| 19 // static |
| 20 UdevLoader* UdevLoader::Get() { |
| 21 if (g_udev_loader) |
| 22 return g_udev_loader; |
| 23 |
| 24 scoped_ptr<UdevLoader> udev_loader; |
| 25 udev_loader.reset(new Udev1Loader); |
| 26 if (udev_loader->Init()) { |
| 27 g_udev_loader = udev_loader.release(); |
| 28 return g_udev_loader; |
| 29 } |
| 30 |
| 31 udev_loader.reset(new Udev0Loader); |
| 32 if (udev_loader->Init()) { |
| 33 g_udev_loader = udev_loader.release(); |
| 34 return g_udev_loader; |
| 35 } |
| 36 CHECK(false); |
| 37 return NULL; |
| 38 } |
| 39 |
| 40 UdevLoader::~UdevLoader() { |
| 41 } |
| 42 |
| 43 } // namespace device |
OLD | NEW |