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

Unified Diff: ui/gl/gl_surface_glx.cc

Issue 1229853004: Base: Make TimeDelta constructors deal with overflow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove static initializers Created 5 years, 5 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 | « chrome/browser/sync/sync_stopped_reporter.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gl_surface_glx.cc
diff --git a/ui/gl/gl_surface_glx.cc b/ui/gl/gl_surface_glx.cc
index b021a4268387e200bad1af7968d2cb24f37c2979..49ff041150750938bae510d6bb59539e182be88f 100644
--- a/ui/gl/gl_surface_glx.cc
+++ b/ui/gl/gl_surface_glx.cc
@@ -47,7 +47,7 @@ bool g_glx_get_msc_rate_oml_supported = false;
bool g_glx_sgi_video_sync_supported = false;
-static const base::TimeDelta kGetVSyncParametersMinPeriod =
+static const int kGetVSyncParametersMinSeconds =
#if defined(OS_LINUX)
// See crbug.com/373489
// On Linux, querying the vsync parameters might burn CPU for up to an
@@ -55,9 +55,9 @@ static const base::TimeDelta kGetVSyncParametersMinPeriod =
// 5 seconds is chosen somewhat abitrarily as a balance between:
// a) Drift in the phase of our signal.
// b) Potential janks from periodically pegging the CPU.
- base::TimeDelta::FromSeconds(5);
+ 5;
#else
- base::TimeDelta::FromSeconds(0);
+ 0;
#endif
class OMLSyncControlVSyncProvider
@@ -261,10 +261,10 @@ class SGIVideoSyncVSyncProvider
void GetVSyncParameters(
const VSyncProvider::UpdateVSyncCallback& callback) override {
- if (kGetVSyncParametersMinPeriod > base::TimeDelta()) {
+ if (kGetVSyncParametersMinSeconds > 0) {
base::TimeTicks now = base::TimeTicks::Now();
base::TimeDelta delta = now - last_get_vsync_parameters_time_;
- if (delta < kGetVSyncParametersMinPeriod)
+ if (delta.InSeconds() < kGetVSyncParametersMinSeconds)
return;
last_get_vsync_parameters_time_ = now;
}
« no previous file with comments | « chrome/browser/sync/sync_stopped_reporter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698