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

Unified Diff: content/common/input/synthetic_web_input_event_builders.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/common/input/synthetic_web_input_event_builders.cc
diff --git a/content/common/input/synthetic_web_input_event_builders.cc b/content/common/input/synthetic_web_input_event_builders.cc
index 36fc28f21b920bc173f6b783c7565607b171c126..5373a4b5b1ea433242634f92ddd3fe5719fc3e2a 100644
--- a/content/common/input/synthetic_web_input_event_builders.cc
+++ b/content/common/input/synthetic_web_input_event_builders.cc
@@ -10,6 +10,20 @@
namespace content {
+namespace {
+
+uint64 get_next_event_id() {
tdresser 2015/04/08 12:24:26 Can we factor this method out into a helper somewh
lanwei 2015/04/09 04:14:28 Done.
+ // 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);
+ return id++;
+}
+
+} // namespace
+
using blink::WebInputEvent;
using blink::WebKeyboardEvent;
using blink::WebGestureEvent;
@@ -150,6 +164,7 @@ WebGestureEvent SyntheticWebGestureEventBuilder::BuildFling(
}
SyntheticWebTouchEvent::SyntheticWebTouchEvent() : WebTouchEvent() {
+ uniqueTouchEventId = get_next_event_id();
SetTimestamp(base::TimeTicks::Now() - base::TimeTicks());
}

Powered by Google App Engine
This is Rietveld 408576698