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

Unified Diff: ui/events/event.cc

Issue 869433007: Revert of Don't refcount tracking id -> slot id mapping. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/event.h ('k') | ui/events/event_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/event.cc
diff --git a/ui/events/event.cc b/ui/events/event.cc
index 1cd62e3d918793c39a6a6bfd9e62735ed4fc6488..d0966da00847a13bcfe64258596a445fa57bd0e4 100644
--- a/ui/events/event.cc
+++ b/ui/events/event.cc
@@ -526,17 +526,19 @@
radius_y_(GetTouchRadiusY(native_event)),
rotation_angle_(GetTouchAngle(native_event)),
force_(GetTouchForce(native_event)),
- should_remove_native_touch_id_mapping_(false) {
- if (type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED)
- should_remove_native_touch_id_mapping_ = true;
+ may_cause_scrolling_(false) {
+ latency()->AddLatencyNumberWithTimestamp(
+ INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT,
+ 0,
+ 0,
+ base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()),
+ 1);
latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
- FixRotationAngle();
-
- latency()->AddLatencyNumberWithTimestamp(
- INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, 0, 0,
- base::TimeTicks::FromInternalValue(time_stamp().ToInternalValue()), 1);
- latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
+ fixRotationAngle();
+
+ if (type() == ET_TOUCH_PRESSED)
+ IncrementTouchIdRefCount(native_event);
}
TouchEvent::TouchEvent(EventType type,
@@ -550,7 +552,7 @@
radius_y_(0.0f),
rotation_angle_(0.0f),
force_(0.0f),
- should_remove_native_touch_id_mapping_(false) {
+ may_cause_scrolling_(false) {
latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
}
@@ -570,20 +572,17 @@
radius_y_(radius_y),
rotation_angle_(angle),
force_(force),
- should_remove_native_touch_id_mapping_(false) {
+ may_cause_scrolling_(false) {
latency()->AddLatencyNumber(INPUT_EVENT_LATENCY_UI_COMPONENT, 0, 0);
- FixRotationAngle();
+ fixRotationAngle();
}
TouchEvent::~TouchEvent() {
// In ctor TouchEvent(native_event) we call GetTouchId() which in X11
// platform setups the tracking_id to slot mapping. So in dtor here,
// if this touch event is a release event, we clear the mapping accordingly.
- if (should_remove_native_touch_id_mapping_) {
- DCHECK(type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED);
- if (type() == ET_TOUCH_RELEASED || type() == ET_TOUCH_CANCELLED)
- ClearTouchIdIfReleased(native_event());
- }
+ if (HasNativeEvent())
+ ClearTouchIdIfReleased(native_event());
}
void TouchEvent::UpdateForRootTransform(
@@ -604,7 +603,7 @@
static_cast<EventResult>(result() | ER_DISABLE_SYNC_HANDLING));
}
-void TouchEvent::FixRotationAngle() {
+void TouchEvent::fixRotationAngle() {
while (rotation_angle_ < 0)
rotation_angle_ += 180;
while (rotation_angle_ >= 180)
« no previous file with comments | « ui/events/event.h ('k') | ui/events/event_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698