| 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 LOG(FATAL) << "Calculated bogus refresh interval of " | 128 #if defined(USE_ASH) |
| 129 << new_interval.InMicroseconds() << " us. " | 129 // On ash platforms (ChromeOS essentially), the real refresh interval is |
| 130 << "Last time base of " << last_timebase_.ToInternalValue() | 130 // queried from XRandR, regardless of the value calculated here, and |
| 131 << " us. " | 131 // this value is overriden by ui::CompositorVSyncManager. The log |
| 132 << "Current time base of " << timebase.ToInternalValue() | 132 // should not be fatal in this case. Reconsider all this when XRandR |
| 133 << " us. " | 133 // support is added to non-ash platforms. |
| 134 << "Last media stream count of " | 134 // http://crbug.com/340851 |
| 135 << last_media_stream_counter_ << ". " | 135 LOG(ERROR) |
| 136 << "Current media stream count of " << media_stream_counter | 136 #else |
| 137 << "."; | 137 LOG(FATAL) |
| 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; |
| 138 } else { | 145 } else { |
| 139 last_good_interval_ = new_interval; | 146 last_good_interval_ = new_interval; |
| 140 } | 147 } |
| 141 } | 148 } |
| 142 } | 149 } |
| 143 | 150 |
| 144 last_timebase_ = timebase; | 151 last_timebase_ = timebase; |
| 145 last_media_stream_counter_ = media_stream_counter; | 152 last_media_stream_counter_ = media_stream_counter; |
| 146 callback.Run(timebase, last_good_interval_); | 153 callback.Run(timebase, last_good_interval_); |
| 147 #endif // defined(OS_LINUX) | 154 #endif // defined(OS_LINUX) |
| 148 } | 155 } |
| 149 | 156 |
| 150 } // namespace gfx | 157 } // namespace gfx |
| OLD | NEW |