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

Unified Diff: content/browser/renderer_host/input/motion_event_android.cc

Issue 999423003: Set the unique_event_id when converting from TouchEvent to WebTouchEvent (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 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: content/browser/renderer_host/input/motion_event_android.cc
diff --git a/content/browser/renderer_host/input/motion_event_android.cc b/content/browser/renderer_host/input/motion_event_android.cc
index 3f18f95561b3d650ccc3b3d36bd040f6f12f587f..25d3b09a799bd92e9a8471b3c380c5eeefc89e9a 100644
--- a/content/browser/renderer_host/input/motion_event_android.cc
+++ b/content/browser/renderer_host/input/motion_event_android.cc
@@ -115,6 +115,16 @@ size_t ToValidHistorySize(jint history_size, ui::MotionEvent::Action action) {
return history_size;
}
+uint64 get_next_event_id() {
+ // Set the first unique_id_ to 1 because we set id to 0 for other types
+ // of events.
+ static uint64 id = 1;
+ if (id==0)
+ id++;
+ DCHECK_NE(id, 0UL);
tdresser 2015/04/08 12:24:26 We can remove that DCHECK.
lanwei 2015/04/09 04:14:28 Done.
+ return id++;
+}
+
} // namespace
MotionEventAndroid::Pointer::Pointer(jint id,
@@ -164,7 +174,8 @@ MotionEventAndroid::MotionEventAndroid(float pix_to_dip,
cached_button_state_(FromAndroidButtonState(android_button_state)),
cached_flags_(FromAndroidMetaState(meta_state)),
cached_raw_position_offset_(ToDips(raw_offset_x_pixels),
- ToDips(raw_offset_y_pixels)) {
+ ToDips(raw_offset_y_pixels)),
+ unique_id_(get_next_event_id()) {
DCHECK_GT(pointer_count, 0);
event_.Reset(env, event);
@@ -182,6 +193,10 @@ int MotionEventAndroid::GetId() const {
return 0;
}
+uint64 MotionEventAndroid::GetUniqueId() const {
+ return unique_id_;
+}
+
MotionEventAndroid::Action MotionEventAndroid::GetAction() const {
return cached_action_;
}

Powered by Google App Engine
This is Rietveld 408576698