From 1fb4edaf534c278a0b7a3150efff8e712c1efe91 Mon Sep 17 00:00:00 2001 From: Peng Huang Date: Tue, 19 Feb 2019 22:01:52 +0000 Subject: [PATCH] Avoid log flooding in GLSurfacePresentationHelper Bug: 879929 Change-Id: Ifb452736573e65791ed5e3f143778f576854a167 Reviewed-on: https://chromium-review.googlesource.com/c/1477918 Commit-Queue: Peng Huang Reviewed-by: Antoine Labour Cr-Commit-Position: refs/heads/master@{#633415} --- ui/gl/gl_surface_presentation_helper.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ui/gl/gl_surface_presentation_helper.cc b/ui/gl/gl_surface_presentation_helper.cc index 987725ca1c931..e7bcd1a5b79ff 100644 --- a/ui/gl/gl_surface_presentation_helper.cc +++ b/ui/gl/gl_surface_presentation_helper.cc @@ -237,7 +237,13 @@ void GLSurfacePresentationHelper::CheckPendingFrames() { &vsync_interval_)) { vsync_timebase_ = base::TimeTicks(); vsync_interval_ = base::TimeDelta(); - LOG(ERROR) << "GetVSyncParametersIfAvailable() failed!"; + static unsigned int count = 0; + ++count; + // GetVSyncParametersIfAvailable() could be called and failed frequently, + // so we have to limit the LOG to avoid flooding the log. + LOG_IF(ERROR, count < 20 || !(count & 0xff)) + << "GetVSyncParametersIfAvailable() failed for " << count + << " times!"; } }