Chromium Code Reviews| 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_; |
| } |