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

Side by Side Diff: ui/gl/sync_control_vsync_provider.cc

Issue 1998723002: Move code in ui/gl/* from gfx:: to gl:: (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 7 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 unified diff | Download patch
« no previous file with comments | « ui/gl/sync_control_vsync_provider.h ('k') | ui/gl/test/egl_initialization_displays_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/sync_control_vsync_provider.h" 5 #include "ui/gl/sync_control_vsync_provider.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
11 #include "base/trace_event/trace_event.h" 11 #include "base/trace_event/trace_event.h"
12 #include "build/build_config.h" 12 #include "build/build_config.h"
13 13
14 #if defined(OS_LINUX) 14 #if defined(OS_LINUX)
15 // These constants define a reasonable range for a calculated refresh interval. 15 // These constants define a reasonable range for a calculated refresh interval.
16 // Calculating refreshes out of this range will be considered a fatal error. 16 // Calculating refreshes out of this range will be considered a fatal error.
17 const int64_t kMinVsyncIntervalUs = base::Time::kMicrosecondsPerSecond / 400; 17 const int64_t kMinVsyncIntervalUs = base::Time::kMicrosecondsPerSecond / 400;
18 const int64_t kMaxVsyncIntervalUs = base::Time::kMicrosecondsPerSecond / 10; 18 const int64_t kMaxVsyncIntervalUs = base::Time::kMicrosecondsPerSecond / 10;
19 19
20 // How much noise we'll tolerate between successive computed intervals before 20 // How much noise we'll tolerate between successive computed intervals before
21 // we think the latest computed interval is invalid (noisey due to 21 // we think the latest computed interval is invalid (noisey due to
22 // monitor configuration change, moving a window between monitors, etc.). 22 // monitor configuration change, moving a window between monitors, etc.).
23 const double kRelativeIntervalDifferenceThreshold = 0.05; 23 const double kRelativeIntervalDifferenceThreshold = 0.05;
24 #endif 24 #endif
25 25
26 namespace gfx { 26 namespace gl {
27 27
28 SyncControlVSyncProvider::SyncControlVSyncProvider() : VSyncProvider() { 28 SyncControlVSyncProvider::SyncControlVSyncProvider() : gfx::VSyncProvider() {
29 #if defined(OS_LINUX) 29 #if defined(OS_LINUX)
30 // On platforms where we can't get an accurate reading on the refresh 30 // On platforms where we can't get an accurate reading on the refresh
31 // rate we fall back to the assumption that we're displaying 60 frames 31 // rate we fall back to the assumption that we're displaying 60 frames
32 // per second. 32 // per second.
33 last_good_interval_ = base::TimeDelta::FromSeconds(1) / 60; 33 last_good_interval_ = base::TimeDelta::FromSeconds(1) / 60;
34 #endif 34 #endif
35 } 35 }
36 36
37 SyncControlVSyncProvider::~SyncControlVSyncProvider() {} 37 SyncControlVSyncProvider::~SyncControlVSyncProvider() {}
38 38
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 151 }
152 } 152 }
153 } 153 }
154 154
155 last_timebase_ = timebase; 155 last_timebase_ = timebase;
156 last_media_stream_counter_ = media_stream_counter; 156 last_media_stream_counter_ = media_stream_counter;
157 callback.Run(timebase, last_good_interval_); 157 callback.Run(timebase, last_good_interval_);
158 #endif // defined(OS_LINUX) 158 #endif // defined(OS_LINUX)
159 } 159 }
160 160
161 } // namespace gfx 161 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/sync_control_vsync_provider.h ('k') | ui/gl/test/egl_initialization_displays_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698