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

Side by Side Diff: device/udev_linux/scoped_udev.h

Issue 1874313002: Convert device to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « device/test/usb_test_gadget_impl.cc ('k') | device/udev_linux/udev0_loader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef DEVICE_UDEV_LINUX_SCOPED_UDEV_H_ 5 #ifndef DEVICE_UDEV_LINUX_SCOPED_UDEV_H_
6 #define DEVICE_UDEV_LINUX_SCOPED_UDEV_H_ 6 #define DEVICE_UDEV_LINUX_SCOPED_UDEV_H_
7 7
8 #include "base/memory/scoped_ptr.h" 8 #include <memory>
9
9 #include "device/udev_linux/udev.h" 10 #include "device/udev_linux/udev.h"
10 11
11 #if !defined(USE_UDEV) 12 #if !defined(USE_UDEV)
12 #error "USE_UDEV not defined" 13 #error "USE_UDEV not defined"
13 #endif 14 #endif
14 15
15 namespace device { 16 namespace device {
16 17
17 struct UdevDeleter { 18 struct UdevDeleter {
18 void operator()(udev* dev) const { 19 void operator()(udev* dev) const {
19 udev_unref(dev); 20 udev_unref(dev);
20 } 21 }
21 }; 22 };
22 struct UdevEnumerateDeleter { 23 struct UdevEnumerateDeleter {
23 void operator()(udev_enumerate* enumerate) const { 24 void operator()(udev_enumerate* enumerate) const {
24 udev_enumerate_unref(enumerate); 25 udev_enumerate_unref(enumerate);
25 } 26 }
26 }; 27 };
27 struct UdevDeviceDeleter { 28 struct UdevDeviceDeleter {
28 void operator()(udev_device* device) const { 29 void operator()(udev_device* device) const {
29 udev_device_unref(device); 30 udev_device_unref(device);
30 } 31 }
31 }; 32 };
32 struct UdevMonitorDeleter { 33 struct UdevMonitorDeleter {
33 void operator()(udev_monitor* monitor) const { 34 void operator()(udev_monitor* monitor) const {
34 udev_monitor_unref(monitor); 35 udev_monitor_unref(monitor);
35 } 36 }
36 }; 37 };
37 38
38 typedef scoped_ptr<udev, UdevDeleter> ScopedUdevPtr; 39 typedef std::unique_ptr<udev, UdevDeleter> ScopedUdevPtr;
39 typedef scoped_ptr<udev_enumerate, UdevEnumerateDeleter> ScopedUdevEnumeratePtr; 40 typedef std::unique_ptr<udev_enumerate, UdevEnumerateDeleter>
40 typedef scoped_ptr<udev_device, UdevDeviceDeleter> ScopedUdevDevicePtr; 41 ScopedUdevEnumeratePtr;
41 typedef scoped_ptr<udev_monitor, UdevMonitorDeleter> ScopedUdevMonitorPtr; 42 typedef std::unique_ptr<udev_device, UdevDeviceDeleter> ScopedUdevDevicePtr;
43 typedef std::unique_ptr<udev_monitor, UdevMonitorDeleter> ScopedUdevMonitorPtr;
42 44
43 } // namespace device 45 } // namespace device
44 46
45 #endif // DEVICE_UDEV_LINUX_SCOPED_UDEV_H_ 47 #endif // DEVICE_UDEV_LINUX_SCOPED_UDEV_H_
OLDNEW
« no previous file with comments | « device/test/usb_test_gadget_impl.cc ('k') | device/udev_linux/udev0_loader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698