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

Unified Diff: src/views/SkEvent.cpp

Issue 1811613004: Change SkTime::GetMSecs to double; ensure values stored in SkMSec do not overflow. (Closed) Base URL: https://skia.googlesource.com/skia@master
Patch Set: Rebase. Created 4 years, 9 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
« no previous file with comments | « src/pdf/SkPDFMetadata.cpp ('k') | src/views/SkTouchGesture.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/views/SkEvent.cpp
diff --git a/src/views/SkEvent.cpp b/src/views/SkEvent.cpp
index 5316b49a1d4d5ab283f549261ae8e0f0ca04c4fc..b90d03f3d017eae94f8d9a2a355ab54b61d0ac84 100644
--- a/src/views/SkEvent.cpp
+++ b/src/views/SkEvent.cpp
@@ -298,7 +298,7 @@ void SkEvent::postDelay(SkMSec delay) {
}
if (delay) {
- this->postTime(SkTime::GetMSecs() + delay);
+ this->postTime(GetMSecsSinceStartup() + delay);
return;
}
@@ -404,7 +404,7 @@ SkMSec SkEvent::EnqueueTime(SkEvent* evt, SkMSec time) {
prev->fNextEvent = evt;
}
- SkMSec delay = globals.fDelayQHead->fTime - SkTime::GetMSecs();
+ SkMSec delay = globals.fDelayQHead->fTime - GetMSecsSinceStartup();
if ((int32_t)delay <= 0) {
delay = 1;
}
@@ -436,7 +436,7 @@ void SkEvent::ServiceQueueTimer()
globals.fEventMutex.acquire();
bool wasEmpty = false;
- SkMSec now = SkTime::GetMSecs();
+ SkMSec now = GetMSecsSinceStartup();
SkEvent* evt = globals.fDelayQHead;
while (evt)
@@ -485,6 +485,11 @@ int SkEvent::CountEventsOnQueue() {
return count;
}
+SkMSec SkEvent::GetMSecsSinceStartup() {
+ static const double kEpoch = SkTime::GetMSecs();
+ return static_cast<SkMSec>(SkTime::GetMSecs() - kEpoch);
+}
+
///////////////////////////////////////////////////////////////////////////////
void SkEvent::Init() {}
« no previous file with comments | « src/pdf/SkPDFMetadata.cpp ('k') | src/views/SkTouchGesture.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698