Roll src/third_party/WebKit d9c6159:8139f33 (svn 201974:201975)
[chromium-blink-merge.git] / device / udev_linux / udev_loader.cc
blob88b64e10399249085151a763bc5e60d85bf30d25
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.
5 #include "device/udev_linux/udev_loader.h"
7 #include "base/logging.h"
8 #include "device/udev_linux/udev0_loader.h"
9 #include "device/udev_linux/udev1_loader.h"
11 namespace device {
13 namespace {
15 UdevLoader* g_udev_loader = NULL;
17 } // namespace
19 // static
20 UdevLoader* UdevLoader::Get() {
21 if (g_udev_loader)
22 return g_udev_loader;
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;
31 udev_loader.reset(new Udev0Loader);
32 if (udev_loader->Init()) {
33 g_udev_loader = udev_loader.release();
34 return g_udev_loader;
36 CHECK(false);
37 return NULL;
40 UdevLoader::~UdevLoader() {
43 } // namespace device