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

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

Issue 1936853002: Assert event timestamp to be monotonic and not from future Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change to histogram Created 4 years, 2 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: 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 3f4f9738ab5a41f8a1bf82f77ac5280491cbcf3d..8d201b7fe90764828b2c4be634c02b2e5488cb99 100644
--- a/third_party/WebKit/Source/core/events/Event.cpp
+++ b/third_party/WebKit/Source/core/events/Event.cpp
@@ -30,6 +30,7 @@
#include "core/svg/SVGElement.h"
#include "core/timing/DOMWindowPerformance.h"
#include "core/timing/Performance.h"
+#include "platform/Histogram.h"
#include "wtf/CurrentTime.h"
namespace blink {
@@ -60,6 +61,13 @@ Event::Event()
Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, double platformTimeStamp)
: Event(eventType, canBubbleArg, cancelableArg, ComposedMode::Scoped, platformTimeStamp)
{
+ // Verify that timestamp is coming from the monotonic clock.
+ double delta = monotonicallyIncreasingTime() - platformTimeStamp;
+ bool hasValidTimebase = delta >= 0 && delta <= 60 * 1000;
+
+ DEFINE_STATIC_LOCAL(BooleanHistogram, histogram, ("Event.TimestampHasValidTimebase.Renderer"));
+ histogram.count(hasValidTimebase);
+ DCHECK(hasValidTimebase);
}
Event::Event(const AtomicString& eventType, bool canBubbleArg, bool cancelableArg, ComposedMode composedMode)

Powered by Google App Engine
This is Rietveld 408576698