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

Unified Diff: ui/events/devices/x11/device_data_manager_x11.cc

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/display/util/x11/edid_parser_x11.cc ('k') | ui/events/devices/x11/device_list_cache_x11.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/devices/x11/device_data_manager_x11.cc
diff --git a/ui/events/devices/x11/device_data_manager_x11.cc b/ui/events/devices/x11/device_data_manager_x11.cc
index 85c697aaa0d33376d8f60a81f768b4a11ad61acf..0723c122f302e54c006976f886947dfd1112180c 100644
--- a/ui/events/devices/x11/device_data_manager_x11.cc
+++ b/ui/events/devices/x11/device_data_manager_x11.cc
@@ -214,7 +214,7 @@ void DeviceDataManagerX11::UpdateDeviceList(Display* display) {
}
// Find all the touchpad devices.
- XDeviceList dev_list =
+ const XDeviceList& dev_list =
ui::DeviceListCacheX11::GetInstance()->GetXDeviceList(display);
Atom xi_touchpad = XInternAtom(display, XI_TOUCHPAD, false);
for (int i = 0; i < dev_list.count; ++i)
@@ -225,30 +225,30 @@ void DeviceDataManagerX11::UpdateDeviceList(Display* display) {
return;
// Update the structs with new valuator information
- XIDeviceList info_list =
+ const XIDeviceList& info_list =
ui::DeviceListCacheX11::GetInstance()->GetXI2DeviceList(display);
Atom atoms[DT_LAST_ENTRY];
for (int data_type = 0; data_type < DT_LAST_ENTRY; ++data_type)
atoms[data_type] = atom_cache_.GetAtom(kCachedAtoms[data_type]);
for (int i = 0; i < info_list.count; ++i) {
- XIDeviceInfo* info = info_list.devices + i;
+ const XIDeviceInfo& info = info_list[i];
- if (info->use == XIMasterPointer)
- master_pointers_.push_back(info->deviceid);
+ if (info.use == XIMasterPointer)
+ master_pointers_.push_back(info.deviceid);
// We currently handle only slave, non-keyboard devices
- if (info->use != XISlavePointer && info->use != XIFloatingSlave)
+ if (info.use != XISlavePointer && info.use != XIFloatingSlave)
continue;
bool possible_cmt = false;
bool not_cmt = false;
- const int deviceid = info->deviceid;
+ const int deviceid = info.deviceid;
- for (int j = 0; j < info->num_classes; ++j) {
- if (info->classes[j]->type == XIValuatorClass)
+ for (int j = 0; j < info.num_classes; ++j) {
+ if (info.classes[j]->type == XIValuatorClass)
++valuator_count_[deviceid];
- else if (info->classes[j]->type == XIScrollClass)
+ else if (info.classes[j]->type == XIScrollClass)
not_cmt = true;
}
@@ -263,12 +263,12 @@ void DeviceDataManagerX11::UpdateDeviceList(Display* display) {
valuator_max_[deviceid].resize(DT_LAST_ENTRY, 0);
for (int j = 0; j < kMaxSlotNum; j++)
last_seen_valuator_[deviceid][j].resize(DT_LAST_ENTRY, 0);
- for (int j = 0; j < info->num_classes; ++j) {
- if (info->classes[j]->type != XIValuatorClass)
+ for (int j = 0; j < info.num_classes; ++j) {
+ if (info.classes[j]->type != XIValuatorClass)
continue;
XIValuatorClassInfo* v =
- reinterpret_cast<XIValuatorClassInfo*>(info->classes[j]);
+ reinterpret_cast<XIValuatorClassInfo*>(info.classes[j]);
for (int data_type = 0; data_type < DT_LAST_ENTRY; ++data_type) {
if (v->label == atoms[data_type]) {
valuator_lookup_[deviceid][data_type] = v->number;
« no previous file with comments | « ui/display/util/x11/edid_parser_x11.cc ('k') | ui/events/devices/x11/device_list_cache_x11.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698