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

Unified Diff: third_party/WebKit/Source/core/inspector/InspectorInputAgent.cpp

Issue 2542693002: Use WTF::TimeTicks to represent timestamp in Platform/Core event types (Closed)
Patch Set: rebase Created 4 years 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: 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..025abea4f3a05787702d0fc6b9b0cf76221c1b33 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::FromSeconds(ticksInSeconds);
+ }
+ 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;
« no previous file with comments | « third_party/WebKit/Source/core/input/TouchEventManager.cpp ('k') | third_party/WebKit/Source/core/page/AutoscrollController.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698