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

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

Issue 1287103004: Sync ui/events to chromium @ https://codereview.chromium.org/1210203002 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: rebased Created 5 years, 4 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
Index: ui/events/devices/x11/device_list_cache_x11.h
diff --git a/ui/events/platform/x11/device_list_cache_x.h b/ui/events/devices/x11/device_list_cache_x11.h
similarity index 58%
rename from ui/events/platform/x11/device_list_cache_x.h
rename to ui/events/devices/x11/device_list_cache_x11.h
index 026b82c43aafc68faca27f271ee1e8b613275779..068b6464cdb8a7573fae7a3110d649beb9a4c3eb 100644
--- a/ui/events/platform/x11/device_list_cache_x.h
+++ b/ui/events/devices/x11/device_list_cache_x11.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef UI_EVENTS_PLATFORM_X11_DEVICE_LIST_CACHE_X_H_
-#define UI_EVENTS_PLATFORM_X11_DEVICE_LIST_CACHE_X_H_
+#ifndef UI_EVENTS_DEVICES_X11_DEVICE_LIST_CACHE_X11_H_
+#define UI_EVENTS_DEVICES_X11_DEVICE_LIST_CACHE_X11_H_
#include <X11/extensions/XInput.h>
#include <X11/extensions/XInput2.h>
@@ -11,33 +11,34 @@
#include <map>
#include "base/basictypes.h"
-#include "ui/events/events_base_export.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;
+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) {}
+ 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 {
// A class to cache the current XInput device list. This minimized the
// round-trip time to the X server whenever such a device list is needed. The
// update function will be called on each incoming XI_HierarchyChanged event.
-class EVENTS_BASE_EXPORT DeviceListCacheX {
+class EVENTS_DEVICES_EXPORT DeviceListCacheX11 {
public:
- static DeviceListCacheX* GetInstance();
+ static DeviceListCacheX11* GetInstance();
void UpdateDeviceList(Display* display);
@@ -52,17 +53,18 @@ class EVENTS_BASE_EXPORT DeviceListCacheX {
const XIDeviceList& GetXI2DeviceList(Display* display);
private:
- friend struct DefaultSingletonTraits<DeviceListCacheX>;
+ friend struct DefaultSingletonTraits<DeviceListCacheX11>;
- DeviceListCacheX();
- ~DeviceListCacheX();
+ 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(DeviceListCacheX);
+ DISALLOW_COPY_AND_ASSIGN(DeviceListCacheX11);
};
} // namespace ui
-#endif // UI_EVENTS_PLATFORM_X11_DEVICE_LIST_CACHE_X_H_
+#endif // UI_EVENTS_DEVICES_X11_DEVICE_LIST_CACHE_X11_H_
+
« no previous file with comments | « ui/events/devices/x11/device_data_manager_x11_unittest.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