summaryrefslogtreecommitdiffstats
path: root/ui/base
diff options
context:
space:
mode:
authoraofdwsl@gmail.com <aofdwsl@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-09 22:10:41 +0000
committeraofdwsl@gmail.com <aofdwsl@gmail.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-12-09 22:10:41 +0000
commit0a8eaac0f0648688f2385fb599e5aabf52b893b2 (patch)
tree965cd0e62eeb4ac43d624e4b8c6bb7db3ad013c4 /ui/base
parentffbf3f1ed217c406516cc7af6088ce12c6be452a (diff)
downloadchromium_src-0a8eaac0f0648688f2385fb599e5aabf52b893b2.zip
chromium_src-0a8eaac0f0648688f2385fb599e5aabf52b893b2.tar.gz
chromium_src-0a8eaac0f0648688f2385fb599e5aabf52b893b2.tar.bz2
Release slotId of TouchEvent when USE_XI2_MT defined
When defined USE_XI2_MT, slot id of TouchEvent is maintained by a map of tracking id to slot id. Because tracking id will always keep increasing. The item should be released by TouchRelease to free the slot id for future use. BUG=106673 TEST=Manually Tested Review URL: http://codereview.chromium.org/8839004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113850 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/base')
-rw-r--r--ui/base/x/events_x.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/ui/base/x/events_x.cc b/ui/base/x/events_x.cc
index 5976729..4f2db85 100644
--- a/ui/base/x/events_x.cc
+++ b/ui/base/x/events_x.cc
@@ -359,10 +359,16 @@ int GetTouchId(const base::NativeEvent& xev) {
#if defined(USE_XI2_MT)
float tracking_id;
if (!factory->ExtractTouchParam(
- *xev, ui::TouchFactory::TP_TRACKING_ID, &tracking_id))
+ *xev, ui::TouchFactory::TP_TRACKING_ID, &tracking_id)) {
LOG(ERROR) << "Could not get the slot ID for the event. Using 0.";
- else
+ } else {
slot = factory->GetSlotForTrackingID(tracking_id);
+ ui::EventType type = ui::EventTypeFromNative(xev);
+ if (type == ui::ET_TOUCH_CANCELLED ||
+ type == ui::ET_TOUCH_RELEASED) {
+ factory->ReleaseSlotForTrackingID(tracking_id);
+ }
+ }
#else
if (!factory->ExtractTouchParam(
*xev, ui::TouchFactory::TP_SLOT_ID, &slot))