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 { |