Index: third_party/WebKit/Source/core/timing/PerformanceBase.h |
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.h b/third_party/WebKit/Source/core/timing/PerformanceBase.h |
index 7b9644c2dd7c819ab12964d7a9cb499ccc6d3d9e..aa3e09748c3669f5b7ce0ee5b652a9caaa61343d 100644 |
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.h |
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.h |
@@ -33,6 +33,7 @@ |
#define PerformanceBase_h |
#include "core/CoreExport.h" |
+#include "core/dom/DOMHighResTimeStamp.h" |
#include "core/events/EventTarget.h" |
#include "core/timing/PerformanceEntry.h" |
#include "platform/Timer.h" |
@@ -61,12 +62,20 @@ public: |
const AtomicString& interfaceName() const override; |
virtual PerformanceTiming* timing() const; |
- double now() const; |
- |
- double timeOrigin() const { return m_timeOrigin; } |
+ // Reduce the resolution to 5µs to prevent timing attacks. See: |
+ // http://www.w3.org/TR/hr-time-2/#privacy-security |
static double clampTimeResolution(double timeSeconds); |
+ // Translate given platform monotonic time in seconds into a high resolution |
+ // DOMHighResTimeStamp in milliseconds. The result timestamp is relative to |
+ // document's time origin and has a time resolution that is safe for |
+ // exposing to web. |
+ DOMHighResTimeStamp monotonicTimeToDOMHighResTimeStamp(double) const; |
+ DOMHighResTimeStamp now() const; |
+ |
+ double timeOrigin() const { return m_timeOrigin; } |
+ |
PerformanceEntryVector getEntries() const; |
PerformanceEntryVector getEntriesByType(const String& entryType); |
PerformanceEntryVector getEntriesByName(const String& name, const String& entryType); |