Chromium Code Reviews| Index: third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp |
| diff --git a/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp b/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp |
| index 223203efa88ccbaf46cd124052b2a0d4a884766e..9c8d83a911b1326b07361812b967f26dd743921f 100644 |
| --- a/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp |
| +++ b/third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp |
| @@ -43,6 +43,7 @@ |
| #include "platform/geometry/IntRect.h" |
| #include "platform/geometry/IntSize.h" |
| #include "wtf/CurrentTime.h" |
| +#include "wtf/Time.h" |
| namespace { |
| @@ -71,15 +72,16 @@ unsigned GetEventModifiers(int modifiers) { |
| // is an estimate because these two clocks respond differently to user setting |
| // time and NTP adjustments. If timestamp is empty then returns current |
| // monotonic timestamp. |
| -double GetEventTimeStamp(const blink::protocol::Maybe<double>& timestamp) { |
| +TimeTicks GetEventTimeStamp(const blink::protocol::Maybe<double>& timestamp) { |
| // Take a snapshot of difference between two clocks on first run and use it |
| // for the duration of the application. |
| static double epochToMonotonicTimeDelta = |
| currentTime() - monotonicallyIncreasingTime(); |
| - if (timestamp.isJust()) |
| - return timestamp.fromJust() - epochToMonotonicTimeDelta; |
| - |
| - return monotonicallyIncreasingTime(); |
| + if (timestamp.isJust()) { |
| + double ticksInSeconds = timestamp.fromJust() - epochToMonotonicTimeDelta; |
| + return TimeTicks() + TimeDelta::FromSecondsD(ticksInSeconds); |
|
esprehn
2016/12/06 22:14:19
I'm not a fan of the API requiring all this math a
|
| + } |
| + return TimeTicks::Now(); |
| } |
| class SyntheticInspectorTouchPoint : public blink::PlatformTouchPoint { |
| @@ -106,7 +108,7 @@ class SyntheticInspectorTouchEvent : public blink::PlatformTouchEvent { |
| public: |
| SyntheticInspectorTouchEvent(const blink::PlatformEvent::EventType type, |
| unsigned modifiers, |
| - double timestamp) { |
| + TimeTicks timestamp) { |
| m_type = type; |
| m_modifiers = modifiers; |
| m_timestamp = timestamp; |