Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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) | |
|
jamesr
2015/12/11 19:17:00
hm, wasn't USE_ASH true before? are you sure chang
viettrungluu
2015/12/11 19:28:19
"Fixed".
| |
| 129 // On ash platforms (ChromeOS essentially), the real refresh interval is | |
| 130 // queried from XRandR, regardless of the value calculated here, and | |
| 131 // this value is overriden by ui::CompositorVSyncManager. The log | |
| 132 // should not be fatal in this case. Reconsider all this when XRandR | |
| 133 // support is added to non-ash platforms. | |
| 134 // http://crbug.com/340851 | |
| 135 LOG(ERROR) | |
| 136 #else | |
| 137 LOG(FATAL) | 128 LOG(FATAL) |
| 138 #endif // USE_ASH | |
| 139 << "Calculated bogus refresh interval=" | 129 << "Calculated bogus refresh interval=" |
| 140 << new_interval.InMicroseconds() | 130 << new_interval.InMicroseconds() |
| 141 << " us., last_timebase_=" << last_timebase_.ToInternalValue() | 131 << " us., last_timebase_=" << last_timebase_.ToInternalValue() |
| 142 << " us., timebase=" << timebase.ToInternalValue() | 132 << " us., timebase=" << timebase.ToInternalValue() |
| 143 << " us., last_media_stream_counter_=" << last_media_stream_counter_ | 133 << " us., last_media_stream_counter_=" << last_media_stream_counter_ |
| 144 << ", media_stream_counter=" << media_stream_counter; | 134 << ", media_stream_counter=" << media_stream_counter; |
| 145 } else { | 135 } else { |
| 146 last_good_interval_ = new_interval; | 136 last_good_interval_ = new_interval; |
| 147 } | 137 } |
| 148 } | 138 } |
| 149 } | 139 } |
| 150 | 140 |
| 151 last_timebase_ = timebase; | 141 last_timebase_ = timebase; |
| 152 last_media_stream_counter_ = media_stream_counter; | 142 last_media_stream_counter_ = media_stream_counter; |
| 153 callback.Run(timebase, last_good_interval_); | 143 callback.Run(timebase, last_good_interval_); |
| 154 #endif // defined(OS_LINUX) | 144 #endif // defined(OS_LINUX) |
| 155 } | 145 } |
| 156 | 146 |
| 157 } // namespace gfx | 147 } // namespace gfx |
| OLD | NEW |