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

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

Issue 1995963002: Fix "unused variable" warnings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Undo accidental change 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/views/test/native_widget_factory_desktop.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 gfx {
27 27
28 SyncControlVSyncProvider::SyncControlVSyncProvider() 28 SyncControlVSyncProvider::SyncControlVSyncProvider() : VSyncProvider() {
29 : VSyncProvider(), last_media_stream_counter_(0), invalid_msc_(false) { 29 #if defined(OS_LINUX)
sadrul 2016/05/19 13:10:06 It looks like this whole file is for linux only. P
Peter Kasting 2016/05/19 18:03:45 Yeah, I saw that -- it looks like we want to defin
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 } 35 }
35 36
36 SyncControlVSyncProvider::~SyncControlVSyncProvider() {} 37 SyncControlVSyncProvider::~SyncControlVSyncProvider() {}
37 38
38 void SyncControlVSyncProvider::GetVSyncParameters( 39 void SyncControlVSyncProvider::GetVSyncParameters(
39 const UpdateVSyncCallback& callback) { 40 const UpdateVSyncCallback& callback) {
40 TRACE_EVENT0("gpu", "SyncControlVSyncProvider::GetVSyncParameters"); 41 TRACE_EVENT0("gpu", "SyncControlVSyncProvider::GetVSyncParameters");
41 #if defined(OS_LINUX) 42 #if defined(OS_LINUX)
42 base::TimeTicks timebase; 43 base::TimeTicks timebase;
43 44
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 } 152 }
152 } 153 }
153 154
154 last_timebase_ = timebase; 155 last_timebase_ = timebase;
155 last_media_stream_counter_ = media_stream_counter; 156 last_media_stream_counter_ = media_stream_counter;
156 callback.Run(timebase, last_good_interval_); 157 callback.Run(timebase, last_good_interval_);
157 #endif // defined(OS_LINUX) 158 #endif // defined(OS_LINUX)
158 } 159 }
159 160
160 } // namespace gfx 161 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/sync_control_vsync_provider.h ('k') | ui/views/test/native_widget_factory_desktop.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698