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

Unified Diff: third_party/WebKit/Source/core/events/Event.cpp

Issue 2542693002: Use WTF::TimeTicks to represent timestamp in Platform/Core event types (Closed)
Patch Set: Add TimeTicks::{To,In}Seconds utility functions 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/events/Event.cpp
diff --git a/third_party/WebKit/Source/core/events/Event.cpp b/third_party/WebKit/Source/core/events/Event.cpp
index 7f0f5a312e6469d97e5cb97af592b7d0d2c4262b..127454d08936cc410d276ac9fa024a725086cbe0 100644
--- a/third_party/WebKit/Source/core/events/Event.cpp
+++ b/third_party/WebKit/Source/core/events/Event.cpp
@@ -30,7 +30,6 @@
#include "core/svg/SVGElement.h"
#include "core/timing/DOMWindowPerformance.h"
#include "core/timing/Performance.h"
-#include "wtf/CurrentTime.h"
namespace blink {
@@ -57,7 +56,7 @@ Event::Event() : Event("", false, false) {
Event::Event(const AtomicString& eventType,
bool canBubbleArg,
bool cancelableArg,
- double platformTimeStamp)
+ TimeTicks platformTimeStamp)
: Event(eventType,
canBubbleArg,
cancelableArg,
@@ -72,13 +71,13 @@ Event::Event(const AtomicString& eventType,
canBubbleArg,
cancelableArg,
composedMode,
- monotonicallyIncreasingTime()) {}
+ TimeTicks::Now()) {}
Event::Event(const AtomicString& eventType,
bool canBubbleArg,
bool cancelableArg,
ComposedMode composedMode,
- double platformTimeStamp)
+ TimeTicks platformTimeStamp)
: m_type(eventType),
m_canBubble(canBubbleArg),
m_cancelable(cancelableArg),
@@ -103,7 +102,7 @@ Event::Event(const AtomicString& eventType, const EventInit& initializer)
initializer.cancelable(),
initializer.composed() ? ComposedMode::Composed
: ComposedMode::Scoped,
- monotonicallyIncreasingTime()) {}
+ TimeTicks::Now()) {}
Event::~Event() {}
@@ -332,8 +331,9 @@ double Event::timeStamp(ScriptState* scriptState) const {
if (scriptState && scriptState->domWindow()) {
Performance* performance =
DOMWindowPerformance::performance(*scriptState->domWindow());
+ double timestampSeconds = (m_platformTimeStamp - TimeTicks()).InSecondsF();
timeStamp =
- performance->monotonicTimeToDOMHighResTimeStamp(m_platformTimeStamp);
+ performance->monotonicTimeToDOMHighResTimeStamp(timestampSeconds);
}
return timeStamp;

Powered by Google App Engine
This is Rietveld 408576698