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

Unified Diff: ui/events/devices/x11/device_list_cache_x11.h

Issue 989993002: x11: Use scoped_ptr<> for X11 objects where it makes sense. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/events/devices/x11/device_data_manager_x11.cc ('k') | ui/events/devices/x11/device_list_cache_x11.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/devices/x11/device_list_cache_x11.h
diff --git a/ui/events/devices/x11/device_list_cache_x11.h b/ui/events/devices/x11/device_list_cache_x11.h
index bd62fb84eb77c1425b179602b909389d45cbdeee..068b6464cdb8a7573fae7a3110d649beb9a4c3eb 100644
--- a/ui/events/devices/x11/device_list_cache_x11.h
+++ b/ui/events/devices/x11/device_list_cache_x11.h
@@ -11,26 +11,25 @@
#include <map>
#include "base/basictypes.h"
+#include "base/memory/scoped_ptr.h"
#include "ui/events/devices/events_devices_export.h"
+#include "ui/gfx/x/x11_types.h"
template <typename T> struct DefaultSingletonTraits;
typedef struct _XDisplay Display;
-template <typename T>
+template <typename T, void (*D)(T*)>
struct DeviceList {
- DeviceList() : devices(NULL), count(0) {
- }
- T& operator[] (int x) {
- return devices[x];
- }
+ DeviceList() : count(0) {}
+ T& operator[](int x) { return devices[x]; }
const T& operator[](int x) const { return devices[x]; }
- T* devices;
+ scoped_ptr<T[], gfx::XObjectDeleter<T, void, D>> devices;
int count;
};
-typedef struct DeviceList<XDeviceInfo> XDeviceList;
-typedef struct DeviceList<XIDeviceInfo> XIDeviceList;
+typedef struct DeviceList<XDeviceInfo, XFreeDeviceList> XDeviceList;
+typedef struct DeviceList<XIDeviceInfo, XIFreeDeviceInfo> XIDeviceList;
namespace ui {
@@ -59,8 +58,8 @@ class EVENTS_DEVICES_EXPORT DeviceListCacheX11 {
DeviceListCacheX11();
~DeviceListCacheX11();
- std::map<Display*, XDeviceList> x_dev_list_map_;
- std::map<Display*, XIDeviceList> xi_dev_list_map_;
+ XDeviceList x_dev_list_;
+ XIDeviceList xi_dev_list_;
DISALLOW_COPY_AND_ASSIGN(DeviceListCacheX11);
};
« no previous file with comments | « ui/events/devices/x11/device_data_manager_x11.cc ('k') | ui/events/devices/x11/device_list_cache_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698