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

Unified Diff: third_party/WebKit/Source/core/timing/PerformanceBase.cpp

Issue 2837943006: [WIP] Support PerformanceResourceTiming for Service Worker Navigation Preload (Closed)
Patch Set: clean up Created 3 years, 8 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/timing/PerformanceBase.cpp
diff --git a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
index 1f5902d7261299601a3b037547ee91423d8bbbdd..6ab7ef53c09380343443c3f9243e6b660c628d65 100644
--- a/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
+++ b/third_party/WebKit/Source/core/timing/PerformanceBase.cpp
@@ -505,15 +505,17 @@ double PerformanceBase::ClampTimeResolution(double time_seconds) {
return floor(time_seconds / kResolutionSeconds) * kResolutionSeconds;
}
+// static
DOMHighResTimeStamp PerformanceBase::MonotonicTimeToDOMHighResTimeStamp(
double time_origin,
- double monotonic_time) {
+ double monotonic_time,
+ bool allow_negative_value) {
// Avoid exposing raw platform timestamps.
if (!monotonic_time || !time_origin)
return 0.0;
double time_in_seconds = monotonic_time - time_origin;
- if (time_in_seconds < 0)
+ if (time_in_seconds < 0 && !allow_negative_value)
return 0.0;
return ConvertSecondsToDOMHighResTimeStamp(
ClampTimeResolution(time_in_seconds));
@@ -521,7 +523,8 @@ DOMHighResTimeStamp PerformanceBase::MonotonicTimeToDOMHighResTimeStamp(
DOMHighResTimeStamp PerformanceBase::MonotonicTimeToDOMHighResTimeStamp(
double monotonic_time) const {
- return MonotonicTimeToDOMHighResTimeStamp(time_origin_, monotonic_time);
+ return MonotonicTimeToDOMHighResTimeStamp(time_origin_, monotonic_time,
+ false /* allow_negative_value */);
}
DOMHighResTimeStamp PerformanceBase::now() const {

Powered by Google App Engine
This is Rietveld 408576698