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

Unified Diff: content/browser/devtools/protocol/input_handler.cc

Issue 1747383002: Convert Devtools protocol Input timestamp to monotonic clock (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address feedback Created 4 years, 9 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 | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/input/eventTimestamp.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/protocol/input_handler.cc
diff --git a/content/browser/devtools/protocol/input_handler.cc b/content/browser/devtools/protocol/input_handler.cc
index d9c17f3ee0e31fcdfe16e7f6c0785b4df16b9433..3dd2f5b73d8df2ac1fff5469485484cf4ab5cbcd 100644
--- a/content/browser/devtools/protocol/input_handler.cc
+++ b/content/browser/devtools/protocol/input_handler.cc
@@ -69,8 +69,13 @@ void SetEventModifiers(blink::WebInputEvent* event, const int* modifiers) {
}
void SetEventTimestamp(blink::WebInputEvent* event, const double* timestamp) {
- event->timeStampSeconds =
- timestamp ? *timestamp : base::Time::Now().ToDoubleT();
+ // Convert timestamp, in seconds since unix epoch, to an event timestamp
+ // which is time ticks since platform start time.
+ base::TimeTicks ticks = timestamp
+ ? base::TimeDelta::FromSecondsD(*timestamp) +
+ base::TimeTicks::UnixEpoch()
+ : base::TimeTicks::Now();
+ event->timeStampSeconds = (ticks - base::TimeTicks()).InSecondsF();
}
bool SetKeyboardEventText(blink::WebUChar* to, const std::string* from) {
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/inspector-protocol/input/eventTimestamp.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698