QUIC - cleanup changes to sync chromium tree with internal source.
[chromium-blink-merge.git] / device / udev_linux / scoped_udev.h
blob06e3926025418562a673e985de136c0edbc46965
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 #ifndef DEVICE_UDEV_LINUX_SCOPED_UDEV_H_
6 #define DEVICE_UDEV_LINUX_SCOPED_UDEV_H_
8 #include "base/memory/scoped_ptr.h"
9 #include "device/udev_linux/udev.h"
11 #if !defined(USE_UDEV)
12 #error "USE_UDEV not defined"
13 #endif
15 namespace device {
17 struct UdevDeleter {
18 void operator()(udev* dev) const {
19 udev_unref(dev);
22 struct UdevEnumerateDeleter {
23 void operator()(udev_enumerate* enumerate) const {
24 udev_enumerate_unref(enumerate);
27 struct UdevDeviceDeleter {
28 void operator()(udev_device* device) const {
29 udev_device_unref(device);
32 struct UdevMonitorDeleter {
33 void operator()(udev_monitor* monitor) const {
34 udev_monitor_unref(monitor);
38 typedef scoped_ptr<udev, UdevDeleter> ScopedUdevPtr;
39 typedef scoped_ptr<udev_enumerate, UdevEnumerateDeleter> ScopedUdevEnumeratePtr;
40 typedef scoped_ptr<udev_device, UdevDeviceDeleter> ScopedUdevDevicePtr;
41 typedef scoped_ptr<udev_monitor, UdevMonitorDeleter> ScopedUdevMonitorPtr;
43 } // namespace device
45 #endif // DEVICE_UDEV_LINUX_SCOPED_UDEV_H_