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

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

Issue 161413002: Revert of Read compositor VSync information from platform, when possible (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « ui/compositor/test/draw_waiter_for_test.cc ('k') | no next file » | 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"
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 if (last_computed_intervals_.size() == 2) { 118 if (last_computed_intervals_.size() == 2) {
119 const base::TimeDelta& old_interval = last_computed_intervals_.front(); 119 const base::TimeDelta& old_interval = last_computed_intervals_.front();
120 const base::TimeDelta& new_interval = last_computed_intervals_.back(); 120 const base::TimeDelta& new_interval = last_computed_intervals_.back();
121 121
122 double relative_change = 122 double relative_change =
123 fabs(old_interval.InMillisecondsF() - new_interval.InMillisecondsF()) / 123 fabs(old_interval.InMillisecondsF() - new_interval.InMillisecondsF()) /
124 new_interval.InMillisecondsF(); 124 new_interval.InMillisecondsF();
125 if (relative_change < kRelativeIntervalDifferenceThreshold) { 125 if (relative_change < kRelativeIntervalDifferenceThreshold) {
126 if (new_interval.InMicroseconds() < kMinVsyncIntervalUs || 126 if (new_interval.InMicroseconds() < kMinVsyncIntervalUs ||
127 new_interval.InMicroseconds() > kMaxVsyncIntervalUs) { 127 new_interval.InMicroseconds() > kMaxVsyncIntervalUs) {
128 #if defined(USE_ASH) 128 LOG(FATAL) << "Calculated bogus refresh interval of "
129 // On ash platforms (ChromeOS essentially), the real refresh interval is 129 << new_interval.InMicroseconds() << " us. "
130 // queried from XRandR, regardless of the value calculated here, and 130 << "Last time base of " << last_timebase_.ToInternalValue()
131 // this value is overriden by ui::CompositorVSyncManager. The log 131 << " us. "
132 // should not be fatal in this case. Reconsider all this when XRandR 132 << "Current time base of " << timebase.ToInternalValue()
133 // support is added to non-ash platforms. 133 << " us. "
134 // http://crbug.com/340851 134 << "Last media stream count of "
135 LOG(ERROR) 135 << last_media_stream_counter_ << ". "
136 #else 136 << "Current media stream count of " << media_stream_counter
137 LOG(FATAL) 137 << ".";
138 #endif // USE_ASH
139 << "Calculated bogus refresh interval="
140 << new_interval.InMicroseconds()
141 << " us., last_timebase_=" << last_timebase_.ToInternalValue()
142 << " us., timebase=" << timebase.ToInternalValue()
143 << " us., last_media_stream_counter_=" << last_media_stream_counter_
144 << ", media_stream_counter=" << media_stream_counter;
145 } else { 138 } else {
146 last_good_interval_ = new_interval; 139 last_good_interval_ = new_interval;
147 } 140 }
148 } 141 }
149 } 142 }
150 143
151 last_timebase_ = timebase; 144 last_timebase_ = timebase;
152 last_media_stream_counter_ = media_stream_counter; 145 last_media_stream_counter_ = media_stream_counter;
153 callback.Run(timebase, last_good_interval_); 146 callback.Run(timebase, last_good_interval_);
154 #endif // defined(OS_LINUX) 147 #endif // defined(OS_LINUX)
155 } 148 }
156 149
157 } // namespace gfx 150 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/compositor/test/draw_waiter_for_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698