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

Side by Side Diff: chrome/browser/storage_monitor/udev_util_linux.h

Issue 16041004: Cleanup: Remove ScopedGenericObj usage in chrome/. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_ 5 #ifndef CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
6 #define CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_ 6 #define CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
7 7
8 #include <libudev.h> 8 #include <libudev.h>
9 9
10 #include <string> 10 #include <string>
11 11
12 #include "base/memory/scoped_generic_obj.h" 12 #include "base/memory/scoped_ptr.h"
13 13
14 namespace base { 14 namespace base {
15 class FilePath; 15 class FilePath;
16 } 16 }
17 17
18 namespace chrome { 18 namespace chrome {
19 19
20 // ScopedGenericObj functor for UdevObjectRelease(). 20 // Deleter for ScopedUdevObject.
21 class ScopedReleaseUdevObject { 21 struct UdevDeleter {
22 void operator()(struct udev* udev);
23 };
24 typedef scoped_ptr<struct udev, UdevDeleter> ScopedUdevObject;
25
26 // Deleter for ScopedUdevDeviceObject().
27 struct UdevDeviceDeleter {
22 public: 28 public:
vandebo (ex-Chrome) 2013/05/28 19:01:07 nit: remove public
Lei Zhang 2013/05/28 20:37:18 Done.
23 void operator()(struct udev* udev) const { 29 void operator()(struct udev_device* device);
24 udev_unref(udev);
25 }
26 }; 30 };
27 typedef ScopedGenericObj<struct udev*, 31 typedef scoped_ptr<struct udev_device, UdevDeviceDeleter>
28 ScopedReleaseUdevObject> ScopedUdevObject; 32 ScopedUdevDeviceObject;
29
30 // ScopedGenericObj functor for UdevDeviceObjectRelease().
31 class ScopedReleaseUdevDeviceObject {
32 public:
33 void operator()(struct udev_device* device) const {
34 udev_device_unref(device);
35 }
36 };
37 typedef ScopedGenericObj<struct udev_device*,
38 ScopedReleaseUdevDeviceObject> ScopedUdevDeviceObject;
39 33
40 // Wrapper function for udev_device_get_property_value() that also checks for 34 // Wrapper function for udev_device_get_property_value() that also checks for
41 // valid but empty values. 35 // valid but empty values.
42 std::string GetUdevDevicePropertyValue(struct udev_device* udev_device, 36 std::string GetUdevDevicePropertyValue(struct udev_device* udev_device,
43 const char* key); 37 const char* key);
44 38
45 // Helper for udev_device_new_from_syspath()/udev_device_get_property_value() 39 // Helper for udev_device_new_from_syspath()/udev_device_get_property_value()
46 // pair. |device_path| is the absolute path to the device, including /sys. 40 // pair. |device_path| is the absolute path to the device, including /sys.
47 bool GetUdevDevicePropertyValueByPath(const base::FilePath& device_path, 41 bool GetUdevDevicePropertyValueByPath(const base::FilePath& device_path,
48 const char* key, 42 const char* key,
49 std::string* result); 43 std::string* result);
50 44
51 } // namespace chrome 45 } // namespace chrome
52 46
53 #endif // CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_ 47 #endif // CHROME_BROWSER_STORAGE_MONITOR_UDEV_UTIL_LINUX_H_
OLDNEW
« no previous file with comments | « chrome/browser/media_galleries/fileapi/native_media_file_util.cc ('k') | chrome/browser/storage_monitor/udev_util_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698